You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something is funky with Chrome on Android when I try to self-destruct (this.destruct()) on onfinish event. The thing crashes and my app won't play the next song.
soundmanager2.js:1307 sound4: load (http://music.ugjka.net/stream?id=4fa3cf33515636cee19b585d2863b8494beca314)
soundmanager2.js:1307 sound3: Destruct
soundmanager2.js:1307 sound3: unload()
soundmanager2.js:1307 HTML5::Ignoring timeupdate
soundmanager2.js:4195 Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause().
html5Unload @ soundmanager2.js:4195
SMSound.destruct @ soundmanager2.js:1846
onfinish @ common.js:104
(anonymous) @ soundmanager2.js:3364
wrapCallback @ soundmanager2.js:3651
SMSound._onfinish @ soundmanager2.js:3363
(anonymous) @ soundmanager2.js:3986
(anonymous) @ soundmanager2.js:3885
soundmanager2.js:1307 HTML5::Ignoring loadstart
soundmanager2.js:1307 HTML5::Ignoring error
this is the code
//Play song by idfunctionplaySong(id){soundManager.stopAll();soundManager.createSound({id: ["sound",id].join(""),url: [music.url,"/stream?id=",music.playlist[id].ID].join(""),multiShot:false,onfinish: function(){if(music.current==(music.playlist.length-1)){music.current=0;}else{music.current++;}playSong(music.current);$(["#sound",id].join("")).attr("playing",false);this.destruct();},onstop: function(){$(["#sound",id].join("")).attr("playing",false);this.destruct();},whileplaying: function(){if(music.sliderDrag==false){music.slider.value=(this.position/this.durationEstimate)*1000;}},});$(["#sound",id].join("")).attr("playing",true);soundManager.play(["sound",id].join(""));document.getElementsByTagName("body")[0].style.backgroundImage=["url(",music.url,"/art?id=",music.playlist[id].ID,")"].join("");}
This sometimes also happen on desktop Chrome, but very rarely
The text was updated successfully, but these errors were encountered:
Hm! Apologies for the late follow up, and thanks for the report. When creating a new sound, SM2 should make a new Audio() object by default unless on a mobile device. Given you're on Android, it may be that destruct() destroys the single audio instance and then things might indeed go south. ;)
If you avoid using destruct(), you should be OK. If you want to be careful about saving resources, you can try calling the unload() method on the sound object before loading the next sound. This might be problematic on mobile because of their restrictions on "auto-play" - i.e., sound onfinish() -> unload() -> play()might get blocked, so it's worth testing on iOS and Android to see if the behaviour is OK.
I didn't expect destruct() to cause issues and hadn't considered the mobile / singleton audio object case there, so thanks for the heads-up.
Something is funky with Chrome on Android when I try to self-destruct (
this.destruct()
) ononfinish
event. The thing crashes and my app won't play the next song.this is the code
This sometimes also happen on desktop Chrome, but very rarely
The text was updated successfully, but these errors were encountered: