X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=support%2Fdoc%2Fapi%2Fembeds.md;h=bc3b5304c39f59d067263b7ce15d6b97c578548e;hb=fba911e2c89708a166636e3a93fcd8fcbc3de7e1;hp=7085b4b0ad569e2592eafd143a433fb350ac7712;hpb=624a022157abc74e72c2cac3a80c823eb950e599;p=github%2FChocobozzz%2FPeerTube.git diff --git a/support/doc/api/embeds.md b/support/doc/api/embeds.md index 7085b4b0a..bc3b5304c 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 @@ -49,6 +49,59 @@ player.seek(32) player.pause() ``` +# URL parameters + +You can customize PeerTube player by specifying URL query parameters. +For example `https://my-instance.example.com/videos/embed/52a10666-3a18-4e73-93da-e8d3c12c305a??start=1s&stop=18s&loop=1&autoplay=1&muted=1&warningTitle=0&controlBar=0&peertubeLink=0&p2p=0` + +## start + +Start the video at a specific time. +Value must be raw seconds or a duration (`3m4s`) + +## stop + +Stop the video at a specific time. +Value must be raw seconds or a duration (`54s`) + +## controls + +Mimics video HTML element `controls` attribute, meaning that all controls (including big play button, control bar, etc.) will be removed. +It can be useful if you want to have a full control of the PeerTube player. + +Value must be `0` or `1`. + +## controlBar + +Hide control bar when the video is played. + +Value must be `0` or `1`. + +## peertubeLink + +Hide PeerTube link in control bar. + +Value must be `0` or `1`. + +## muted + +Mute the video by default. + +Value must be `0` or `1`. + +## loop + +Automatically start again the video when it ends. + +Value must be `0` or `1`. + +## subtitle + +Auto select a subtitle by default. + +Value must be a valid subtitle ISO code (`fr`, `en`, etc.). + + # Methods ## `play() : Promise` @@ -95,11 +148,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 +160,33 @@ 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. + +## `playNextVideo(): Promise` + +Play next video in playlist. + +## `playPreviousVideo(): Promise` + +Play previous video in playlist. + +## `getCurrentPosition(): Promise` + +Get current position in playlist (starts from 1). + # 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