Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
onevoisses
Level 8

Stop An audio player,Simple audioplayer example,no spring or

I have this simple audio player, I want to be able to stop the player without waiting until it reaches the end of the playlist
Page 89 of the component reference manual

This player do not have a springboard or detail screen.it just play once its selected.Now can anybody suggest how to stop it ."plain old make it shut up."


while true
msg = wait(0, port)
if type(msg) = "roAudioPlayerEvent"
if msg.isStatusMessage() then
'print "roAudioPlayerEvent: "; msg.getmessage()
print "playaudio | msg = "; msg.GetMessage() " | index = "; msg.GetIndex()
if msg.getmessage() = "end of playlist" return -1
else if type(msg)="roPosterScreenEvent" then
audioPlayer.stop ()
'return do not stop the player,it has to have some value
return -2
end if
end if
end while
End Sub
Channel: Goaheadmission
O/S : Linux
Home media: MYTHROKUPLAYER With Homerun
0 Kudos
6 REPLIES 6\
RokuJoel
Roku Employee
Roku Employee

Re: Stop An audio player,Simple audioplayer example,no sprin

assuming the audioplayer object is created in that same function and that it's name is audioplayer, audioplayer.stop() should stop it, as should exiting the function in which the audioplayer was created.

However, you might try this:

if type(msg)="roPosterScreenEvent" then
if msg.isscreenclosed() then
audioplayer.stop()
return -2
end if
end if
0 Kudos
onevoisses
Level 8

Re: Stop An audio player,Simple audioplayer example,no sprin

I tried
if I put it at the front of the audioplayerevent like this

if type(msg)="roPosterScreenEvent" then
if msg.isscreenclosed() then
audioplayer.stop()
return -2
else if type(msg) = "roAudioPlayerEvent"
blah blah blah

it close the screen and say that the user interrup the stream


but here is my thoughts,I need to be able to catch the event that the user has pressed a key.that way I can stop the player
so I tried these events and print them to the console
isButtonPressed()
isRemoteKeyPressed()
isListItemSelected()
and
isListSelected()
the console do not show anything but the remote move as I said the home button works on the remote to put the screen ,just that i cannot catch the events of the left,right and back keys.

here is the last line of the stream

playaudio | msg = start of play | index = 0
Channel: Goaheadmission
O/S : Linux
Home media: MYTHROKUPLAYER With Homerun
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: Stop An audio player,Simple audioplayer example,no sprin

Within the context of a roPosterScreen, left and right will raise an isListItemFocused() event and back will raise an isScreenClosed() event.

In terms of consistent interface and best practice, I'd recommend displaying a roSpringboardScreen when playing audio.
0 Kudos
onevoisses
Level 8

Re: Stop An audio player,Simple audioplayer example,no sprin

"RokuChris" wrote:
Within the context of a roPosterScreen, left and right will raise an isListItemFocused() event and back will raise an isScreenClosed() event.

In terms of consistent interface and best practice, I'd recommend displaying a roSpringboardScreen when playing audio.


oops more work.
I definitely concur with you on the "consistent" part,however,based on the feedback I was getting that since the audio is life stream,having a button that say stop and resume did not make sense,since you actually cannot "resume a live" feed per se.

I think I can hack back in the springboard for the audio,it will make it much easier to stop and move to the other screen.but I hope you had a look at link I "P.M." you and look at the livefeed video.it work fine.Do I have to put it through a springboard screen too?

The live video in the xml is for outside broadcast.
Channel: Goaheadmission
O/S : Linux
Home media: MYTHROKUPLAYER With Homerun
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: Stop An audio player,Simple audioplayer example,no sprin

You can't resume a live stream, but the user should still have a visual experience that communicates to them that they are dealing with a single piece of content rather than a collection of content like they see on a poster screen. A springboard also lets you display more detailed information about the content to the user. Many live audio channels have a springboard button that toggles between Play/Stop rather than Pause/Resume.

In the case of video, a springboard is more of an interstitial screen. The video itself plays in a roVideoScreen, so it has its own dedicated interface which is familiar to the user. The springboard is not necessary with video unless you want to use it to display detailed information about the content to the user.
0 Kudos
onevoisses
Level 8

Re: Stop An audio player,Simple audioplayer example,no sprin

"RokuChris" wrote:
Many live audio channels have a springboard button that toggles between Play/Stop rather than Pause/Resume.

Thanks for your insights,I notice that when I start looking at the sprindboard that I could change the description so I am on to it.

"RokuChris" wrote:
The springboard is not necessary with video unless you want to use it to display detailed information about the content to the user.
and
"RokuChris" wrote:
The video itself plays in a roVideoScreen
when I was putting in the audio player,i made a note about the audioscreen missing.

So thanks it gave me a Greater insight.Stayed tuned my sleeves are up,my coffee is brewing and I am at work.let you know soon.
Channel: Goaheadmission
O/S : Linux
Home media: MYTHROKUPLAYER With Homerun
0 Kudos