From: Chocobozzz Date: Mon, 17 Dec 2018 13:22:36 +0000 (+0100) Subject: Add ability to set subtitle in URL in watch page X-Git-Tag: v1.2.0-rc.1~62 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=1b04f19c48616f8f93e45451bb992711627bbdfc;hp=3b019808ef529cacce7f40706441670309e231d1;p=github%2FChocobozzz%2FPeerTube.git Add ability to set subtitle in URL in watch page --- 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 { ) .subscribe(([ video, captionsResult ]) => { const startTime = this.route.snapshot.queryParams.start - this.onVideoFetched(video, captionsResult.data, startTime) + const subtitle = this.route.snapshot.queryParams.subtitle + + this.onVideoFetched(video, captionsResult.data, { startTime, subtitle }) .catch(err => this.handleError(err)) }) }) @@ -371,7 +373,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { ) } - private async onVideoFetched (video: VideoDetails, videoCaptions: VideoCaption[], startTimeFromUrl: number) { + private async onVideoFetched (video: VideoDetails, videoCaptions: VideoCaption[], urlOptions: { startTime: number, subtitle: string }) { this.video = video // Re init attributes @@ -379,7 +381,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.completeDescriptionShown = false this.remoteServerDown = false - let startTime = startTimeFromUrl || (this.video.userHistory ? this.video.userHistory.currentTime : 0) + let startTime = urlOptions.startTime || (this.video.userHistory ? this.video.userHistory.currentTime : 0) // Don't start the video if we are at the end if (this.video.duration - startTime <= 1) startTime = 0 @@ -419,6 +421,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { peertubeLink: false, poster: this.video.previewUrl, startTime, + subtitle: urlOptions.subtitle, theaterMode: true, language: this.localeId,