From: Chocobozzz Date: Tue, 27 Mar 2018 08:34:40 +0000 (+0200) Subject: Add autoplay parameter in embed X-Git-Tag: v1.0.0-beta.2~19 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=da99ccf2681bcbc172a96cf30e7b733948767faa;p=oweals%2Fpeertube.git Add autoplay parameter in embed --- diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts index 964ec56f3..08f2955cf 100644 --- a/client/src/standalone/videos/embed.ts +++ b/client/src/standalone/videos/embed.ts @@ -24,9 +24,18 @@ loadVideoInfo(videoId) const previewUrl = window.location.origin + videoInfo.previewPath videoElement.poster = previewUrl + let autoplay = false + + try { + let params = new URL(window.location.toString()).searchParams + autoplay = params.has('autoplay') && (params.get('autoplay') === '1' || params.get('autoplay') === 'true') + } catch (err) { + console.error('Cannot get params from URL.', err) + } + const videojsOptions = { controls: true, - autoplay: false, + autoplay, inactivityTimeout: 500, plugins: { peertube: {