diff options
author | Chocobozzz <me@florianbigard.com> | 2018-10-05 11:15:06 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-10-05 11:22:38 +0200 |
commit | 6e46de095d7169355dd83030f6ce4a582304153a (patch) | |
tree | dfa78e2008d3d135a00b798b05350b4975145acc /client/src/app/videos/+video-watch | |
parent | a585824160d016db7c9bff0e1cb1ffa3aaf73d74 (diff) | |
download | PeerTube-6e46de095d7169355dd83030f6ce4a582304153a.tar.gz PeerTube-6e46de095d7169355dd83030f6ce4a582304153a.tar.zst PeerTube-6e46de095d7169355dd83030f6ce4a582304153a.zip |
Add user history and resume videos
Diffstat (limited to 'client/src/app/videos/+video-watch')
-rw-r--r-- | client/src/app/videos/+video-watch/video-watch.component.ts | 13 |
1 files changed, 11 insertions, 2 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 ea10b22ad..c5deddf05 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -369,7 +369,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
369 | ) | 369 | ) |
370 | } | 370 | } |
371 | 371 | ||
372 | private async onVideoFetched (video: VideoDetails, videoCaptions: VideoCaption[], startTime = 0) { | 372 | private async onVideoFetched (video: VideoDetails, videoCaptions: VideoCaption[], startTimeFromUrl: number) { |
373 | this.video = video | 373 | this.video = video |
374 | 374 | ||
375 | // Re init attributes | 375 | // Re init attributes |
@@ -377,6 +377,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
377 | this.completeDescriptionShown = false | 377 | this.completeDescriptionShown = false |
378 | this.remoteServerDown = false | 378 | this.remoteServerDown = false |
379 | 379 | ||
380 | let startTime = startTimeFromUrl || (this.video.userHistory ? this.video.userHistory.currentTime : 0) | ||
381 | // Don't start the video if we are at the end | ||
382 | if (this.video.duration - startTime <= 1) startTime = 0 | ||
383 | |||
380 | if (this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())) { | 384 | if (this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())) { |
381 | const res = await this.confirmService.confirm( | 385 | const res = await this.confirmService.confirm( |
382 | this.i18n('This video contains mature or explicit content. Are you sure you want to watch it?'), | 386 | this.i18n('This video contains mature or explicit content. Are you sure you want to watch it?'), |
@@ -414,7 +418,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
414 | poster: this.video.previewUrl, | 418 | poster: this.video.previewUrl, |
415 | startTime, | 419 | startTime, |
416 | theaterMode: true, | 420 | theaterMode: true, |
417 | language: this.localeId | 421 | language: this.localeId, |
422 | |||
423 | userWatching: this.user ? { | ||
424 | url: this.videoService.getUserWatchingVideoUrl(this.video.uuid), | ||
425 | authorizationHeader: this.authService.getRequestHeaderValue() | ||
426 | } : undefined | ||
418 | }) | 427 | }) |
419 | 428 | ||
420 | if (this.videojsLocaleLoaded === false) { | 429 | if (this.videojsLocaleLoaded === false) { |