Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix video playlist resuming

Chocobozzz3c6a44a18175
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 fb89bf6cd0..4df2c6c5ee 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/+videos/+video-watch/video-watch.component.ts
@@ -362,6 +362,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
const queryParams = this.route.snapshot.queryParams
const urlOptions = {
+ resume: queryParams.resume,
+
startTime: queryParams.start,
stopTime: queryParams.stop,
@@ -657,16 +659,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
const byUrl = urlOptions.startTime !== undefined
const byHistory = video.userHistory && (!this.playlist || urlOptions.resume !== undefined)
- if (byUrl) {
- return timeToInt(urlOptions.startTime)
- } else if (byHistory) {
- return video.userHistory.currentTime
- } else {
- return 0
- }
+ if (byUrl) return timeToInt(urlOptions.startTime)
+ if (byHistory) return video.userHistory.currentTime
+
+ return 0
}
let startTime = getStartTime()
+
// If we are at the end of the video, reset the timer
if (video.duration - startTime <= 1) startTime = 0
diff --git a/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts
index b6a3408c7a..681e5becd0 100644
--- a/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts
+++ b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts
@@ -4,11 +4,17 @@ import { debounceTime, filter } from 'rxjs/operators'
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'
import { AuthService, DisableForReuseHook, Notifier } from '@app/core'
import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
-import { Video, VideoExistInPlaylist, VideoPlaylistCreate, VideoPlaylistElementCreate, VideoPlaylistPrivacy, VideoPlaylistElementUpdate } from '@shared/models'
+import {
+ Video,
+ VideoExistInPlaylist,
+ VideoPlaylistCreate,
+ VideoPlaylistElementCreate,
+ VideoPlaylistElementUpdate,
+ VideoPlaylistPrivacy
+} from '@shared/models'
import { secondsToTime } from '../../../assets/player/utils'
import { VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR } from '../form-validators/video-playlist-validators'
import { CachedPlaylist, VideoPlaylistService } from './video-playlist.service'
-import { invoke, last } from 'lodash'
const logger = debug('peertube:playlists:VideoAddToPlaylistComponent')