I am experiencing the next problem:
Audio always returns an error after first debug session.
Currently I have to reboot my Roku every time I need to test audio player.
Quit an app using home button. AUDIO KEEPS PLAYING. How can I avoid this?
launch and app again. Or deploy a new build via Eclipse
Try to play audio again
Audio state is “stopped” and then “error”. And errorMessage is invalid. Error code is 0.
Why audio is still playing when I quit an app? In which case it is even possible?
How can I “reset” an Audio so it does not fail and works just like after reboot?
Any help would be appreciated.
EDIT: I can’t reproduce it on the original “AudioExample” from docs. So something is wrong with my code, which is actually based on that sample.
Solved this problem by fixing main.brs code in my project. I am really not sure what was causing an error, but I hope no one would ever experience this.
My “ShowFirstScreen” function in main file was set to a field of associativeArray (which is copied to the SceneGraph thread), and was called from there. Also it was a Function with a return value, and not a Sub.
I’ve removed all that mess, just calling a sub directly, and now it works like a charm.
So the problem is the next: if a node that contains Audio is being added to the m.global directly or as a child of other node in m.global - then it will never stop playing even if Home button is pressed.
My setup is:
MyPlayer (Group) - > Audio Node
MyPlayerScreen (Group) - > MyPlayer (initialized once, set to global, taken from global after next screen initialization)
Cases:
Don’t add MyPlayer to the global Scene or m.global → Audio stops when leaving MyPlayerScreen, which is not acceptable.