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.

Show proper error message when browser can't play the track

+17 -4
+17 -4
src/Javascript/audio-engine.js
··· 293 293 break 294 294 case event.target.error.MEDIA_ERR_NETWORK: 295 295 console.error("A network error caused the audio download to fail.") 296 - showNetworkErrorNotificationIfNeeded.call(this) 296 + showNetworkErrorNotification.call(this) 297 297 audioStalledEvent.call(this, event) 298 298 break 299 299 case event.target.error.MEDIA_ERR_DECODE: ··· 301 301 break 302 302 case event.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED: 303 303 console.error("The audio not be loaded, either because the server or network failed or because the format is not supported.") 304 - showNetworkErrorNotificationIfNeeded.call(this) 305 - audioStalledEvent.call(this, event) 304 + if (event.target.currentTime && event.target.currentTime > 0) { 305 + showNetworkErrorNotification.call(this) 306 + audioStalledEvent.call(this, event) 307 + } else { 308 + showUnsupportedSrcErrorNotification.call(this) 309 + clearTimeout(this.loadingTimeoutId) 310 + this.app.ports.setAudioIsLoading.send(false) 311 + } 306 312 break 307 313 default: 308 314 console.error("An unknown error occurred.") ··· 310 316 } 311 317 312 318 313 - function showNetworkErrorNotificationIfNeeded() { 319 + function showNetworkErrorNotification() { 314 320 this.app.ports.showErrorNotification.send( 315 321 navigator.onLine 316 322 ? "I can't play this track because of a network error. I'll try to reconnect." 317 323 : "I can't play this track because we're offline. I'll try to reconnect." 324 + ) 325 + } 326 + 327 + 328 + function showUnsupportedSrcErrorNotification() { 329 + this.app.ports.showErrorNotification.send( 330 + "__I can't play this track because your browser didn't recognize it.__ Try checking your developer console for a warning to find out why." 318 331 ) 319 332 } 320 333