From 1151f5210c0e7665ec6714e73261f299e6fe757b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 6 May 2020 11:54:33 +0200 Subject: Add ability to update embed captions --- client/src/standalone/player/player.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'client/src/standalone/player/player.ts') diff --git a/client/src/standalone/player/player.ts b/client/src/standalone/player/player.ts index 71c412950..119f5e035 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 -- cgit v1.2.3