diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-07 17:06:00 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-03-18 11:17:59 +0100 |
commit | f0a3988066f72a28bb44520af072f18d91d77dde (patch) | |
tree | dfa3a92102557b567530c5dd014c90866621140a /client/src/app/videos/+video-watch/video-watch.component.ts | |
parent | 830b4faff15fb9c81d88e8e69fcdf94aad32bef8 (diff) | |
download | PeerTube-f0a3988066f72a28bb44520af072f18d91d77dde.tar.gz PeerTube-f0a3988066f72a28bb44520af072f18d91d77dde.tar.zst PeerTube-f0a3988066f72a28bb44520af072f18d91d77dde.zip |
Add to playlist dropdown
Diffstat (limited to 'client/src/app/videos/+video-watch/video-watch.component.ts')
-rw-r--r-- | client/src/app/videos/+video-watch/video-watch.component.ts | 14 |
1 files changed, 11 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 0f04441ba..359217f3b 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -59,6 +59,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
59 | remoteServerDown = false | 59 | remoteServerDown = false |
60 | hotkeys: Hotkey[] | 60 | hotkeys: Hotkey[] |
61 | 61 | ||
62 | private currentTime: number | ||
62 | private paramsSub: Subscription | 63 | private paramsSub: Subscription |
63 | 64 | ||
64 | constructor ( | 65 | constructor ( |
@@ -114,10 +115,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
114 | ) | 115 | ) |
115 | .subscribe(([ video, captionsResult ]) => { | 116 | .subscribe(([ video, captionsResult ]) => { |
116 | const startTime = this.route.snapshot.queryParams.start | 117 | const startTime = this.route.snapshot.queryParams.start |
118 | const stopTime = this.route.snapshot.queryParams.stop | ||
117 | const subtitle = this.route.snapshot.queryParams.subtitle | 119 | const subtitle = this.route.snapshot.queryParams.subtitle |
118 | const playerMode = this.route.snapshot.queryParams.mode | 120 | const playerMode = this.route.snapshot.queryParams.mode |
119 | 121 | ||
120 | this.onVideoFetched(video, captionsResult.data, { startTime, subtitle, playerMode }) | 122 | this.onVideoFetched(video, captionsResult.data, { startTime, stopTime, subtitle, playerMode }) |
121 | .catch(err => this.handleError(err)) | 123 | .catch(err => this.handleError(err)) |
122 | }) | 124 | }) |
123 | }) | 125 | }) |
@@ -219,7 +221,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
219 | showShareModal () { | 221 | showShareModal () { |
220 | const currentTime = this.player ? this.player.currentTime() : undefined | 222 | const currentTime = this.player ? this.player.currentTime() : undefined |
221 | 223 | ||
222 | this.videoShareModal.show(currentTime) | 224 | this.videoShareModal.show(this.currentTime) |
223 | } | 225 | } |
224 | 226 | ||
225 | showDownloadModal (event: Event) { | 227 | showDownloadModal (event: Event) { |
@@ -371,7 +373,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
371 | private async onVideoFetched ( | 373 | private async onVideoFetched ( |
372 | video: VideoDetails, | 374 | video: VideoDetails, |
373 | videoCaptions: VideoCaption[], | 375 | videoCaptions: VideoCaption[], |
374 | urlOptions: { startTime?: number, subtitle?: string, playerMode?: string } | 376 | urlOptions: { startTime?: number, stopTime?: number, subtitle?: string, playerMode?: string } |
375 | ) { | 377 | ) { |
376 | this.video = video | 378 | this.video = video |
377 | 379 | ||
@@ -379,6 +381,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
379 | this.descriptionLoading = false | 381 | this.descriptionLoading = false |
380 | this.completeDescriptionShown = false | 382 | this.completeDescriptionShown = false |
381 | this.remoteServerDown = false | 383 | this.remoteServerDown = false |
384 | this.currentTime = undefined | ||
382 | 385 | ||
383 | let startTime = urlOptions.startTime || (this.video.userHistory ? this.video.userHistory.currentTime : 0) | 386 | let startTime = urlOptions.startTime || (this.video.userHistory ? this.video.userHistory.currentTime : 0) |
384 | // If we are at the end of the video, reset the timer | 387 | // If we are at the end of the video, reset the timer |
@@ -420,6 +423,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
420 | inactivityTimeout: 2500, | 423 | inactivityTimeout: 2500, |
421 | poster: this.video.previewUrl, | 424 | poster: this.video.previewUrl, |
422 | startTime, | 425 | startTime, |
426 | stopTime: urlOptions.stopTime, | ||
423 | 427 | ||
424 | theaterMode: true, | 428 | theaterMode: true, |
425 | captions: videoCaptions.length !== 0, | 429 | captions: videoCaptions.length !== 0, |
@@ -466,6 +470,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
466 | this.zone.runOutsideAngular(async () => { | 470 | this.zone.runOutsideAngular(async () => { |
467 | this.player = await PeertubePlayerManager.initialize(mode, options) | 471 | this.player = await PeertubePlayerManager.initialize(mode, options) |
468 | this.player.on('customError', ({ err }: { err: any }) => this.handleError(err)) | 472 | this.player.on('customError', ({ err }: { err: any }) => this.handleError(err)) |
473 | |||
474 | this.player.on('timeupdate', () => { | ||
475 | this.currentTime = Math.floor(this.player.currentTime()) | ||
476 | }) | ||
469 | }) | 477 | }) |
470 | 478 | ||
471 | this.setVideoDescriptionHTML() | 479 | this.setVideoDescriptionHTML() |