Fix autoplay on non authenticated users

pull/161/head
Chocobozzz 2017-12-19 14:01:34 +01:00
parent f9fcb010b0
commit d4c6a3b985
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 10 additions and 2 deletions

View File

@ -290,12 +290,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
const videojsOptions = {
controls: true,
autoplay: this.user.autoPlayVideo,
autoplay: this.isAutoplay(),
plugins: {
peertube: {
videoFiles: this.video.files,
playerElement: this.playerElement,
autoplay: this.user.autoPlayVideo,
autoplay: this.isAutoplay(),
peerTubeLink: false
}
}
@ -373,4 +373,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
}, viewTimeoutSeconds * 1000)
}
private isAutoplay () {
// True by default
if (!this.user) return true
// Be sure the autoPlay is set to false
return this.user.autoPlayVideo !== false
}
}