Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit ee2364c

Browse files
committed
Play song locally if it has a path
1 parent ed1e427 commit ee2364c

1 file changed

Lines changed: 12 additions & 16 deletions

File tree

src/mainWindow/components/musicbar/components/AudioStream.vue

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ export default class AudioStream extends mixins(
169169
170170
let tries = 0
171171
while (!(player && (song.path ?? song.playbackUrl)) && tries < vxm.playerRepo.allPlayers.length) {
172+
173+
if (song.path && !this.playerBlacklist.includes('LOCAL')) {
174+
newType = 'LOCAL'
175+
}
176+
172177
player = this.findPlayer(newType, this.playerBlacklist)
173178
console.debug('Found player', song, newType, player?.key)
174179
@@ -905,29 +910,20 @@ export default class AudioStream extends mixins(
905910
return
906911
}
907912
908-
if (PlayerTypes === 'LOCAL') {
913+
try {
909914
this.activePlayer?.load(
910915
song.path ? 'media://' + song.path : song.playbackUrl,
911916
this.volume,
912917
vxm.player.playAfterLoad || this.playerState === 'PLAYING'
913918
)
914-
console.debug('Loaded song at', song.path ? 'media://' + song.path : song.playbackUrl)
915-
vxm.player.loading = false
916-
} else {
917-
console.debug('PlaybackUrl for song', song._id, 'is', song.playbackUrl)
918-
console.debug('Loaded song at', song.playbackUrl)
919-
920-
try {
921-
await this.activePlayer?.load(
922-
song.playbackUrl,
923-
this.volume,
924-
vxm.player.playAfterLoad || this.playerState !== 'PAUSED'
925-
)
926-
} catch (e) {
927-
console.error('failed to load song', e)
928-
}
919+
} catch (e) {
920+
console.error('failed to load song', e)
929921
}
930922
923+
console.debug('Loaded song at', song.path ? 'media://' + song.path : song.playbackUrl)
924+
vxm.player.loading = false
925+
926+
931927
vxm.player.playAfterLoad = false
932928
933929
if (this.handleBroadcasterAudioLoad()) return

0 commit comments

Comments
 (0)