2022-05-31 02:26:53 +02:00
|
|
|
import LocalAudioPlayer from './LocalAudioPlayer'
|
|
|
|
import LocalVideoPlayer from './LocalVideoPlayer'
|
2022-02-23 00:33:55 +01:00
|
|
|
import CastPlayer from './CastPlayer'
|
|
|
|
import AudioTrack from './AudioTrack'
|
2022-05-31 02:26:53 +02:00
|
|
|
import VideoTrack from './VideoTrack'
|
2022-02-23 00:33:55 +01:00
|
|
|
|
|
|
|
export default class PlayerHandler {
|
|
|
|
constructor(ctx) {
|
|
|
|
this.ctx = ctx
|
2022-03-13 02:59:35 +01:00
|
|
|
this.libraryItem = null
|
2022-03-26 23:41:26 +01:00
|
|
|
this.episodeId = null
|
2022-04-02 17:26:42 +02:00
|
|
|
this.displayTitle = null
|
|
|
|
this.displayAuthor = null
|
2022-02-23 00:33:55 +01:00
|
|
|
this.playWhenReady = false
|
2022-04-23 23:51:13 +02:00
|
|
|
this.initialPlaybackRate = 1
|
2022-02-23 00:33:55 +01:00
|
|
|
this.player = null
|
|
|
|
this.playerState = 'IDLE'
|
2022-03-18 01:10:47 +01:00
|
|
|
this.isHlsTranscode = false
|
2022-05-31 02:26:53 +02:00
|
|
|
this.isVideo = false
|
2022-12-22 23:38:55 +01:00
|
|
|
this.isMusic = false
|
2022-03-18 01:10:47 +01:00
|
|
|
this.currentSessionId = null
|
2022-07-30 02:06:52 +02:00
|
|
|
this.startTimeOverride = undefined // Used for starting playback at a specific time (i.e. clicking bookmark from library item page)
|
2022-02-23 00:33:55 +01:00
|
|
|
this.startTime = 0
|
|
|
|
|
2022-06-04 02:11:13 +02:00
|
|
|
this.failedProgressSyncs = 0
|
2022-02-23 00:33:55 +01:00
|
|
|
this.lastSyncTime = 0
|
|
|
|
this.lastSyncedAt = 0
|
|
|
|
this.listeningTimeSinceSync = 0
|
|
|
|
|
|
|
|
this.playInterval = null
|
|
|
|
}
|
|
|
|
|
|
|
|
get isCasting() {
|
|
|
|
return this.ctx.$store.state.globals.isCasting
|
|
|
|
}
|
2022-03-26 23:41:26 +01:00
|
|
|
get libraryItemId() {
|
|
|
|
return this.libraryItem ? this.libraryItem.id : null
|
|
|
|
}
|
2022-03-13 02:59:35 +01:00
|
|
|
get isPlayingCastedItem() {
|
|
|
|
return this.libraryItem && (this.player instanceof CastPlayer)
|
2022-02-23 00:33:55 +01:00
|
|
|
}
|
2022-03-13 02:59:35 +01:00
|
|
|
get isPlayingLocalItem() {
|
2022-05-31 02:26:53 +02:00
|
|
|
return this.libraryItem && (this.player instanceof LocalAudioPlayer)
|
2022-02-23 00:33:55 +01:00
|
|
|
}
|
|
|
|
get userToken() {
|
|
|
|
return this.ctx.$store.getters['user/getToken']
|
|
|
|
}
|
|
|
|
get playerPlaying() {
|
|
|
|
return this.playerState === 'PLAYING'
|
|
|
|
}
|
2022-03-27 00:30:58 +01:00
|
|
|
get episode() {
|
|
|
|
if (!this.episodeId) return null
|
|
|
|
return this.libraryItem.media.episodes.find(ep => ep.id === this.episodeId)
|
|
|
|
}
|
2022-02-23 00:33:55 +01:00
|
|
|
|
2022-07-30 02:06:52 +02:00
|
|
|
load(libraryItem, episodeId, playWhenReady, playbackRate, startTimeOverride = undefined) {
|
2022-03-13 02:59:35 +01:00
|
|
|
this.libraryItem = libraryItem
|
2022-12-22 23:38:55 +01:00
|
|
|
this.isVideo = libraryItem.mediaType === 'video'
|
|
|
|
this.isMusic = libraryItem.mediaType === 'music'
|
|
|
|
|
2022-03-26 23:41:26 +01:00
|
|
|
this.episodeId = episodeId
|
2022-02-23 00:33:55 +01:00
|
|
|
this.playWhenReady = playWhenReady
|
2022-12-22 23:38:55 +01:00
|
|
|
this.initialPlaybackRate = this.isMusic ? 1 : playbackRate
|
|
|
|
|
2022-07-30 02:06:52 +02:00
|
|
|
this.startTimeOverride = (startTimeOverride == null || isNaN(startTimeOverride)) ? undefined : Number(startTimeOverride)
|
2022-05-31 02:26:53 +02:00
|
|
|
|
|
|
|
if (!this.player) this.switchPlayer(playWhenReady)
|
|
|
|
else this.prepare()
|
2022-02-23 00:33:55 +01:00
|
|
|
}
|
|
|
|
|
2022-05-31 02:26:53 +02:00
|
|
|
switchPlayer(playWhenReady) {
|
2022-02-23 00:33:55 +01:00
|
|
|
if (this.isCasting && !(this.player instanceof CastPlayer)) {
|
|
|
|
console.log('[PlayerHandler] Switching to cast player')
|
|
|
|
|
|
|
|
this.stopPlayInterval()
|
|
|
|
this.playerStateChange('LOADING')
|
|
|
|
|
|
|
|
this.startTime = this.player ? this.player.getCurrentTime() : this.startTime
|
|
|
|
if (this.player) {
|
|
|
|
this.player.destroy()
|
|
|
|
}
|
|
|
|
this.player = new CastPlayer(this.ctx)
|
|
|
|
this.setPlayerListeners()
|
|
|
|
|
2022-03-13 02:59:35 +01:00
|
|
|
if (this.libraryItem) {
|
|
|
|
// libraryItem was already loaded - prepare for cast
|
2022-05-31 02:26:53 +02:00
|
|
|
this.playWhenReady = playWhenReady
|
2022-02-23 00:33:55 +01:00
|
|
|
this.prepare()
|
|
|
|
}
|
2022-05-31 02:26:53 +02:00
|
|
|
} else if (!this.isCasting && !(this.player instanceof LocalAudioPlayer) && !(this.player instanceof LocalVideoPlayer)) {
|
2022-02-23 00:33:55 +01:00
|
|
|
console.log('[PlayerHandler] Switching to local player')
|
|
|
|
|
|
|
|
this.stopPlayInterval()
|
|
|
|
this.playerStateChange('LOADING')
|
|
|
|
|
|
|
|
if (this.player) {
|
|
|
|
this.player.destroy()
|
|
|
|
}
|
2022-05-31 02:26:53 +02:00
|
|
|
|
|
|
|
if (this.isVideo) {
|
|
|
|
this.player = new LocalVideoPlayer(this.ctx)
|
|
|
|
} else {
|
|
|
|
this.player = new LocalAudioPlayer(this.ctx)
|
|
|
|
}
|
|
|
|
|
2022-02-23 00:33:55 +01:00
|
|
|
this.setPlayerListeners()
|
|
|
|
|
2022-03-13 02:59:35 +01:00
|
|
|
if (this.libraryItem) {
|
|
|
|
// libraryItem was already loaded - prepare for local play
|
2022-05-31 02:26:53 +02:00
|
|
|
this.playWhenReady = playWhenReady
|
2022-02-23 00:33:55 +01:00
|
|
|
this.prepare()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setPlayerListeners() {
|
|
|
|
this.player.on('stateChange', this.playerStateChange.bind(this))
|
|
|
|
this.player.on('timeupdate', this.playerTimeupdate.bind(this))
|
|
|
|
this.player.on('buffertimeUpdate', this.playerBufferTimeUpdate.bind(this))
|
2022-03-05 22:37:30 +01:00
|
|
|
this.player.on('error', this.playerError.bind(this))
|
2022-05-29 19:55:14 +02:00
|
|
|
this.player.on('finished', this.playerFinished.bind(this))
|
2022-03-05 22:37:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
playerError() {
|
|
|
|
// Switch to HLS stream on error
|
2023-04-09 21:32:51 +02:00
|
|
|
if (!this.isCasting && (this.player instanceof LocalAudioPlayer)) {
|
2022-03-05 22:37:30 +01:00
|
|
|
console.log(`[PlayerHandler] Audio player error switching to HLS stream`)
|
|
|
|
this.prepare(true)
|
|
|
|
}
|
2022-02-23 00:33:55 +01:00
|
|
|
}
|
|
|
|
|
2022-05-29 19:55:14 +02:00
|
|
|
playerFinished() {
|
|
|
|
this.stopPlayInterval()
|
|
|
|
|
|
|
|
var currentTime = this.player.getCurrentTime()
|
|
|
|
this.ctx.setCurrentTime(currentTime)
|
|
|
|
|
|
|
|
// TODO: Add listening time between last sync and now?
|
|
|
|
this.sendProgressSync(currentTime)
|
2022-08-28 20:12:38 +02:00
|
|
|
|
|
|
|
this.ctx.mediaFinished(this.libraryItemId, this.episodeId)
|
2022-05-29 19:55:14 +02:00
|
|
|
}
|
|
|
|
|
2022-02-23 00:33:55 +01:00
|
|
|
playerStateChange(state) {
|
|
|
|
console.log('[PlayerHandler] Player state change', state)
|
|
|
|
this.playerState = state
|
2022-12-22 23:38:55 +01:00
|
|
|
|
2023-01-04 01:00:01 +01:00
|
|
|
if (this.playerState === 'PLAYING') {
|
|
|
|
this.setPlaybackRate(this.initialPlaybackRate)
|
|
|
|
this.startPlayInterval()
|
|
|
|
} else {
|
|
|
|
this.stopPlayInterval()
|
2022-02-23 00:33:55 +01:00
|
|
|
}
|
2022-12-22 23:38:55 +01:00
|
|
|
|
2022-07-30 02:06:52 +02:00
|
|
|
if (this.player) {
|
|
|
|
if (this.playerState === 'LOADED' || this.playerState === 'PLAYING') {
|
|
|
|
this.ctx.setDuration(this.getDuration())
|
|
|
|
}
|
|
|
|
if (this.playerState !== 'LOADING') {
|
|
|
|
this.ctx.setCurrentTime(this.player.getCurrentTime())
|
|
|
|
}
|
2022-02-23 00:33:55 +01:00
|
|
|
}
|
|
|
|
|
2022-03-26 23:41:26 +01:00
|
|
|
this.ctx.setPlaying(this.playerState === 'PLAYING')
|
2022-02-23 00:33:55 +01:00
|
|
|
this.ctx.playerLoading = this.playerState === 'LOADING'
|
|
|
|
}
|
|
|
|
|
|
|
|
playerTimeupdate(time) {
|
|
|
|
this.ctx.setCurrentTime(time)
|
|
|
|
}
|
|
|
|
|
|
|
|
playerBufferTimeUpdate(buffertime) {
|
|
|
|
this.ctx.setBufferTime(buffertime)
|
|
|
|
}
|
|
|
|
|
2023-04-09 01:01:24 +02:00
|
|
|
getDeviceId() {
|
|
|
|
let deviceId = localStorage.getItem('absDeviceId')
|
|
|
|
if (!deviceId) {
|
|
|
|
deviceId = this.ctx.$randomId()
|
|
|
|
localStorage.setItem('absDeviceId', deviceId)
|
|
|
|
}
|
|
|
|
return deviceId
|
|
|
|
}
|
|
|
|
|
2022-03-18 01:10:47 +01:00
|
|
|
async prepare(forceTranscode = false) {
|
2023-04-09 21:32:51 +02:00
|
|
|
this.currentSessionId = null // Reset session
|
|
|
|
|
2023-04-09 01:01:24 +02:00
|
|
|
const payload = {
|
|
|
|
deviceInfo: {
|
|
|
|
deviceId: this.getDeviceId()
|
|
|
|
},
|
2022-04-16 19:37:10 +02:00
|
|
|
supportedMimeTypes: this.player.playableMimeTypes,
|
2022-03-18 01:10:47 +01:00
|
|
|
mediaPlayer: this.isCasting ? 'chromecast' : 'html5',
|
|
|
|
forceTranscode,
|
2022-05-31 02:26:53 +02:00
|
|
|
forceDirectPlay: this.isCasting || this.isVideo // TODO: add transcode support for chromecast
|
2022-03-18 01:10:47 +01:00
|
|
|
}
|
2022-03-26 23:41:26 +01:00
|
|
|
|
2023-04-09 01:01:24 +02:00
|
|
|
const path = this.episodeId ? `/api/items/${this.libraryItem.id}/play/${this.episodeId}` : `/api/items/${this.libraryItem.id}/play`
|
|
|
|
const session = await this.ctx.$axios.$post(path, payload).catch((error) => {
|
2022-03-18 01:10:47 +01:00
|
|
|
console.error('Failed to start stream', error)
|
|
|
|
})
|
|
|
|
this.prepareSession(session)
|
|
|
|
}
|
2022-03-05 22:37:30 +01:00
|
|
|
|
2022-04-23 23:51:13 +02:00
|
|
|
prepareOpenSession(session, playbackRate) { // Session opened on init socket
|
2022-06-18 20:11:15 +02:00
|
|
|
if (!this.player) this.switchPlayer() // Must set player first for open sessions
|
|
|
|
|
2022-03-18 01:10:47 +01:00
|
|
|
this.libraryItem = session.libraryItem
|
2022-05-31 02:26:53 +02:00
|
|
|
this.isVideo = session.libraryItem.mediaType === 'video'
|
2022-03-18 01:10:47 +01:00
|
|
|
this.playWhenReady = false
|
2022-04-23 23:51:13 +02:00
|
|
|
this.initialPlaybackRate = playbackRate
|
2022-07-30 02:06:52 +02:00
|
|
|
this.startTimeOverride = undefined
|
2022-05-31 02:26:53 +02:00
|
|
|
|
2022-03-18 01:10:47 +01:00
|
|
|
this.prepareSession(session)
|
|
|
|
}
|
2022-03-05 22:37:30 +01:00
|
|
|
|
2022-03-18 01:10:47 +01:00
|
|
|
prepareSession(session) {
|
2022-06-04 02:11:13 +02:00
|
|
|
this.failedProgressSyncs = 0
|
2022-07-30 02:06:52 +02:00
|
|
|
this.startTime = this.startTimeOverride !== undefined ? this.startTimeOverride : session.currentTime
|
2022-03-18 01:10:47 +01:00
|
|
|
this.currentSessionId = session.id
|
2022-04-02 17:26:42 +02:00
|
|
|
this.displayTitle = session.displayTitle
|
|
|
|
this.displayAuthor = session.displayAuthor
|
2022-03-05 22:37:30 +01:00
|
|
|
|
2022-03-18 01:10:47 +01:00
|
|
|
console.log('[PlayerHandler] Preparing Session', session)
|
2022-03-05 22:37:30 +01:00
|
|
|
|
2022-05-31 02:26:53 +02:00
|
|
|
if (session.videoTrack) {
|
|
|
|
var videoTrack = new VideoTrack(session.videoTrack, this.userToken)
|
2022-02-23 00:33:55 +01:00
|
|
|
|
2022-05-31 02:26:53 +02:00
|
|
|
this.ctx.playerLoading = true
|
|
|
|
this.isHlsTranscode = true
|
|
|
|
if (session.playMethod === this.ctx.$constants.PlayMethod.DIRECTPLAY) {
|
|
|
|
this.isHlsTranscode = false
|
|
|
|
}
|
|
|
|
|
|
|
|
this.player.set(this.libraryItem, videoTrack, this.isHlsTranscode, this.startTime, this.playWhenReady)
|
|
|
|
} else {
|
|
|
|
var audioTracks = session.audioTracks.map(at => new AudioTrack(at, this.userToken))
|
|
|
|
|
|
|
|
this.ctx.playerLoading = true
|
|
|
|
this.isHlsTranscode = true
|
|
|
|
if (session.playMethod === this.ctx.$constants.PlayMethod.DIRECTPLAY) {
|
|
|
|
this.isHlsTranscode = false
|
|
|
|
}
|
|
|
|
|
|
|
|
this.player.set(this.libraryItem, audioTracks, this.isHlsTranscode, this.startTime, this.playWhenReady)
|
|
|
|
}
|
2022-05-15 22:48:41 +02:00
|
|
|
|
|
|
|
// browser media session api
|
|
|
|
this.ctx.setMediaSession()
|
2022-03-05 22:37:30 +01:00
|
|
|
}
|
|
|
|
|
2022-02-23 00:33:55 +01:00
|
|
|
closePlayer() {
|
2022-03-13 02:59:35 +01:00
|
|
|
console.log('[PlayerHandler] Close Player')
|
2022-03-18 01:10:47 +01:00
|
|
|
this.sendCloseSession()
|
2023-04-09 01:01:24 +02:00
|
|
|
this.resetPlayer()
|
|
|
|
}
|
|
|
|
|
|
|
|
resetPlayer() {
|
2022-02-23 00:33:55 +01:00
|
|
|
if (this.player) {
|
|
|
|
this.player.destroy()
|
|
|
|
}
|
|
|
|
this.player = null
|
|
|
|
this.playerState = 'IDLE'
|
2022-03-13 02:59:35 +01:00
|
|
|
this.libraryItem = null
|
2023-04-09 21:32:51 +02:00
|
|
|
this.currentSessionId = null
|
2022-02-23 00:33:55 +01:00
|
|
|
this.startTime = 0
|
|
|
|
this.stopPlayInterval()
|
|
|
|
}
|
|
|
|
|
|
|
|
resetStream(startTime, streamId) {
|
2022-03-18 01:10:47 +01:00
|
|
|
if (this.isHlsTranscode && this.currentSessionId === streamId) {
|
2022-02-23 00:33:55 +01:00
|
|
|
this.player.resetStream(startTime)
|
|
|
|
} else {
|
2022-03-18 01:10:47 +01:00
|
|
|
console.warn('resetStream mismatch streamId', this.currentSessionId, streamId)
|
2022-02-23 00:33:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
startPlayInterval() {
|
|
|
|
clearInterval(this.playInterval)
|
2023-01-04 01:00:01 +01:00
|
|
|
let lastTick = Date.now()
|
2022-02-23 00:33:55 +01:00
|
|
|
this.playInterval = setInterval(() => {
|
|
|
|
// Update UI
|
|
|
|
if (!this.player) return
|
2023-01-04 01:00:01 +01:00
|
|
|
const currentTime = this.player.getCurrentTime()
|
2022-02-23 00:33:55 +01:00
|
|
|
this.ctx.setCurrentTime(currentTime)
|
|
|
|
|
2023-01-04 01:00:01 +01:00
|
|
|
const exactTimeElapsed = ((Date.now() - lastTick) / 1000)
|
2022-02-23 00:33:55 +01:00
|
|
|
lastTick = Date.now()
|
|
|
|
this.listeningTimeSinceSync += exactTimeElapsed
|
|
|
|
if (this.listeningTimeSinceSync >= 5) {
|
|
|
|
this.sendProgressSync(currentTime)
|
|
|
|
}
|
|
|
|
}, 1000)
|
|
|
|
}
|
|
|
|
|
2022-03-18 01:10:47 +01:00
|
|
|
sendCloseSession() {
|
2023-01-04 01:00:01 +01:00
|
|
|
let syncData = null
|
2022-03-18 01:10:47 +01:00
|
|
|
if (this.player) {
|
2023-01-04 01:00:01 +01:00
|
|
|
const listeningTimeToAdd = Math.max(0, Math.floor(this.listeningTimeSinceSync))
|
2022-03-18 01:10:47 +01:00
|
|
|
syncData = {
|
|
|
|
timeListened: listeningTimeToAdd,
|
2022-03-18 21:31:46 +01:00
|
|
|
duration: this.getDuration(),
|
|
|
|
currentTime: this.getCurrentTime()
|
2022-03-18 01:10:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
this.listeningTimeSinceSync = 0
|
|
|
|
return this.ctx.$axios.$post(`/api/session/${this.currentSessionId}/close`, syncData, { timeout: 1000 }).catch((error) => {
|
|
|
|
console.error('Failed to close session', error)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-02-23 00:33:55 +01:00
|
|
|
sendProgressSync(currentTime) {
|
2023-01-04 01:00:01 +01:00
|
|
|
if (this.isMusic) return
|
|
|
|
|
|
|
|
const diffSinceLastSync = Math.abs(this.lastSyncTime - currentTime)
|
2022-02-23 00:33:55 +01:00
|
|
|
if (diffSinceLastSync < 1) return
|
|
|
|
|
|
|
|
this.lastSyncTime = currentTime
|
2023-01-04 01:00:01 +01:00
|
|
|
const listeningTimeToAdd = Math.max(0, Math.floor(this.listeningTimeSinceSync))
|
|
|
|
const syncData = {
|
2022-03-18 01:10:47 +01:00
|
|
|
timeListened: listeningTimeToAdd,
|
2022-03-18 21:31:46 +01:00
|
|
|
duration: this.getDuration(),
|
2022-03-18 01:10:47 +01:00
|
|
|
currentTime
|
2022-02-23 00:33:55 +01:00
|
|
|
}
|
2022-03-18 01:10:47 +01:00
|
|
|
this.listeningTimeSinceSync = 0
|
2022-09-13 23:50:27 +02:00
|
|
|
this.ctx.$axios.$post(`/api/session/${this.currentSessionId}/sync`, syncData, { timeout: 3000 }).then(() => {
|
2022-06-04 02:11:13 +02:00
|
|
|
this.failedProgressSyncs = 0
|
|
|
|
}).catch((error) => {
|
2022-03-18 01:10:47 +01:00
|
|
|
console.error('Failed to update session progress', error)
|
2022-06-04 02:11:13 +02:00
|
|
|
this.failedProgressSyncs++
|
|
|
|
if (this.failedProgressSyncs >= 2) {
|
|
|
|
this.ctx.showFailedProgressSyncs()
|
|
|
|
this.failedProgressSyncs = 0
|
|
|
|
}
|
2022-03-18 01:10:47 +01:00
|
|
|
})
|
2022-02-23 00:33:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
stopPlayInterval() {
|
|
|
|
clearInterval(this.playInterval)
|
|
|
|
this.playInterval = null
|
|
|
|
}
|
|
|
|
|
|
|
|
playPause() {
|
|
|
|
if (this.player) this.player.playPause()
|
|
|
|
}
|
|
|
|
|
|
|
|
play() {
|
2022-03-05 19:30:46 +01:00
|
|
|
if (this.player) this.player.play()
|
2022-02-23 00:33:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pause() {
|
|
|
|
if (this.player) this.player.pause()
|
|
|
|
}
|
|
|
|
|
|
|
|
getCurrentTime() {
|
|
|
|
return this.player ? this.player.getCurrentTime() : 0
|
|
|
|
}
|
|
|
|
|
|
|
|
getDuration() {
|
|
|
|
return this.player ? this.player.getDuration() : 0
|
|
|
|
}
|
|
|
|
|
|
|
|
jumpBackward() {
|
|
|
|
if (!this.player) return
|
|
|
|
var currentTime = this.getCurrentTime()
|
|
|
|
this.seek(Math.max(0, currentTime - 10))
|
|
|
|
}
|
|
|
|
|
|
|
|
jumpForward() {
|
|
|
|
if (!this.player) return
|
|
|
|
var currentTime = this.getCurrentTime()
|
|
|
|
this.seek(Math.min(currentTime + 10, this.getDuration()))
|
|
|
|
}
|
|
|
|
|
|
|
|
setVolume(volume) {
|
|
|
|
if (!this.player) return
|
|
|
|
this.player.setVolume(volume)
|
|
|
|
}
|
|
|
|
|
|
|
|
setPlaybackRate(playbackRate) {
|
2022-04-23 23:51:13 +02:00
|
|
|
this.initialPlaybackRate = playbackRate // Might be loaded from settings before player is started
|
2022-02-23 00:33:55 +01:00
|
|
|
if (!this.player) return
|
|
|
|
this.player.setPlaybackRate(playbackRate)
|
|
|
|
}
|
|
|
|
|
|
|
|
seek(time) {
|
|
|
|
if (!this.player) return
|
|
|
|
this.player.seek(time, this.playerPlaying)
|
|
|
|
this.ctx.setCurrentTime(time)
|
|
|
|
|
|
|
|
// Update progress if paused
|
|
|
|
if (!this.playerPlaying) {
|
|
|
|
this.sendProgressSync(time)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|