aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>2021-03-31 11:26:32 +0200
committerGitHub <noreply@github.com>2021-03-31 11:26:32 +0200
commit58b9ce3080c12678e8c1c28c08da09d6ea60011d (patch)
tree10e501ba791e67febd47b397729ba5debb81a85c /client/src/app
parentd794137057fc5fcea10ddd29f82e79ee2412fea4 (diff)
downloadPeerTube-58b9ce3080c12678e8c1c28c08da09d6ea60011d.tar.gz
PeerTube-58b9ce3080c12678e8c1c28c08da09d6ea60011d.tar.zst
PeerTube-58b9ce3080c12678e8c1c28c08da09d6ea60011d.zip
Resume videos for non-logged in users (#3885)
* client: resume videos for non-logged in users closes #3866 * fix build for embeded * Update client/src/app/app.component.ts * fix review comments
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.ts10
1 files changed, 8 insertions, 2 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 571d1e99a..075f70f56 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/+videos/+video-watch/video-watch.component.ts
@@ -29,7 +29,7 @@ import { MetaService } from '@ngx-meta/core'
29import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' 29import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
30import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' 30import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
31import { ServerConfig, ServerErrorCode, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '@shared/models' 31import { ServerConfig, ServerErrorCode, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '@shared/models'
32import { getStoredP2PEnabled, getStoredTheater } from '../../../assets/player/peertube-player-local-storage' 32import { cleanupVideoWatch, getStoredP2PEnabled, getStoredTheater, getStoredVideoWatchHistory } from '../../../assets/player/peertube-player-local-storage'
33import { 33import {
34 CustomizationOptions, 34 CustomizationOptions,
35 P2PMediaLoaderOptions, 35 P2PMediaLoaderOptions,
@@ -195,6 +195,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
195 this.theaterEnabled = getStoredTheater() 195 this.theaterEnabled = getStoredTheater()
196 196
197 this.hooks.runAction('action:video-watch.init', 'video-watch') 197 this.hooks.runAction('action:video-watch.init', 'video-watch')
198
199 setTimeout(cleanupVideoWatch, 1500) // Run in timeout to ensure we're not blocking the UI
198 } 200 }
199 201
200 ngOnDestroy () { 202 ngOnDestroy () {
@@ -768,9 +770,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
768 const getStartTime = () => { 770 const getStartTime = () => {
769 const byUrl = urlOptions.startTime !== undefined 771 const byUrl = urlOptions.startTime !== undefined
770 const byHistory = video.userHistory && (!this.playlist || urlOptions.resume !== undefined) 772 const byHistory = video.userHistory && (!this.playlist || urlOptions.resume !== undefined)
773 const byLocalStorage = getStoredVideoWatchHistory(video.uuid)
771 774
772 if (byUrl) return timeToInt(urlOptions.startTime) 775 if (byUrl) return timeToInt(urlOptions.startTime)
773 if (byHistory) return video.userHistory.currentTime 776 if (byHistory) return video.userHistory.currentTime
777 if (byLocalStorage) return byLocalStorage.duration
774 778
775 return 0 779 return 0
776 } 780 }
@@ -828,7 +832,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
828 832
829 serverUrl: environment.apiUrl, 833 serverUrl: environment.apiUrl,
830 834
831 videoCaptions: playerCaptions 835 videoCaptions: playerCaptions,
836
837 videoUUID: video.uuid
832 }, 838 },
833 839
834 webtorrent: { 840 webtorrent: {