mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-30 18:48:55 +01:00
m3u8url
This commit is contained in:
parent
fcf6964d7d
commit
e81238038e
@ -28,11 +28,6 @@ export default class LocalAudioPlayer extends EventEmitter {
|
|||||||
return this.audioTracks[this.currentTrackIndex] || {}
|
return this.audioTracks[this.currentTrackIndex] || {}
|
||||||
}
|
}
|
||||||
|
|
||||||
get hslContentUrl() {
|
|
||||||
// the hls stream playlist is the same for all tracks
|
|
||||||
return this.audioTracks[0].relativeContentUrl
|
|
||||||
}
|
|
||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
if (document.getElementById('audio-player')) {
|
if (document.getElementById('audio-player')) {
|
||||||
document.getElementById('audio-player').remove()
|
document.getElementById('audio-player').remove()
|
||||||
@ -132,12 +127,13 @@ export default class LocalAudioPlayer extends EventEmitter {
|
|||||||
|
|
||||||
setHlsStream() {
|
setHlsStream() {
|
||||||
this.trackStartTime = 0
|
this.trackStartTime = 0
|
||||||
|
let m3u8Url = this.audioTracks[0].relativeContentUrl
|
||||||
|
|
||||||
// iOS does not support Media Elements but allows for HLS in the native audio player
|
// iOS does not support Media Elements but allows for HLS in the native audio player
|
||||||
if (!Hls.isSupported()) {
|
if (!Hls.isSupported()) {
|
||||||
console.warn('HLS is not supported - fallback to using audio element')
|
console.warn('HLS is not supported - fallback to using audio element')
|
||||||
this.usingNativeplayer = true
|
this.usingNativeplayer = true
|
||||||
this.player.src = this.hslContentUrl
|
this.player.src = m3u8Url
|
||||||
this.player.currentTime = this.startTime
|
this.player.currentTime = this.startTime
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -153,7 +149,7 @@ export default class LocalAudioPlayer extends EventEmitter {
|
|||||||
|
|
||||||
this.hlsInstance.attachMedia(this.player)
|
this.hlsInstance.attachMedia(this.player)
|
||||||
this.hlsInstance.on(Hls.Events.MEDIA_ATTACHED, () => {
|
this.hlsInstance.on(Hls.Events.MEDIA_ATTACHED, () => {
|
||||||
this.hlsInstance.loadSource(this.hslContentUrl)
|
this.hlsInstance.loadSource(m3u8Url)
|
||||||
|
|
||||||
this.hlsInstance.on(Hls.Events.MANIFEST_PARSED, () => {
|
this.hlsInstance.on(Hls.Events.MANIFEST_PARSED, () => {
|
||||||
console.log('[HLS] Manifest Parsed')
|
console.log('[HLS] Manifest Parsed')
|
||||||
|
Loading…
Reference in New Issue
Block a user