Add autoplay parameter in embed

pull/487/head
Chocobozzz 2018-03-27 10:34:40 +02:00
parent 73c0809326
commit da99ccf268
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 10 additions and 1 deletions

View File

@ -24,9 +24,18 @@ loadVideoInfo(videoId)
const previewUrl = window.location.origin + videoInfo.previewPath const previewUrl = window.location.origin + videoInfo.previewPath
videoElement.poster = previewUrl 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 = { const videojsOptions = {
controls: true, controls: true,
autoplay: false, autoplay,
inactivityTimeout: 500, inactivityTimeout: 500,
plugins: { plugins: {
peertube: { peertube: {