From e6f627975bebd00d396d11442e582d80856bc6bd Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 17 Apr 2018 09:54:53 +0200 Subject: [PATCH] Hide big play button on autoplay --- client/src/assets/player/peertube-videojs-plugin.ts | 8 ++++---- client/src/sass/video-js-custom.scss | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts index 83df24af6..60c291a50 100644 --- a/client/src/assets/player/peertube-videojs-plugin.ts +++ b/client/src/assets/player/peertube-videojs-plugin.ts @@ -85,6 +85,8 @@ class PeerTubePlugin extends Plugin { this.playerElement = options.playerElement + if (this.autoplay === true) this.player.addClass('vjs-has-autoplay') + this.player.ready(() => { const volume = getStoredVolume() if (volume !== undefined) this.player.volume(volume) @@ -314,10 +316,8 @@ class PeerTubePlugin extends Plugin { if (this.autoplay === true) { this.player.posterImage.hide() - this.updateVideoFile(undefined, 0, () => { - this.seek(this.startTime) - this.player.play() - }) + + this.updateVideoFile(undefined, 0, () => this.seek(this.startTime)) } else { // Proxy first play const oldPlay = this.player.play.bind(this.player) diff --git a/client/src/sass/video-js-custom.scss b/client/src/sass/video-js-custom.scss index cae7ab431..f77447e97 100644 --- a/client/src/sass/video-js-custom.scss +++ b/client/src/sass/video-js-custom.scss @@ -115,6 +115,13 @@ $setting-transition-easing: ease-out; } } + // Hide the big play button on autoplay + &.vjs-has-autoplay { + .vjs-big-play-button { + display: none !important; + } + } + .vjs-control-bar, .vjs-big-play-button, .vjs-settings-dialog {