- // Player was already loaded
- if (this.videoPlayerLoaded !== true) {
- this.playerElement = this.elementRef.nativeElement.querySelector('#video-element')
-
- // If autoplay is true, we don't really need a poster
- if (this.isAutoplay() === false) {
- this.playerElement.poster = this.video.previewUrl
- }
-
- const videojsOptions = {
- controls: true,
- autoplay: this.isAutoplay(),
- plugins: {
- peertube: {
- videoFiles: this.video.files,
- playerElement: this.playerElement,
- peerTubeLink: false,
- videoViewUrl: this.videoService.getVideoViewUrl(this.video.uuid),
- videoDuration: this.video.duration
- },
- hotkeys: {
- enableVolumeScroll: false
- }
- }
- }
-
- this.videoPlayerLoaded = true
-
- const self = this
- this.zone.runOutsideAngular(() => {
- videojs(this.playerElement, videojsOptions, function () {
- self.player = this
- this.on('customError', (event, data) => {
- self.handleError(data.err)
- })
- })
- })
- } else {
- const videoViewUrl = this.videoService.getVideoViewUrl(this.video.uuid)
- this.player.peertube().setVideoFiles(this.video.files, videoViewUrl, this.video.duration)
- }
+ const self = this
+ this.zone.runOutsideAngular(() => {
+ videojs(this.playerElement, videojsOptions, function () {
+ self.player = this
+ this.on('customError', (event, data) => self.handleError(data.err))
+ })
+ })