Podcast RSS Documentation

This commit is contained in:
Alecks Gates 2023-07-06 01:42:25 -05:00 committed by John Livingston
parent 995dfa4dff
commit bf5ae50443

View File

@ -141,7 +141,7 @@ If you want to display the chat in a web page or in an iframe, here is what you
* get the Video ActivityPub object,
* if there is no `attachment` key, stop.
* loop through the `attachment` values (if `attachment is not an array, just iterate on this single value)
* loop through the `attachment` values (if `attachment` is not an array, just iterate on this single value)
* search for an entry with `rel` === `discussion`, and with `href` using the `https` scheme (that begins with `https://`)
* if found, open this href
@ -149,7 +149,7 @@ If you want to open the chat room using the XMPP protocol:
* get the Video ActivityPub object,
* if there is no `attachment` key, stop.
* loop through the `attachment` values (if `attachment is not an array, just iterate on this single value)
* loop through the `attachment` values (if `attachment` is not an array, just iterate on this single value)
* search for an entry with `rel` === `discussion`, and with `href` using the `xmpp` scheme (that begins with `xmpp://`)
* if found, open this xmpp uri with your client, or connect to the XMPP room at that address
@ -161,6 +161,8 @@ It is currently required for some endpoint discovery.
### Using Podcast RSS feed
The livechat plugin adds some data in Podcast RSS feeds under the [`<podcast:liveItem>`](https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md#live-item), so that the chat can be discovered for live streams.
{{% notice warning %}}
This part is not implemented yet, but should be available for v7.2.0 release.
{{% /notice %}}
@ -168,3 +170,94 @@ This part is not implemented yet, but should be available for v7.2.0 release.
{{% notice info %}}
This requires Peertube >= 5.2
{{% /notice %}}
{{% notice info %}}
The `<podcast:chat>` element is currently only supported for live streams.
{{% /notice %}}
This follows the [`<podcast:chat>`](https://github.com/Podcastindex-org/podcast-namespace/discussions/502) proposal.
{{% notice warning %}}
At the time of the writing, this proposal is in draft status, and the livechat plugin is a Proof-of-concept.
Until the proposal is adopted, the specification can change, and the livechat plugin will be adapted accordingly.
{{% /notice %}}
Basically, the chat will be declared as tag under on the `<podcast:liveItem>` element.
By default, here is an example of what you will get:
```xml
<podcast:liveItem status="live" start="2023-07-06T18:00:00.000Z">
<title>The video title</title>
<guid isPermaLink="false">e32b4890-983b-4ce5-8b46-f2d6bc1d8819_2023-07-06T18:00:00.000Z</guid>
<link>https://yourinstance.tld/videos/watch/8df24108-6e70-4fc8-b1cc-f2db7fcdd535</link>
<podcast:socialInteract
uri="https://yourinstance.tld/videos/watch/8df24108-6e70-4fc8-b1cc-f2db7fcdd535"
protocol="activitypub"
accountUrl="https://yourinstance.tld/a/youraccount"
/>
<enclosure url="https://yourinstance.tld/path/to/video/master.m3u8" type="application/x-mpegURL" />
<podcast:alternateEnclosure type="application/x-mpegURL" lang="en" title="HLS" default="true">
<podcast:source uri="https://yourinstance.tld/path/to/video/master.m3u8" />
</podcast:alternateEnclosure>
<itunes:image href="https://yourinstance.tld/lazy-static/previews/8df24108-6e70-4fc8-b1cc-f2db7fcdd535.jpg" />
<podcast:chat
server="yourinstance.tld"
protocol="xmpp"
embedUrl="https://yourinstance.tld/plugins/livechat/router/webchat/room/8df24108-6e70-4fc8-b1cc-f2db7fcdd535"
/>
</podcast:liveItem>
```
In case the instance has activated the
[external XMPP clients connection](/peertube-plugin-livechat/documentation/admin/advanced/xmpp_clients/) feature:
```xml
<podcast:liveItem status="live" start="2023-07-06T18:00:00.000Z">
<title>The video title</title>
<guid isPermaLink="false">e32b4890-983b-4ce5-8b46-f2d6bc1d8819_2023-07-06T18:00:00.000Z</guid>
<link>https://yourinstance.tld/videos/watch/8df24108-6e70-4fc8-b1cc-f2db7fcdd535</link>
<podcast:socialInteract
uri="https://yourinstance.tld/videos/watch/8df24108-6e70-4fc8-b1cc-f2db7fcdd535"
protocol="activitypub"
accountUrl="https://yourinstance.tld/a/youraccount"
/>
<enclosure url="https://yourinstance.tld/path/to/video/master.m3u8" type="application/x-mpegURL" />
<podcast:alternateEnclosure type="application/x-mpegURL" lang="en" title="HLS" default="true">
<podcast:source uri="https://yourinstance.tld/path/to/video/master.m3u8" />
</podcast:alternateEnclosure>
<itunes:image href="https://yourinstance.tld/lazy-static/previews/8df24108-6e70-4fc8-b1cc-f2db7fcdd535.jpg" />
<podcast:chat
server="yourinstance.tld"
protocol="xmpp"
space="8df24108-6e70-4fc8-b1cc-f2db7fcdd535@room.yourinstance.tld"
embedUrl="https://yourinstance.tld/plugins/livechat/router/webchat/room/8df24108-6e70-4fc8-b1cc-f2db7fcdd535"
/>
</podcast:liveItem>
```
#### Algorithm
If you want to display the chat in a web page or in an iframe, here is what you should do:
* get the Podcast RSS feed for the channel,
* if there is no `<podcast:liveItem>` element under the `<channel>`, stop.
* find the `<podcast:liveItem>` you are looking for
* `<podcast:socialInteract>` can be used to cross-reference the items with ActivityPub
* if there is no `<podcast:chat>` element under the `<podcast:liveItem>`, stop.
* loop through the `<podcast:chat>` values (if `<podcast:chat>` is not an array, just iterate on this single value)
* there should only be one, but you should expect to handle several just in case
* search for the first entry `protocol` === `xmpp` and an `embedUrl` attribute
* if found, open this embedUrl
If you want to open the chat room using the XMPP protocol:
* get the Podcast RSS feed for the channel,
* if there is no `<podcast:liveItem>` element under the `<channel>`, stop.
* find the `<podcast:liveItem>` you are looking for
* `<podcast:socialInteract>` can be used to cross-reference the items with ActivityPub
* loop through the `<podcast:chat>` values (if `<podcast:chat>` is not an array, just iterate on this single value)
* there should only be one, but you should expect to handle several just in case
* search for the first entry `protocol` === `xmpp` and a `space` attribute
* space should be an XMPP JID for a MUC
* if found, open this XMPP JID with your client after converting it to a join URI, or connect to the XMPP room at that address