handle lirestream audio

This commit is contained in:
SrGooglo 2025-02-19 16:33:08 +00:00
parent f0c9bbef3e
commit d43d514451
2 changed files with 14 additions and 6 deletions

View File

@ -39,11 +39,11 @@ export default class TrackInstance {
this.player.state.loading = false this.player.state.loading = false
}, },
loadedmetadata: () => { loadedmetadata: () => {
// TODO: Detect a livestream and change mode if (this.audio.duration === Infinity) {
// if (instance.media.duration === Infinity) { this.player.state.live = true
// instance.manifest.stream = true } else {
// this.state.livestream_mode = true this.player.state.live = false
// } }
}, },
play: () => { play: () => {
this.player.state.playback_status = "playing" this.player.state.playback_status = "playing"

View File

@ -153,7 +153,7 @@ export default class Player extends Core {
return this.queue.currentItem return this.queue.currentItem
} }
async start(manifest, { time, startIndex = 0 } = {}) { async start(manifest, { time, startIndex = 0, radioId } = {}) {
this.ui.attachPlayerComponent() this.ui.attachPlayerComponent()
if (this.queue.currentItem) { if (this.queue.currentItem) {
@ -165,6 +165,14 @@ export default class Player extends Core {
this.state.loading = true this.state.loading = true
if (typeof radioId === "string") {
this.state.radioId = radioId
this.state.live = true
} else {
this.state.radioId = null
this.state.live = false
}
let playlist = Array.isArray(manifest) ? manifest : [manifest] let playlist = Array.isArray(manifest) ? manifest : [manifest]
if (playlist.length === 0) { if (playlist.length === 0) {