mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-10 23:02:50 +02:00
updates to allow share t argument to over-ride server stored position
This commit is contained in:
@@ -363,7 +363,9 @@ export default {
|
|||||||
console.log('Loaded media item share', this.mediaItemShare)
|
console.log('Loaded media item share', this.mediaItemShare)
|
||||||
}
|
}
|
||||||
|
|
||||||
const startTime = this.playbackSession.currentTime || 0
|
const startTime = this.$route.query.t && !isNaN(this.$route.query.t)
|
||||||
|
? parseFloat(this.$route.query.t)
|
||||||
|
: (this.playbackSession.currentTime || 0)
|
||||||
this.localAudioPlayer.set(null, this.audioTracks, false, startTime, false)
|
this.localAudioPlayer.set(null, this.audioTracks, false, startTime, false)
|
||||||
this.localAudioPlayer.on('stateChange', this.playerStateChange.bind(this))
|
this.localAudioPlayer.on('stateChange', this.playerStateChange.bind(this))
|
||||||
this.localAudioPlayer.on('timeupdate', this.playerTimeUpdate.bind(this))
|
this.localAudioPlayer.on('timeupdate', this.playerTimeUpdate.bind(this))
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const ShareManager = require('../managers/ShareManager')
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class ShareController {
|
class ShareController {
|
||||||
constructor() {}
|
constructor() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public route
|
* Public route
|
||||||
@@ -53,6 +53,10 @@ class ShareController {
|
|||||||
if (playbackSession) {
|
if (playbackSession) {
|
||||||
if (mediaItemShare.id === playbackSession.mediaItemShareId) {
|
if (mediaItemShare.id === playbackSession.mediaItemShareId) {
|
||||||
Logger.debug(`[ShareController] Found share playback session ${req.cookies.share_session_id}`)
|
Logger.debug(`[ShareController] Found share playback session ${req.cookies.share_session_id}`)
|
||||||
|
// If ?t was provided, override the cached currentTime
|
||||||
|
if (startTime > 0) {
|
||||||
|
playbackSession.currentTime = startTime
|
||||||
|
}
|
||||||
mediaItemShare.playbackSession = playbackSession.toJSONForClient()
|
mediaItemShare.playbackSession = playbackSession.toJSONForClient()
|
||||||
return res.json(mediaItemShare)
|
return res.json(mediaItemShare)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user