import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
import { ServerConfig, ServerErrorCode, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '@shared/models'
-import { getStoredP2PEnabled, getStoredTheater } from '../../../assets/player/peertube-player-local-storage'
+import { cleanupVideoWatch, getStoredP2PEnabled, getStoredTheater, getStoredVideoWatchHistory } from '../../../assets/player/peertube-player-local-storage'
import {
CustomizationOptions,
P2PMediaLoaderOptions,
this.theaterEnabled = getStoredTheater()
this.hooks.runAction('action:video-watch.init', 'video-watch')
+
+ setTimeout(cleanupVideoWatch, 1500) // Run in timeout to ensure we're not blocking the UI
}
ngOnDestroy () {
const getStartTime = () => {
const byUrl = urlOptions.startTime !== undefined
const byHistory = video.userHistory && (!this.playlist || urlOptions.resume !== undefined)
+ const byLocalStorage = getStoredVideoWatchHistory(video.uuid)
if (byUrl) return timeToInt(urlOptions.startTime)
if (byHistory) return video.userHistory.currentTime
+ if (byLocalStorage) return byLocalStorage.duration
return 0
}
serverUrl: environment.apiUrl,
- videoCaptions: playerCaptions
+ videoCaptions: playerCaptions,
+
+ videoUUID: video.uuid
},
webtorrent: {