diff options
author | Chocobozzz <me@florianbigard.com> | 2018-03-27 10:34:40 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-03-27 11:11:15 +0200 |
commit | da99ccf2681bcbc172a96cf30e7b733948767faa (patch) | |
tree | d22af5288fbc5a9898d2c286d37b11e7d7b1c349 /client/src/standalone | |
parent | 73c0809326670867642f8a36f68d8564e0e406b5 (diff) | |
download | PeerTube-da99ccf2681bcbc172a96cf30e7b733948767faa.tar.gz PeerTube-da99ccf2681bcbc172a96cf30e7b733948767faa.tar.zst PeerTube-da99ccf2681bcbc172a96cf30e7b733948767faa.zip |
Add autoplay parameter in embed
Diffstat (limited to 'client/src/standalone')
-rw-r--r-- | client/src/standalone/videos/embed.ts | 11 |
1 files changed, 10 insertions, 1 deletions
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) | |||
24 | const previewUrl = window.location.origin + videoInfo.previewPath | 24 | const previewUrl = window.location.origin + videoInfo.previewPath |
25 | videoElement.poster = previewUrl | 25 | videoElement.poster = previewUrl |
26 | 26 | ||
27 | let autoplay = false | ||
28 | |||
29 | try { | ||
30 | let params = new URL(window.location.toString()).searchParams | ||
31 | autoplay = params.has('autoplay') && (params.get('autoplay') === '1' || params.get('autoplay') === 'true') | ||
32 | } catch (err) { | ||
33 | console.error('Cannot get params from URL.', err) | ||
34 | } | ||
35 | |||
27 | const videojsOptions = { | 36 | const videojsOptions = { |
28 | controls: true, | 37 | controls: true, |
29 | autoplay: false, | 38 | autoplay, |
30 | inactivityTimeout: 500, | 39 | inactivityTimeout: 500, |
31 | plugins: { | 40 | plugins: { |
32 | peertube: { | 41 | peertube: { |