File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,10 @@ static int MusicHTML5_Open(const SDL_AudioSpec *spec)
101
101
Module ["SDL2Mixer" ].music [id ] = new Audio (url );
102
102
Module ["SDL2Mixer" ].music [id ].addEventListener ("ended" , Module ["SDL2Mixer" ].musicFinished , false);
103
103
Module ["SDL2Mixer" ].music [id ].addEventListener ("error" , Module ["SDL2Mixer" ].musicError , false);
104
+ Module ["SDL2Mixer" ].music [id ].addEventListener ("abort" , Module ["SDL2Mixer" ].musicInterrupted , false);
105
+ // Can browser recover from these states? If not, consider enabling these.
106
+ //Module["SDL2Mixer"].music[id].addEventListener("stalled", Module["SDL2Mixer"].musicInterrupted, false);
107
+ //Module["SDL2Mixer"].music[id].addEventListener("suspend", Module["SDL2Mixer"].musicInterrupted, false);
104
108
if (context )
105
109
Module ["SDL2Mixer" ].music [id ].dataset .context = context ;
106
110
return id ;
@@ -213,6 +217,11 @@ static int MusicHTML5_Open(const SDL_AudioSpec *spec)
213
217
214
218
// Reset to defaults
215
219
this .resetMusicState (audio );
220
+ },
221
+
222
+ musicInterrupted : function (e ) {
223
+ // Reset to defaults
224
+ this .resetMusicState (e .target );
216
225
}
217
226
};
218
227
}), html5_handle_music_stopped );
You can’t perform that action at this time.
0 commit comments