X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fstandalone%2Fplayer%2Fplayer.ts;h=9776fda120297fbfd21966203cfd66f5eb65aeb1;hb=35f676e5d3e5e242e84ed63da2cc78117079c7cb;hp=71c41295076db65bdc1a8e36c1e97510deaa6007;hpb=03d641a0d7f996de44ec898ad739bc4050514ba1;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/standalone/player/player.ts b/client/src/standalone/player/player.ts index 71c412950..9776fda12 100644 --- a/client/src/standalone/player/player.ts +++ b/client/src/standalone/player/player.ts @@ -1,6 +1,6 @@ import * as Channel from 'jschannel' +import { EventHandler, PeerTubeResolution, PeerTubeTextTrack, PlayerEventType } from './definitions' import { EventRegistrar } from './events' -import { EventHandler, PlayerEventType, PeerTubeResolution } from './definitions' const PASSTHROUGH_EVENTS = [ 'pause', @@ -104,6 +104,21 @@ export class PeerTubePlayer { return this.sendMessage('getVolume') } + /** + * Tell the embed to change the current caption + * @param value Caption id + */ + async setCaption (value: string) { + await this.sendMessage('setCaption', value) + } + + /** + * Get video captions + */ + async getCaptions (): Promise { + return this.sendMessage('getCaptions') + } + /** * Tell the embed to seek to a specific position (in seconds) * @param seconds @@ -155,6 +170,27 @@ export class PeerTubePlayer { await this.sendMessage('setPlaybackRate', rate) } + /** + * Play next video in playlist + */ + async playNextVideo () { + await this.sendMessage('playNextVideo') + } + + /** + * Play previous video in playlist + */ + async playPreviousVideo () { + await this.sendMessage('playPreviousVideo') + } + + /** + * Get video position currently played (starts from 1) + */ + async getCurrentPosition () { + return this.sendMessage('getCurrentPosition') + } + private constructChannel () { this.channel = Channel.build({ window: this.embedElement.contentWindow,