aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-12-17 14:22:36 +0100
committerChocobozzz <me@florianbigard.com>2018-12-17 14:22:59 +0100
commit1b04f19c48616f8f93e45451bb992711627bbdfc (patch)
tree5edde5c4ddefa18e206941d925b43befd946cda1 /client
parent3b019808ef529cacce7f40706441670309e231d1 (diff)
downloadPeerTube-1b04f19c48616f8f93e45451bb992711627bbdfc.tar.gz
PeerTube-1b04f19c48616f8f93e45451bb992711627bbdfc.tar.zst
PeerTube-1b04f19c48616f8f93e45451bb992711627bbdfc.zip
Add ability to set subtitle in URL in watch page
Diffstat (limited to 'client')
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts9
1 files changed, 6 insertions, 3 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 09ee96bdc..afbe1fe78 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -118,7 +118,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
118 ) 118 )
119 .subscribe(([ video, captionsResult ]) => { 119 .subscribe(([ video, captionsResult ]) => {
120 const startTime = this.route.snapshot.queryParams.start 120 const startTime = this.route.snapshot.queryParams.start
121 this.onVideoFetched(video, captionsResult.data, startTime) 121 const subtitle = this.route.snapshot.queryParams.subtitle
122
123 this.onVideoFetched(video, captionsResult.data, { startTime, subtitle })
122 .catch(err => this.handleError(err)) 124 .catch(err => this.handleError(err))
123 }) 125 })
124 }) 126 })
@@ -371,7 +373,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
371 ) 373 )
372 } 374 }
373 375
374 private async onVideoFetched (video: VideoDetails, videoCaptions: VideoCaption[], startTimeFromUrl: number) { 376 private async onVideoFetched (video: VideoDetails, videoCaptions: VideoCaption[], urlOptions: { startTime: number, subtitle: string }) {
375 this.video = video 377 this.video = video
376 378
377 // Re init attributes 379 // Re init attributes
@@ -379,7 +381,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
379 this.completeDescriptionShown = false 381 this.completeDescriptionShown = false
380 this.remoteServerDown = false 382 this.remoteServerDown = false
381 383
382 let startTime = startTimeFromUrl || (this.video.userHistory ? this.video.userHistory.currentTime : 0) 384 let startTime = urlOptions.startTime || (this.video.userHistory ? this.video.userHistory.currentTime : 0)
383 // Don't start the video if we are at the end 385 // Don't start the video if we are at the end
384 if (this.video.duration - startTime <= 1) startTime = 0 386 if (this.video.duration - startTime <= 1) startTime = 0
385 387
@@ -419,6 +421,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
419 peertubeLink: false, 421 peertubeLink: false,
420 poster: this.video.previewUrl, 422 poster: this.video.previewUrl,
421 startTime, 423 startTime,
424 subtitle: urlOptions.subtitle,
422 theaterMode: true, 425 theaterMode: true,
423 language: this.localeId, 426 language: this.localeId,
424 427