diff options
Diffstat (limited to 'client/src/assets')
-rw-r--r-- | client/src/assets/player/peertube-player.ts | 8 | ||||
-rw-r--r-- | client/src/assets/player/peertube-videojs-plugin.ts | 5 | ||||
-rw-r--r-- | client/src/assets/player/settings-menu-item.ts | 13 |
3 files changed, 26 insertions, 0 deletions
diff --git a/client/src/assets/player/peertube-player.ts b/client/src/assets/player/peertube-player.ts index e0e063838..2de6d7fef 100644 --- a/client/src/assets/player/peertube-player.ts +++ b/client/src/assets/player/peertube-player.ts | |||
@@ -254,6 +254,10 @@ function loadLocaleInVideoJS (serverUrl: string, videojs: any, locale: string) { | |||
254 | loadLocaleInVideoJS.cache[path] = json | 254 | loadLocaleInVideoJS.cache[path] = json |
255 | return json | 255 | return json |
256 | }) | 256 | }) |
257 | .catch(err => { | ||
258 | console.error('Cannot get player translations', err) | ||
259 | return undefined | ||
260 | }) | ||
257 | } | 261 | } |
258 | 262 | ||
259 | const completeLocale = getCompleteLocale(locale) | 263 | const completeLocale = getCompleteLocale(locale) |
@@ -270,6 +274,10 @@ function getServerTranslations (serverUrl: string, locale: string) { | |||
270 | 274 | ||
271 | return fetch(path + '/server.json') | 275 | return fetch(path + '/server.json') |
272 | .then(res => res.json()) | 276 | .then(res => res.json()) |
277 | .catch(err => { | ||
278 | console.error('Cannot get server translations', err) | ||
279 | return undefined | ||
280 | }) | ||
273 | } | 281 | } |
274 | 282 | ||
275 | // ############################################################################ | 283 | // ############################################################################ |
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts index 4a280b7ef..e9fb90c61 100644 --- a/client/src/assets/player/peertube-videojs-plugin.ts +++ b/client/src/assets/player/peertube-videojs-plugin.ts | |||
@@ -620,6 +620,9 @@ class PeerTubePlugin extends Plugin { | |||
620 | this.player.src = this.savePlayerSrcFunction | 620 | this.player.src = this.savePlayerSrcFunction |
621 | this.player.src(httpUrl) | 621 | this.player.src(httpUrl) |
622 | 622 | ||
623 | // We changed the source, so reinit captions | ||
624 | this.initCaptions() | ||
625 | |||
623 | return this.tryToPlay(err => { | 626 | return this.tryToPlay(err => { |
624 | if (err && done) return done(err) | 627 | if (err && done) return done(err) |
625 | 628 | ||
@@ -720,6 +723,8 @@ class PeerTubePlugin extends Plugin { | |||
720 | default: this.defaultSubtitle === caption.language | 723 | default: this.defaultSubtitle === caption.language |
721 | }, false) | 724 | }, false) |
722 | } | 725 | } |
726 | |||
727 | this.player.trigger('captionsChanged') | ||
723 | } | 728 | } |
724 | 729 | ||
725 | // Thanks: https://github.com/videojs/video.js/issues/4460#issuecomment-312861657 | 730 | // Thanks: https://github.com/videojs/video.js/issues/4460#issuecomment-312861657 |
diff --git a/client/src/assets/player/settings-menu-item.ts b/client/src/assets/player/settings-menu-item.ts index 698f4627a..2a3460ae5 100644 --- a/client/src/assets/player/settings-menu-item.ts +++ b/client/src/assets/player/settings-menu-item.ts | |||
@@ -48,6 +48,19 @@ class SettingsMenuItem extends MenuItem { | |||
48 | // Update on rate change | 48 | // Update on rate change |
49 | player.on('ratechange', this.submenuClickHandler) | 49 | player.on('ratechange', this.submenuClickHandler) |
50 | 50 | ||
51 | if (subMenuName === 'CaptionsButton') { | ||
52 | // Hack to regenerate captions on HTTP fallback | ||
53 | player.on('captionsChanged', () => { | ||
54 | setTimeout(() => { | ||
55 | this.settingsSubMenuEl_.innerHTML = '' | ||
56 | this.settingsSubMenuEl_.appendChild(this.subMenu.menu.el_) | ||
57 | this.update() | ||
58 | this.bindClickEvents() | ||
59 | |||
60 | }, 0) | ||
61 | }) | ||
62 | } | ||
63 | |||
51 | this.reset() | 64 | this.reset() |
52 | }, 0) | 65 | }, 0) |
53 | }) | 66 | }) |