A music player that connects to your cloud/distributed storage.
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

Catch audio play promise error

+12 -3
+12 -3
src/Javascript/audio-engine.js
··· 117 117 audioNode.context.connect(volume) 118 118 119 119 if (audioNode.readyState >= 4) { 120 - audioNode.play() 120 + playAudio(audioNode) 121 121 } else { 122 122 orchestrion.app.ports.setAudioIsLoading.send(true) 123 123 audioNode.load() ··· 263 263 264 264 function audioEndEvent(event) { 265 265 if (this.repeat) { 266 - event.target.play() 266 + playAudio(event.target) 267 267 } else { 268 268 this.app.ports.activeQueueItemEnded.send(null) 269 269 } ··· 280 280 function audioLoaded(event) { 281 281 clearTimeout(this.loadingTimeoutId) 282 282 this.app.ports.setAudioIsLoading.send(false) 283 - if (event.target.paused) event.target.play() 283 + if (event.target.paused) playAudio(event.target) 284 284 } 285 285 286 286 ··· 317 317 function isActiveAudioElement(orchestrion, node) { 318 318 if (!orchestrion.activeQueueItem || !node) return false; 319 319 return orchestrion.activeQueueItem.trackId === audioElementTrackId(node) 320 + } 321 + 322 + 323 + function playAudio(element) { 324 + const promise = element.play() || Promise.resolve() 325 + 326 + promise.catch(err => { 327 + console.error(err) 328 + }) 320 329 } 321 330 322 331