mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
Fix:Persist playback rate #419
This commit is contained in:
parent
b2d299dba6
commit
3dbce8fd71
@ -69,7 +69,8 @@ export default {
|
||||
sleepTimerTime: 0,
|
||||
sleepTimerRemaining: 0,
|
||||
sleepTimer: null,
|
||||
displayTitle: null
|
||||
displayTitle: null,
|
||||
initialPlaybackRate: 1
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -204,6 +205,7 @@ export default {
|
||||
this.playerHandler.setVolume(volume)
|
||||
},
|
||||
setPlaybackRate(playbackRate) {
|
||||
this.initialPlaybackRate = playbackRate
|
||||
this.playerHandler.setPlaybackRate(playbackRate)
|
||||
},
|
||||
seek(time) {
|
||||
@ -253,7 +255,7 @@ export default {
|
||||
libraryItem: session.libraryItem,
|
||||
episodeId: session.episodeId
|
||||
})
|
||||
this.playerHandler.prepareOpenSession(session)
|
||||
this.playerHandler.prepareOpenSession(session, this.initialPlaybackRate)
|
||||
},
|
||||
streamOpen(session) {
|
||||
console.log(`[StreamContainer] Stream session open`, session)
|
||||
@ -311,7 +313,7 @@ export default {
|
||||
episodeId
|
||||
})
|
||||
|
||||
this.playerHandler.load(libraryItem, episodeId, true)
|
||||
this.playerHandler.load(libraryItem, episodeId, true, this.initialPlaybackRate)
|
||||
},
|
||||
pauseItem() {
|
||||
this.playerHandler.pause()
|
||||
|
@ -10,6 +10,7 @@ export default class PlayerHandler {
|
||||
this.displayTitle = null
|
||||
this.displayAuthor = null
|
||||
this.playWhenReady = false
|
||||
this.initialPlaybackRate = 1
|
||||
this.player = null
|
||||
this.playerState = 'IDLE'
|
||||
this.isHlsTranscode = false
|
||||
@ -46,12 +47,13 @@ export default class PlayerHandler {
|
||||
return this.libraryItem.media.episodes.find(ep => ep.id === this.episodeId)
|
||||
}
|
||||
|
||||
load(libraryItem, episodeId, playWhenReady) {
|
||||
load(libraryItem, episodeId, playWhenReady, playbackRate) {
|
||||
if (!this.player) this.switchPlayer()
|
||||
|
||||
this.libraryItem = libraryItem
|
||||
this.episodeId = episodeId
|
||||
this.playWhenReady = playWhenReady
|
||||
this.initialPlaybackRate = playbackRate
|
||||
this.prepare()
|
||||
}
|
||||
|
||||
@ -113,6 +115,7 @@ export default class PlayerHandler {
|
||||
console.log('[PlayerHandler] Player state change', state)
|
||||
this.playerState = state
|
||||
if (this.playerState === 'PLAYING') {
|
||||
this.setPlaybackRate(this.initialPlaybackRate)
|
||||
this.startPlayInterval()
|
||||
} else {
|
||||
this.stopPlayInterval()
|
||||
@ -151,11 +154,12 @@ export default class PlayerHandler {
|
||||
this.prepareSession(session)
|
||||
}
|
||||
|
||||
prepareOpenSession(session) { // Session opened on init socket
|
||||
prepareOpenSession(session, playbackRate) { // Session opened on init socket
|
||||
if (!this.player) this.switchPlayer()
|
||||
|
||||
this.libraryItem = session.libraryItem
|
||||
this.playWhenReady = false
|
||||
this.initialPlaybackRate = playbackRate
|
||||
this.prepareSession(session)
|
||||
}
|
||||
|
||||
@ -292,6 +296,7 @@ export default class PlayerHandler {
|
||||
}
|
||||
|
||||
setPlaybackRate(playbackRate) {
|
||||
this.initialPlaybackRate = playbackRate // Might be loaded from settings before player is started
|
||||
if (!this.player) return
|
||||
this.player.setPlaybackRate(playbackRate)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user