diff options
Diffstat (limited to 'client/src/assets/player/shared/web-video/web-video-plugin.ts')
-rw-r--r-- | client/src/assets/player/shared/web-video/web-video-plugin.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/client/src/assets/player/shared/web-video/web-video-plugin.ts b/client/src/assets/player/shared/web-video/web-video-plugin.ts index 18d911108..8f4db0680 100644 --- a/client/src/assets/player/shared/web-video/web-video-plugin.ts +++ b/client/src/assets/player/shared/web-video/web-video-plugin.ts | |||
@@ -19,6 +19,7 @@ class WebVideoPlugin extends Plugin { | |||
19 | 19 | ||
20 | private onErrorHandler: () => void | 20 | private onErrorHandler: () => void |
21 | private onPlayHandler: () => void | 21 | private onPlayHandler: () => void |
22 | private onLoadedMetadata: () => void | ||
22 | 23 | ||
23 | constructor (player: videojs.Player, options?: WebVideoPluginOptions) { | 24 | constructor (player: videojs.Player, options?: WebVideoPluginOptions) { |
24 | super(player, options) | 25 | super(player, options) |
@@ -28,6 +29,12 @@ class WebVideoPlugin extends Plugin { | |||
28 | 29 | ||
29 | this.updateVideoFile({ videoFile: this.pickAverageVideoFile(), isUserResolutionChange: false }) | 30 | this.updateVideoFile({ videoFile: this.pickAverageVideoFile(), isUserResolutionChange: false }) |
30 | 31 | ||
32 | this.onLoadedMetadata = () => { | ||
33 | player.trigger('video-ratio-changed', { ratio: this.player.videoWidth() / this.player.videoHeight() }) | ||
34 | } | ||
35 | |||
36 | player.on('loadedmetadata', this.onLoadedMetadata) | ||
37 | |||
31 | player.ready(() => { | 38 | player.ready(() => { |
32 | this.buildQualities() | 39 | this.buildQualities() |
33 | 40 | ||
@@ -43,6 +50,7 @@ class WebVideoPlugin extends Plugin { | |||
43 | dispose () { | 50 | dispose () { |
44 | clearInterval(this.networkInfoInterval) | 51 | clearInterval(this.networkInfoInterval) |
45 | 52 | ||
53 | if (this.onLoadedMetadata) this.player.off('loadedmetadata', this.onLoadedMetadata) | ||
46 | if (this.onErrorHandler) this.player.off('error', this.onErrorHandler) | 54 | if (this.onErrorHandler) this.player.off('error', this.onErrorHandler) |
47 | if (this.onPlayHandler) this.player.off('canplay', this.onPlayHandler) | 55 | if (this.onPlayHandler) this.player.off('canplay', this.onPlayHandler) |
48 | 56 | ||