1
0
Fork 0

Fix video playlist resuming

This commit is contained in:
Chocobozzz 2020-08-18 16:04:03 +02:00 committed by Chocobozzz
parent e79df4eefb
commit 3c6a44a181
2 changed files with 15 additions and 9 deletions

View File

@ -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

View File

@ -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')