-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"play" event fired twice in playing a stream #899
Comments
Not sure if it's a known issue but I confirmed that setting "autoplay" to |
Hmm, jmo84, I tried your jsfiddle page and the music played, but I didn't see the console messages appear. Do I need to click on something else to see them? |
I faced the same issue and spend some time to debug it and it seems to be a bug is code. What you try to do is autoplay. in other words you create Howl object and after that execute play method - no interaction between. What happens in that scenario, howler caches all actions in _queue variable and starts processing queue when canplaythrough event occurs. However in play for HTML5 there is manual execution of processing queue then promise from browser play resolves. There are 2 possible ways to solving that issue:
BTW. when you use autoplay it will trigger event twice as well :-) |
@tbessie The log messages show for me in IE11, Chrome, Firefox, and Safari...but IE11 and Safari do not show duplicate play messages, just one. What browser are you using? |
@jmo84 I'm using the latest version of Chrome on Windows 7 x64. I'll try again a bit later on another computer and see if it works. I am running some plugins that might be getting in the way. |
@jmo84 Ah, sorry - I had thought that jfiddle would show me console output onscreen, not in the usual browser console. I see it now, thanks! I also see that we get an "end" event. In my code, I never get an "end" even either (I've created a separate ticket for that). |
@tbessie No problem. That is strange you are not getting the "end" event emitted. |
@jmo84 I subscribe to all the events before I call play(). It's still not being called for some reason. |
I found out what the issue is; if the file (webm/opus in this case) doesn't contain any duration information, I never get the "end" event. If it does, I do. This leads me to believe that Howler is using the duration information in the audio file header to determine when the audio ends, as opposed to when it reaches the end of file/buffers. This isn't the best way of determining this. I'll mention this in the other ticket. |
Thanks for spotting this, it should now be fixed on master. |
I'm using Howler for the first time, as I need to be able to stream audio from a server and have it start playback immediately, even with large sound files.
I've added all of the available event callbacks to monitor what's happening. Here's a simplified version of what I'm doing:
I get the "playing!" message twice. Is this a known issue?
The text was updated successfully, but these errors were encountered: