Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tar
Visitor

Scene Graph Audio: returns error after first debug session

Hello everyone,

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.

Steps:
1) Play remote mp3 audio using Audio node https://sdkdocs.roku.com/display/sdkdoc/Audio
2) Quit an app using home button. AUDIO KEEPS PLAYING. How can I avoid this?
3) launch and app again. Or deploy a new build via Eclipse
4) Try to play audio again
5) 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.
0 Kudos
3 REPLIES 3
tar
Visitor

Re: Scene Graph Audio: returns error after first debug session

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.
0 Kudos
tar
Visitor

Re: Scene Graph Audio: returns error after first debug session

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:
1. Don't add MyPlayer to the global Scene or m.global -> Audio stops when leaving MyPlayerScreen, which is not acceptable.

2. Add MyPlayer to the m.global
m.global.addField("myPlayer", "node", false)
m.global.myPlayer = m.myPlayer

Audio does not stop after pressing Home button

2. Add MyPlayer to the m.global.scene child
m.global.scene.AppendChild(m.myPlayer)

Same result. Audio does not stop after pressing Home button.

But I need to access my player globally, and it should play on any screen. How can I achieve that any other way?
0 Kudos
tar
Visitor

Re: Scene Graph Audio: returns error after first debug session

I see the same problem here, with a video node, m.global and pressing a Home button. https://forums.roku.com/viewtopic.php?f=34&t=94201
Any updates on this?
0 Kudos