From d1bd87e066633b8a66266b280327ec828980916b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 22 May 2018 16:02:29 +0200 Subject: Make it works with new autoplay policy --- client/src/assets/player/peertube-videojs-plugin.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'client/src/assets/player/peertube-videojs-plugin.ts') diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts index 5789641fe..1e68100d1 100644 --- a/client/src/assets/player/peertube-videojs-plugin.ts +++ b/client/src/assets/player/peertube-videojs-plugin.ts @@ -4,7 +4,15 @@ import { VideoFile } from '../../../../shared/models/videos/video.model' import { renderVideo } from './video-renderer' import './settings-menu-button' import { PeertubePluginOptions, VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' -import { getAverageBandwidth, getStoredMute, getStoredVolume, saveAverageBandwidth, saveMuteInStore, saveVolumeInStore } from './utils' +import { + getAverageBandwidth, + getStoredMute, + getStoredVolume, + isMobile, + saveAverageBandwidth, + saveMuteInStore, + saveVolumeInStore +} from './utils' import minBy from 'lodash-es/minBy' import maxBy from 'lodash-es/maxBy' import * as CacheChunkStore from 'cache-chunk-store' @@ -262,7 +270,6 @@ class PeerTubePlugin extends Plugin { private tryToPlay (done?: Function) { if (!done) done = function () { /* empty */ } - const playPromise = this.player.play() if (playPromise !== undefined) { return playPromise.then(done) @@ -348,6 +355,9 @@ class PeerTubePlugin extends Plugin { // Proxy first play const oldPlay = this.player.play.bind(this.player) this.player.play = () => { + // Avoid issue new play policy on mobiles + if (isMobile()) oldPlay() + this.player.addClass('vjs-has-big-play-button-clicked') this.player.play = oldPlay -- cgit v1.2.3