X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=support%2Fdoc%2Fapi%2Fembeds.md;h=e3df35efcdd7a58b7595f9b5518dc67fbc29259a;hb=1151f5210c0e7665ec6714e73261f299e6fe757b;hp=7085b4b0ad569e2592eafd143a433fb350ac7712;hpb=fc8aabd0bf38441c0591f21b9b435b52e99ffc23;p=github%2FChocobozzz%2FPeerTube.git diff --git a/support/doc/api/embeds.md b/support/doc/api/embeds.md index 7085b4b0a..e3df35efc 100644 --- a/support/doc/api/embeds.md +++ b/support/doc/api/embeds.md @@ -4,8 +4,8 @@ PeerTube lets you embed videos and programmatically control their playback. This ## Playground -Any PeerTube embed URL (ie `https://my-instance.example.com/videos/embed/52a10666-3a18-4e73-93da-e8d3c12c305a`) can be viewed as an embedding playground which -allows you to test various aspects of PeerTube embeds. Simply replace `/embed` with `/test-embed` and visit the URL in a browser. +Any PeerTube embed URL (ie `https://my-instance.example.com/videos/embed/52a10666-3a18-4e73-93da-e8d3c12c305a`) can be viewed as an embedding playground which +allows you to test various aspects of PeerTube embeds. Simply replace `/embed` with `/test-embed` and visit the URL in a browser. For instance, the playground URL for the above embed URL is `https://my-instance.example.com/videos/test-embed/52a10666-3a18-4e73-93da-e8d3c12c305a`. ## Quick Start @@ -95,11 +95,11 @@ Get the available playback rates, where `1` represents normal speed, `0.5` is ha Get the current playback rate. See `getPlaybackRates()` for more information. -## `setPlaybackRate(rate : number) : Promise` +## `setPlaybackRate(rate: number) : Promise` Set the current playback rate. The passed rate should be a value as returned by `getPlaybackRates()`. -## `setVolume(factor : number) : Promise` +## `setVolume(factor: number) : Promise` Set the playback volume. Value should be between `0` and `1`. @@ -107,13 +107,21 @@ Set the playback volume. Value should be between `0` and `1`. Get the playback volume. Returns a value between `0` and `1`. +## `setCaption(id: string) : Promise` + +Update current caption using the caption id. + +## `getCaptions(): Promise<{ id: string, label: string, src: string, mode: 'disabled' | 'showing' }>` + +Get video captions. + # Events You can subscribe to events by using `addEventListener()`. See above for details. ## Event `playbackStatusUpdate` -Fired every half second to provide the current status of playback. +Fired every half second to provide the current status of playback. The parameter of the callback will resemble: ```json