mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-12 04:11:43 +00:00
Fixed finish error and make continous playback working on android browsers
This commit is contained in:
parent
f36df9e67b
commit
aba7108058
3 changed files with 15 additions and 8 deletions
|
|
@ -18,17 +18,24 @@ export default class DLNAPlayer extends EventEmitter {
|
|||
this.paused
|
||||
this.currentTime = null
|
||||
//This is stupid but the best way to keep the site loaded on Smartphones is to have a fake player playing in the background \(^_^)/
|
||||
this.playableMimeTypes = ['audio/flac', 'audio/mpeg', 'audio/mp4', 'audio/ogg', 'audio/aac', 'audio/x-ms-wma', 'audio/x-aiff', 'audio/webm']
|
||||
var audioEl = document.createElement('audio')
|
||||
audioEl.id = 'audio-player'
|
||||
audioEl.style.display = 'none'
|
||||
audioEl.muted = true
|
||||
document.body.appendChild(audioEl)
|
||||
this.fake_player = audioEl
|
||||
// TODO: Use canDisplayType on receiver to check mime types
|
||||
this.playableMimeTypes = ['audio/flac', 'audio/mpeg', 'audio/mp4', 'audio/ogg', 'audio/aac', 'audio/x-ms-wma', 'audio/x-aiff', 'audio/webm']
|
||||
|
||||
this.coverUrl = ''
|
||||
this.castPlayerState = 'IDLE'
|
||||
this.fake_player.volume = 0.00001
|
||||
this.fake_player.addEventListener(
|
||||
'play',
|
||||
function () {
|
||||
setTimeout(
|
||||
function () {
|
||||
this.fake_player.muted = true
|
||||
}.bind(this),
|
||||
1000
|
||||
)
|
||||
}.bind(this)
|
||||
)
|
||||
|
||||
// Supported audio codecs for chromecast
|
||||
|
||||
|
|
@ -43,6 +50,7 @@ export default class DLNAPlayer extends EventEmitter {
|
|||
|
||||
initialize() {
|
||||
this.ctx.$root.socket.on('dlna_status', (data) => this.setStatus(data))
|
||||
this.ctx.$root.socket.on('dlna_finished', () => this.emit('finished'))
|
||||
//this.player = this.ctx.$root.castPlayer
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -270,7 +270,6 @@ export default class PlayerHandler {
|
|||
if (session.playMethod === this.ctx.$constants.PlayMethod.DIRECTPLAY) {
|
||||
this.isHlsTranscode = false
|
||||
}
|
||||
console.log('blub', audioTracks)
|
||||
this.player.set(this.libraryItem, audioTracks, this.isHlsTranscode, this.startTime, this.playWhenReady)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class DLNASession {
|
|||
//If playback is stopped check if playback of track ended and Load new track
|
||||
var t = this.tracks[this.trackIndex]
|
||||
if (t.duration - this.playtime < 2) {
|
||||
if (this.trackIndex < this.tracks.length) {
|
||||
if (this.trackIndex < this.tracks.length - 1) {
|
||||
this.load(this.tracks[this.trackIndex + 1].startOffset)
|
||||
this.playtime = 0
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue