aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/standalone/player
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/standalone/player')
-rw-r--r--client/src/standalone/player/definitions.ts7
-rw-r--r--client/src/standalone/player/player.ts17
2 files changed, 23 insertions, 1 deletions
diff --git a/client/src/standalone/player/definitions.ts b/client/src/standalone/player/definitions.ts
index 9fe903260..cc5203ed5 100644
--- a/client/src/standalone/player/definitions.ts
+++ b/client/src/standalone/player/definitions.ts
@@ -16,3 +16,10 @@ export interface PeerTubeResolution {
16 src?: string 16 src?: string
17 width?: number 17 width?: number
18} 18}
19
20export type PeerTubeTextTrack = {
21 id: string
22 label: string
23 src: string
24 mode: 'showing' | 'disabled'
25}
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 @@
1import * as Channel from 'jschannel' 1import * as Channel from 'jschannel'
2import { EventHandler, PeerTubeResolution, PeerTubeTextTrack, PlayerEventType } from './definitions'
2import { EventRegistrar } from './events' 3import { EventRegistrar } from './events'
3import { EventHandler, PlayerEventType, PeerTubeResolution } from './definitions'
4 4
5const PASSTHROUGH_EVENTS = [ 5const PASSTHROUGH_EVENTS = [
6 'pause', 6 'pause',
@@ -105,6 +105,21 @@ export class PeerTubePlayer {
105 } 105 }
106 106
107 /** 107 /**
108 * Tell the embed to change the current caption
109 * @param value Caption id
110 */
111 async setCaption (value: string) {
112 await this.sendMessage('setCaption', value)
113 }
114
115 /**
116 * Get video captions
117 */
118 async getCaptions (): Promise<PeerTubeTextTrack[]> {
119 return this.sendMessage<void, PeerTubeTextTrack[]>('getCaptions')
120 }
121
122 /**
108 * Tell the embed to seek to a specific position (in seconds) 123 * Tell the embed to seek to a specific position (in seconds)
109 * @param seconds 124 * @param seconds
110 */ 125 */