Change:Cast support use audio tracks instead of HLS #11, Clean up playernotificationmanager

This commit is contained in:
advplyr 2021-12-18 18:26:50 -06:00
parent b9de407c8a
commit f11efd93c7
8 changed files with 868 additions and 729 deletions

View file

@ -138,6 +138,18 @@ export default {
var coverSrc = this.$store.getters['audiobooks/getBookCoverSrc'](this.audiobook)
return coverSrc
},
tracksForCast() {
if (!this.audiobook || !this.audiobook.tracks) {
return []
}
var abpath = this.audiobook.path
var tracks = this.audiobook.tracks.map((t) => {
var trelpath = t.path.replace(abpath, '')
if (trelpath.startsWith('/')) trelpath = trelpath.substr(1)
return `${this.$store.state.serverUrl}/s/book/${this.audiobook.id}/${trelpath}?token=${this.userToken}`
})
return tracks
},
sleepTimeRemaining() {
if (!this.sleepTimerEndTime) return 0
return Math.max(0, this.sleepTimerEndTime / 1000 - this.currentTime)
@ -390,8 +402,10 @@ export default {
series: this.seriesTxt,
playlistUrl: this.$server.url + playlistUrl,
token: this.userToken,
audiobookId: this.audiobookId
audiobookId: this.audiobookId,
tracks: this.tracksForCast
}
this.$refs.audioPlayer.set(audiobookStreamData, stream, !this.stream)
this.stream = stream