Fix video playlist resuming
This commit is contained in:
parent
e79df4eefb
commit
3c6a44a181
|
@ -362,6 +362,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
const queryParams = this.route.snapshot.queryParams
|
const queryParams = this.route.snapshot.queryParams
|
||||||
|
|
||||||
const urlOptions = {
|
const urlOptions = {
|
||||||
|
resume: queryParams.resume,
|
||||||
|
|
||||||
startTime: queryParams.start,
|
startTime: queryParams.start,
|
||||||
stopTime: queryParams.stop,
|
stopTime: queryParams.stop,
|
||||||
|
|
||||||
|
@ -657,16 +659,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
const byUrl = urlOptions.startTime !== undefined
|
const byUrl = urlOptions.startTime !== undefined
|
||||||
const byHistory = video.userHistory && (!this.playlist || urlOptions.resume !== undefined)
|
const byHistory = video.userHistory && (!this.playlist || urlOptions.resume !== undefined)
|
||||||
|
|
||||||
if (byUrl) {
|
if (byUrl) return timeToInt(urlOptions.startTime)
|
||||||
return timeToInt(urlOptions.startTime)
|
if (byHistory) return video.userHistory.currentTime
|
||||||
} else if (byHistory) {
|
|
||||||
return video.userHistory.currentTime
|
return 0
|
||||||
} else {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let startTime = getStartTime()
|
let startTime = getStartTime()
|
||||||
|
|
||||||
// If we are at the end of the video, reset the timer
|
// If we are at the end of the video, reset the timer
|
||||||
if (video.duration - startTime <= 1) startTime = 0
|
if (video.duration - startTime <= 1) startTime = 0
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,17 @@ import { debounceTime, filter } from 'rxjs/operators'
|
||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'
|
||||||
import { AuthService, DisableForReuseHook, Notifier } from '@app/core'
|
import { AuthService, DisableForReuseHook, Notifier } from '@app/core'
|
||||||
import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
|
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 { secondsToTime } from '../../../assets/player/utils'
|
||||||
import { VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR } from '../form-validators/video-playlist-validators'
|
import { VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR } from '../form-validators/video-playlist-validators'
|
||||||
import { CachedPlaylist, VideoPlaylistService } from './video-playlist.service'
|
import { CachedPlaylist, VideoPlaylistService } from './video-playlist.service'
|
||||||
import { invoke, last } from 'lodash'
|
|
||||||
|
|
||||||
const logger = debug('peertube:playlists:VideoAddToPlaylistComponent')
|
const logger = debug('peertube:playlists:VideoAddToPlaylistComponent')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue