aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/videos')
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts47
1 files changed, 28 insertions, 19 deletions
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts
index d4e3ec014..bec6932ae 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -69,6 +69,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
69 ) 69 )
70 70
71 this.paramsSub = this.route.params.subscribe(routeParams => { 71 this.paramsSub = this.route.params.subscribe(routeParams => {
72 if (this.videoPlayerLoaded) {
73 this.player.pause()
74 }
75
72 let uuid = routeParams['uuid'] 76 let uuid = routeParams['uuid']
73 this.videoService.getVideo(uuid).subscribe( 77 this.videoService.getVideo(uuid).subscribe(
74 video => this.onVideoFetched(video), 78 video => this.onVideoFetched(video),
@@ -276,30 +280,35 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
276 return this.router.navigate([ '/videos/list' ]) 280 return this.router.navigate([ '/videos/list' ])
277 } 281 }
278 282
279 this.playerElement = this.elementRef.nativeElement.querySelector('#video-element') 283 // Player was already loaded
280 284 if (this.videoPlayerLoaded !== true) {
281 const videojsOptions = { 285 this.playerElement = this.elementRef.nativeElement.querySelector('#video-element')
282 controls: true, 286
283 autoplay: true, 287 const videojsOptions = {
284 plugins: { 288 controls: true,
285 peertube: { 289 autoplay: true,
286 videoFiles: this.video.files, 290 plugins: {
287 playerElement: this.playerElement, 291 peertube: {
288 autoplay: true, 292 videoFiles: this.video.files,
289 peerTubeLink: false 293 playerElement: this.playerElement,
294 autoplay: true,
295 peerTubeLink: false
296 }
290 } 297 }
291 } 298 }
292 }
293 299
294 this.videoPlayerLoaded = true 300 this.videoPlayerLoaded = true
295 301
296 const self = this 302 const self = this
297 videojs(this.playerElement, videojsOptions, function () { 303 videojs(this.playerElement, videojsOptions, function () {
298 self.player = this 304 self.player = this
299 this.on('customError', (event, data) => { 305 this.on('customError', (event, data) => {
300 self.handleError(data.err) 306 self.handleError(data.err)
307 })
301 }) 308 })
302 }) 309 } else {
310 (this.player as any).setVideoFiles(this.video.files)
311 }
303 312
304 this.setVideoDescriptionHTML() 313 this.setVideoDescriptionHTML()
305 314