From 85414add64d2215a44866471913a8470638742e4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 19 Dec 2017 15:17:43 +0100 Subject: [PATCH] Fix player play exception on chromium --- .../src/assets/player/peertube-videojs-plugin.ts | 16 +++++++++------- .../custom-validators/activitypub/videos.ts | 2 -- server/lib/activitypub/process/process-follow.ts | 2 +- server/middlewares/activitypub.ts | 1 - 4 files changed, 10 insertions(+), 11 deletions(-) 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) }) } diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts index b485e5fcf..ae1339611 100644 --- a/server/helpers/custom-validators/activitypub/videos.ts +++ b/server/helpers/custom-validators/activitypub/videos.ts @@ -43,8 +43,6 @@ function isActivityPubVideoDurationValid (value: string) { } function isVideoTorrentObjectValid (video: any) { - console.log(video) - return video.type === 'Video' && isActivityPubUrlValid(video.id) && isVideoNameValid(video.name) && diff --git a/server/lib/activitypub/process/process-follow.ts b/server/lib/activitypub/process/process-follow.ts index bc02d5043..e78005dd0 100644 --- a/server/lib/activitypub/process/process-follow.ts +++ b/server/lib/activitypub/process/process-follow.ts @@ -62,5 +62,5 @@ async function follow (actor: ActorModel, targetActorURL: string) { return sendAccept(actorFollow, t) }) - logger.info('Actor %s is followed by actor %s.', actor.url, targetActorURL) + logger.info('Actor %s is followed by actor %s.', targetActorURL, actor.url) } diff --git a/server/middlewares/activitypub.ts b/server/middlewares/activitypub.ts index 9113e02a7..c00a6affa 100644 --- a/server/middlewares/activitypub.ts +++ b/server/middlewares/activitypub.ts @@ -34,7 +34,6 @@ async function checkSignature (req: Request, res: Response, next: NextFunction) function executeIfActivityPub (fun: RequestHandler | RequestHandler[]) { return (req: Request, res: Response, next: NextFunction) => { const accepted = req.accepts(ACCEPT_HEADERS) - console.log(accepted) if (accepted === false || ACTIVITY_PUB.POTENTIAL_ACCEPT_HEADERS.indexOf(accepted) === -1) { return next() } -- 2.41.0