-
Notifications
You must be signed in to change notification settings - Fork 85
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
AudioPlayer Stop() and SkipToNextTrack() broken? #3
Comments
I recently changed the default behavior so that decoders are no longer automatically opened when they are created. There is a static method in AudioDecoder that can be used to set whether or not decoders should be automatically opened, or they can be opened by calling Open() directly. I think that your first problem scenario could be resolved by calling Open() before you enqueue the decoder. I'll have to investigate the second scenario a little bit more. |
Thanks for the reply. Calling |
This is not totally unexpected behavior, because if the decoding thread hasn't had time to begin decoding before you call Play() the player will automatically stop itself. This behavior is not ideal, but since I don't want to lock the player for an indeterminate amount of time in Enqueue() it's the compromise I made. One way around this is to add a decoding started callback to your decoder, and call Play() when that callback is invoked. This will ensure that the player will have audio and that it won't stop itself. |
This does work, but there's a minor problem. The rendering started callback is actually never called unless EDIT: After further testing, it seems that the issue is still there even with this workaround |
You need to add a decoding started callback. The decoding started callback is called once the decoding thread begins decoding the audio. It will be called regardless of the player's state after a track has been enqueued. |
Thanks Stephen, I got mixed up between the rendering and decoding callbacks. This works great, thank you. |
This is something I had working before (a long time ago), but it seems to have broken in a recent commit. First of all, here's the code I'm using to enqueue songs:
I adapted it directly from the examples, so I think it should be alright. Here's the first problem scenario
Play()
---> song plays fineStop()
, and thenClearQueuedDecoders()
Play()
---> no audio but there are no errors eitherSecond problem scenario:
Play()
---> first song starts playingSkipToNextTrack()
---> second song should start playing, but nothing happens (no audio)As mentioned earlier, this is code that worked fine before, so I'm guessing something must've broken recently.
The text was updated successfully, but these errors were encountered: