From f37bad639b36d35c29a464dc52123a1e7c9cd28a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 5 Apr 2018 17:06:59 +0200 Subject: Add ability to set a start time --- client/src/app/videos/+video-watch/video-watch.component.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'client/src/app') 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 b595ddcb7..df5b8d02d 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -102,7 +102,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy { if (this.video && this.video.uuid === uuid) return this.videoService.getVideo(uuid).subscribe( - video => this.onVideoFetched(video), + video => { + const startTime = this.route.snapshot.queryParams.start + this.onVideoFetched(video, startTime) + .catch(err => this.handleError(err)) + }, error => { this.videoNotFound = true @@ -315,7 +319,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { ) } - private async onVideoFetched (video: VideoDetails) { + private async onVideoFetched (video: VideoDetails, startTime = 0) { this.video = video // Re init attributes @@ -350,7 +354,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { videoDuration: this.video.duration, enableHotkeys: true, peertubeLink: false, - poster: this.video.previewUrl + poster: this.video.previewUrl, + startTime }) const self = this -- cgit v1.2.3