diff options
Diffstat (limited to 'client/src/app')
-rw-r--r-- | client/src/app/+videos/+video-watch/video-watch.component.ts | 19 |
1 files changed, 12 insertions, 7 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 84548de97..19ad97d42 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -91,6 +91,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
91 | 91 | ||
92 | private hotkeys: Hotkey[] = [] | 92 | private hotkeys: Hotkey[] = [] |
93 | 93 | ||
94 | private static VIEW_VIDEO_INTERVAL_MS = 5000 | ||
95 | |||
94 | constructor ( | 96 | constructor ( |
95 | private elementRef: ElementRef, | 97 | private elementRef: ElementRef, |
96 | private route: ActivatedRoute, | 98 | private route: ActivatedRoute, |
@@ -613,16 +615,18 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
613 | const byLocalStorage = getStoredVideoWatchHistory(video.uuid) | 615 | const byLocalStorage = getStoredVideoWatchHistory(video.uuid) |
614 | 616 | ||
615 | if (byUrl) return timeToInt(urlOptions.startTime) | 617 | if (byUrl) return timeToInt(urlOptions.startTime) |
616 | if (byHistory) return video.userHistory.currentTime | ||
617 | if (byLocalStorage) return byLocalStorage.duration | ||
618 | 618 | ||
619 | return 0 | 619 | let startTime = 0 |
620 | } | 620 | if (byHistory) startTime = video.userHistory.currentTime |
621 | if (byLocalStorage) startTime = byLocalStorage.duration | ||
621 | 622 | ||
622 | let startTime = getStartTime() | 623 | // If we are at the end of the video, reset the timer |
624 | if (video.duration - startTime <= 1) startTime = 0 | ||
625 | |||
626 | return startTime | ||
627 | } | ||
623 | 628 | ||
624 | // If we are at the end of the video, reset the timer | 629 | const startTime = getStartTime() |
625 | if (video.duration - startTime <= 1) startTime = 0 | ||
626 | 630 | ||
627 | const playerCaptions = videoCaptions.map(c => ({ | 631 | const playerCaptions = videoCaptions.map(c => ({ |
628 | label: c.language.label, | 632 | label: c.language.label, |
@@ -679,6 +683,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
679 | videoViewUrl: video.privacy.id !== VideoPrivacy.PRIVATE | 683 | videoViewUrl: video.privacy.id !== VideoPrivacy.PRIVATE |
680 | ? this.videoService.getVideoViewUrl(video.uuid) | 684 | ? this.videoService.getVideoViewUrl(video.uuid) |
681 | : null, | 685 | : null, |
686 | videoViewIntervalMs: VideoWatchComponent.VIEW_VIDEO_INTERVAL_MS, | ||
682 | authorizationHeader: () => this.authService.getRequestHeaderValue(), | 687 | authorizationHeader: () => this.authService.getRequestHeaderValue(), |
683 | 688 | ||
684 | serverUrl: environment.originServerUrl || window.location.origin, | 689 | serverUrl: environment.originServerUrl || window.location.origin, |