aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/standalone/player
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-05-06 11:54:33 +0200
committerChocobozzz <me@florianbigard.com>2020-05-06 11:54:33 +0200
commit1151f5210c0e7665ec6714e73261f299e6fe757b (patch)
tree4d43e548a7d9ce7e7c4ecf6a257e9c8e395c3f95 /client/src/standalone/player
parentfc8aabd0bf38441c0591f21b9b435b52e99ffc23 (diff)
downloadPeerTube-1151f5210c0e7665ec6714e73261f299e6fe757b.tar.gz
PeerTube-1151f5210c0e7665ec6714e73261f299e6fe757b.tar.zst
PeerTube-1151f5210c0e7665ec6714e73261f299e6fe757b.zip
Add ability to update embed captions
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 */