From 85414add64d2215a44866471913a8470638742e4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 19 Dec 2017 15:17:43 +0100 Subject: Fix player play exception on chromium --- client/src/assets/player/peertube-videojs-plugin.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'client/src/assets/player') diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts index d9dc2615b..8c131c9e9 100644 --- a/client/src/assets/player/peertube-videojs-plugin.ts +++ b/client/src/assets/player/peertube-videojs-plugin.ts @@ -235,9 +235,7 @@ const peertubePlugin = function (options: PeertubePluginOptions) { if (err) return handleError(err) this.renderer = renderer - player.play() - - return done() + player.play().then(done) }) }) @@ -323,10 +321,14 @@ const peertubePlugin = function (options: PeertubePluginOptions) { player.updateVideoFile() } else { player.one('play', () => { - // Pause, we wait the video to load before - player.pause() - - player.updateVideoFile(undefined, () => player.play()) + // On firefox, we need to wait to load the video before playing + if (navigator.userAgent.toLowerCase().indexOf('firefox') !== -1) { + player.pause() + player.updateVideoFile(undefined, () => player.play()) + return + } + + player.updateVideoFile(undefined) }) } -- cgit v1.2.3