aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-18 16:04:03 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-08-19 11:30:21 +0200
commit3c6a44a18175b85d2a3e0b7c3e975718833e5345 (patch)
tree3f9f11d9aa25bafc1b57b5d4d58656efa18701ae /client/src/app
parente79df4eefbeba3e7ab74e17cae1369c80c94b848 (diff)
downloadPeerTube-3c6a44a18175b85d2a3e0b7c3e975718833e5345.tar.gz
PeerTube-3c6a44a18175b85d2a3e0b7c3e975718833e5345.tar.zst
PeerTube-3c6a44a18175b85d2a3e0b7c3e975718833e5345.zip
Fix video playlist resuming
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.ts14
-rw-r--r--client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts10
2 files changed, 15 insertions, 9 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 fb89bf6cd..4df2c6c5e 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 {
362 const queryParams = this.route.snapshot.queryParams 362 const queryParams = this.route.snapshot.queryParams
363 363
364 const urlOptions = { 364 const urlOptions = {
365 resume: queryParams.resume,
366
365 startTime: queryParams.start, 367 startTime: queryParams.start,
366 stopTime: queryParams.stop, 368 stopTime: queryParams.stop,
367 369
@@ -657,16 +659,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
657 const byUrl = urlOptions.startTime !== undefined 659 const byUrl = urlOptions.startTime !== undefined
658 const byHistory = video.userHistory && (!this.playlist || urlOptions.resume !== undefined) 660 const byHistory = video.userHistory && (!this.playlist || urlOptions.resume !== undefined)
659 661
660 if (byUrl) { 662 if (byUrl) return timeToInt(urlOptions.startTime)
661 return timeToInt(urlOptions.startTime) 663 if (byHistory) return video.userHistory.currentTime
662 } else if (byHistory) { 664
663 return video.userHistory.currentTime 665 return 0
664 } else {
665 return 0
666 }
667 } 666 }
668 667
669 let startTime = getStartTime() 668 let startTime = getStartTime()
669
670 // If we are at the end of the video, reset the timer 670 // If we are at the end of the video, reset the timer
671 if (video.duration - startTime <= 1) startTime = 0 671 if (video.duration - startTime <= 1) startTime = 0
672 672
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 b6a3408c7..681e5becd 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'
4import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core' 4import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'
5import { AuthService, DisableForReuseHook, Notifier } from '@app/core' 5import { AuthService, DisableForReuseHook, Notifier } from '@app/core'
6import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 6import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
7import { Video, VideoExistInPlaylist, VideoPlaylistCreate, VideoPlaylistElementCreate, VideoPlaylistPrivacy, VideoPlaylistElementUpdate } from '@shared/models' 7import {
8 Video,
9 VideoExistInPlaylist,
10 VideoPlaylistCreate,
11 VideoPlaylistElementCreate,
12 VideoPlaylistElementUpdate,
13 VideoPlaylistPrivacy
14} from '@shared/models'
8import { secondsToTime } from '../../../assets/player/utils' 15import { secondsToTime } from '../../../assets/player/utils'
9import { VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR } from '../form-validators/video-playlist-validators' 16import { VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR } from '../form-validators/video-playlist-validators'
10import { CachedPlaylist, VideoPlaylistService } from './video-playlist.service' 17import { CachedPlaylist, VideoPlaylistService } from './video-playlist.service'
11import { invoke, last } from 'lodash'
12 18
13const logger = debug('peertube:playlists:VideoAddToPlaylistComponent') 19const logger = debug('peertube:playlists:VideoAddToPlaylistComponent')
14 20