]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/+video-watch/video-watch.component.ts
Add ability to set a start time
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / +video-watch / video-watch.component.ts
index b595ddcb79ebe9ae1331c040cc1e278fe86a8741..df5b8d02d6f18c8a3c01fdd8fabe4abd0942985d 100644 (file)
@@ -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