charlie_says Posted April 3, 2018 Share Posted April 3, 2018 I'm using PIXI.sound in my project, and it's working very well. But, I'm finding that IE11 (yeah, I know) is very slow to play MP3s. What I'd like to do is have an onstarted event when the playback has actually begun but there doesn't seem to be anything in PIXI.sound that I can use this way. Can anyone tell me a way to add an event listener so I can confirm the playback of an audio clip has started. Quote Link to comment Share on other sites More sharing options...
botmaster Posted April 4, 2018 Share Posted April 4, 2018 IE11 doesn't support the WebAudioAPI in most of its versions so I can only guess the PIXI.sound uses a basic html sound playing which is very limited in capabilities and has no events Quote Link to comment Share on other sites More sharing options...
botmaster Posted April 4, 2018 Share Posted April 4, 2018 Yeah I took a brief look at the source, it uses HTMLAudioElement on IE and runs a tick to check where the sound is so it can detect when the sound is done playing and dispatch an event. Now for playing the first time a sound plays the HTMLAudioElement will load it in async so delay can be expected but probably not the second time. There are no event the HTMLAudioElement dispatches when it starts playing so the only way to to it would be to run a tick when play() is called and then dispatch a 'started' event when the position of the sound starts changing. Quote Link to comment Share on other sites More sharing options...
charlie_says Posted April 5, 2018 Author Share Posted April 5, 2018 thanks @botmaster that's all very useful. I did a ticker to check when the mediaelement progress > 0 - and that did work, although as some of the clips are long, the wait was 'uncomfortable' Unfortunately my use case has a lot of audio clips which need to be sequenced (and played alongside a separate video clip). This means I delete them from the cache after use (and they are expected to only be viewed once anyway.) It was working ok, but any network slow down caused it to fail. Ultimately, I've made separate arrangements for IE11. Quote Link to comment Share on other sites More sharing options...
botmaster Posted April 5, 2018 Share Posted April 5, 2018 Both HTMLAudioElement and WebAudioAPI do need to load the entire sound before playing it which with long sound might explain the delay you experience. WebAudioAPI can stream sounds but not out of the box, this has to be implemented in code and I could be wrong but I didn't see such type of code in PIXI.sound but don't take my words for it. If you have exclusive sound needs then when running in IE you have no choice but dropping html and either use plugin technology or not support IE altogether. All my html5 apps are replaced with Flash on IE just because of IE not supporting WebAudioAPI. This will have to do at least for now. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.