diff options
Diffstat (limited to 'client/src/assets')
-rw-r--r-- | client/src/assets/player/peertube-player-manager.ts | 6 | ||||
-rw-r--r-- | client/src/assets/player/videojs-components/settings-menu-item.ts | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts index 083c621d2..6c8b13087 100644 --- a/client/src/assets/player/peertube-player-manager.ts +++ b/client/src/assets/player/peertube-player-manager.ts | |||
@@ -86,6 +86,7 @@ export class PeertubePlayerManager { | |||
86 | 86 | ||
87 | private static videojsLocaleCache: { [ path: string ]: any } = {} | 87 | private static videojsLocaleCache: { [ path: string ]: any } = {} |
88 | private static playerElementClassName: string | 88 | private static playerElementClassName: string |
89 | private static onPlayerChange: (player: any) => void | ||
89 | 90 | ||
90 | static getServerTranslations (serverUrl: string, locale: string) { | 91 | static getServerTranslations (serverUrl: string, locale: string) { |
91 | const path = PeertubePlayerManager.getLocalePath(serverUrl, locale) | 92 | const path = PeertubePlayerManager.getLocalePath(serverUrl, locale) |
@@ -100,9 +101,10 @@ export class PeertubePlayerManager { | |||
100 | }) | 101 | }) |
101 | } | 102 | } |
102 | 103 | ||
103 | static async initialize (mode: PlayerMode, options: PeertubePlayerManagerOptions) { | 104 | static async initialize (mode: PlayerMode, options: PeertubePlayerManagerOptions, onPlayerChange: (player: any) => void) { |
104 | let p2pMediaLoader: any | 105 | let p2pMediaLoader: any |
105 | 106 | ||
107 | this.onPlayerChange = onPlayerChange | ||
106 | this.playerElementClassName = options.common.playerElement.className | 108 | this.playerElementClassName = options.common.playerElement.className |
107 | 109 | ||
108 | if (mode === 'webtorrent') await import('./webtorrent/webtorrent-plugin') | 110 | if (mode === 'webtorrent') await import('./webtorrent/webtorrent-plugin') |
@@ -171,6 +173,8 @@ export class PeertubePlayerManager { | |||
171 | const player = this | 173 | const player = this |
172 | 174 | ||
173 | self.addContextMenu(mode, player, options.common.embedUrl) | 175 | self.addContextMenu(mode, player, options.common.embedUrl) |
176 | |||
177 | PeertubePlayerManager.onPlayerChange(player) | ||
174 | }) | 178 | }) |
175 | } | 179 | } |
176 | 180 | ||
diff --git a/client/src/assets/player/videojs-components/settings-menu-item.ts b/client/src/assets/player/videojs-components/settings-menu-item.ts index 78879a2ec..24b7e0c70 100644 --- a/client/src/assets/player/videojs-components/settings-menu-item.ts +++ b/client/src/assets/player/videojs-components/settings-menu-item.ts | |||
@@ -43,6 +43,9 @@ class SettingsMenuItem extends MenuItem { | |||
43 | player.ready(() => { | 43 | player.ready(() => { |
44 | // Voodoo magic for IOS | 44 | // Voodoo magic for IOS |
45 | setTimeout(() => { | 45 | setTimeout(() => { |
46 | // Player was destroyed | ||
47 | if (!this.player_) return | ||
48 | |||
46 | this.build() | 49 | this.build() |
47 | 50 | ||
48 | // Update on rate change | 51 | // Update on rate change |