diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-06 12:26:58 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-02-06 12:26:58 +0100 |
commit | 73471b1a52f242e86364ffb077ea6cadb3b07ae2 (patch) | |
tree | 43dbb7748e281f8d80f15326f489cdea10ec857d /client/src/assets/player/peertube-player.ts | |
parent | c22419dd265c0c7185bf4197a1cb286eb3d8ebc0 (diff) | |
parent | f5305c04aae14467d6f957b713c5a902275cbb89 (diff) | |
download | PeerTube-73471b1a52f242e86364ffb077ea6cadb3b07ae2.tar.gz PeerTube-73471b1a52f242e86364ffb077ea6cadb3b07ae2.tar.zst PeerTube-73471b1a52f242e86364ffb077ea6cadb3b07ae2.zip |
Merge branch 'release/v1.2.0'
Diffstat (limited to 'client/src/assets/player/peertube-player.ts')
-rw-r--r-- | client/src/assets/player/peertube-player.ts | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/client/src/assets/player/peertube-player.ts b/client/src/assets/player/peertube-player.ts index aaa1170b6..2de6d7fef 100644 --- a/client/src/assets/player/peertube-player.ts +++ b/client/src/assets/player/peertube-player.ts | |||
@@ -26,23 +26,24 @@ videojsUntyped.getComponent('CaptionsButton').prototype.controlText_ = 'Subtitle | |||
26 | videojsUntyped.getComponent('CaptionsButton').prototype.label_ = ' ' | 26 | videojsUntyped.getComponent('CaptionsButton').prototype.label_ = ' ' |
27 | 27 | ||
28 | function getVideojsOptions (options: { | 28 | function getVideojsOptions (options: { |
29 | autoplay: boolean, | 29 | autoplay: boolean |
30 | playerElement: HTMLVideoElement, | 30 | playerElement: HTMLVideoElement |
31 | videoViewUrl: string, | 31 | videoViewUrl: string |
32 | videoDuration: number, | 32 | videoDuration: number |
33 | videoFiles: VideoFile[], | 33 | videoFiles: VideoFile[] |
34 | enableHotkeys: boolean, | 34 | enableHotkeys: boolean |
35 | inactivityTimeout: number, | 35 | inactivityTimeout: number |
36 | peertubeLink: boolean, | 36 | peertubeLink: boolean |
37 | poster: string, | 37 | poster: string |
38 | startTime: number | string | 38 | startTime: number | string |
39 | theaterMode: boolean, | 39 | theaterMode: boolean |
40 | videoCaptions: VideoJSCaption[], | 40 | videoCaptions: VideoJSCaption[] |
41 | 41 | ||
42 | language?: string, | 42 | language?: string |
43 | controls?: boolean, | 43 | controls?: boolean |
44 | muted?: boolean, | 44 | muted?: boolean |
45 | loop?: boolean | 45 | loop?: boolean |
46 | subtitle?: string | ||
46 | 47 | ||
47 | userWatching?: UserWatching | 48 | userWatching?: UserWatching |
48 | }) { | 49 | }) { |
@@ -50,8 +51,10 @@ function getVideojsOptions (options: { | |||
50 | // We don't use text track settings for now | 51 | // We don't use text track settings for now |
51 | textTrackSettings: false, | 52 | textTrackSettings: false, |
52 | controls: options.controls !== undefined ? options.controls : true, | 53 | controls: options.controls !== undefined ? options.controls : true, |
53 | muted: options.controls !== undefined ? options.muted : false, | ||
54 | loop: options.loop !== undefined ? options.loop : false, | 54 | loop: options.loop !== undefined ? options.loop : false, |
55 | |||
56 | muted: options.muted !== undefined ? options.muted : undefined, // Undefined so the player knows it has to check the local storage | ||
57 | |||
55 | poster: options.poster, | 58 | poster: options.poster, |
56 | autoplay: false, | 59 | autoplay: false, |
57 | inactivityTimeout: options.inactivityTimeout, | 60 | inactivityTimeout: options.inactivityTimeout, |
@@ -65,7 +68,8 @@ function getVideojsOptions (options: { | |||
65 | videoViewUrl: options.videoViewUrl, | 68 | videoViewUrl: options.videoViewUrl, |
66 | videoDuration: options.videoDuration, | 69 | videoDuration: options.videoDuration, |
67 | startTime: options.startTime, | 70 | startTime: options.startTime, |
68 | userWatching: options.userWatching | 71 | userWatching: options.userWatching, |
72 | subtitle: options.subtitle | ||
69 | } | 73 | } |
70 | }, | 74 | }, |
71 | controlBar: { | 75 | controlBar: { |
@@ -250,6 +254,10 @@ function loadLocaleInVideoJS (serverUrl: string, videojs: any, locale: string) { | |||
250 | loadLocaleInVideoJS.cache[path] = json | 254 | loadLocaleInVideoJS.cache[path] = json |
251 | return json | 255 | return json |
252 | }) | 256 | }) |
257 | .catch(err => { | ||
258 | console.error('Cannot get player translations', err) | ||
259 | return undefined | ||
260 | }) | ||
253 | } | 261 | } |
254 | 262 | ||
255 | const completeLocale = getCompleteLocale(locale) | 263 | const completeLocale = getCompleteLocale(locale) |
@@ -266,6 +274,10 @@ function getServerTranslations (serverUrl: string, locale: string) { | |||
266 | 274 | ||
267 | return fetch(path + '/server.json') | 275 | return fetch(path + '/server.json') |
268 | .then(res => res.json()) | 276 | .then(res => res.json()) |
277 | .catch(err => { | ||
278 | console.error('Cannot get server translations', err) | ||
279 | return undefined | ||
280 | }) | ||
269 | } | 281 | } |
270 | 282 | ||
271 | // ############################################################################ | 283 | // ############################################################################ |