zcode7
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2012
05:49 PM
Playlists
Just a quick issue - there is no example of how to make your content into playlists.
Specifically, if I want to make a list of on-screen MP3s play one after the other, is there a built-in functionality to do this?
I also want to integrate a "next" button, is this functionality built into the audio player? The documentation doesn't really say anything about that.
Specifically, if I want to make a list of on-screen MP3s play one after the other, is there a built-in functionality to do this?
I also want to integrate a "next" button, is this functionality built into the audio player? The documentation doesn't really say anything about that.
4 REPLIES 4

RokuJoel
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2012
10:14 AM
Re: Playlists
Playlists are built into the roAudioplayer component. Implementing a next button is the discretion of the developer.
A quick playlist:
To implement a next button, I'm assuming you are using an roSpringboardScreen, and you would add a button with the addbutton method, and implement an if-then to handle when that button is pressed, in which case you would use the setnext() property, and call play()
- Joel
A quick playlist:
sub main()
audioplayer=createobject("roaudioplayer")
playlist=[{url:"http://myserver.com/song1.mp3",streamformat:"mp3"}
{url:"http://myserver.com/song2.mp3",streamformat:"mp3"}
{url:"http://myserver.com/song3.m4a",streamformat:"mp4"}]
audioplayer.setcontentlist(playlist)
audioplayer.setnext(0)
audioplayer.play()
while true
'loop forever for this example, in the real world you would be checking the message port and tracking current song etc.
end while
end sub
To implement a next button, I'm assuming you are using an roSpringboardScreen, and you would add a button with the addbutton method, and implement an if-then to handle when that button is pressed, in which case you would use the setnext() property, and call play()
- Joel
zcode7
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2012
12:44 PM
Re: Playlists
Hey Joel - thanks for the help there. I'm trying to just have a function that goes to the next content item - doesn't the app already know what content item I'm currently on? How do I retrieve this information and use it in setNext? When I use Play() does it play the current item or always play the item that is "set Next"?

RokuJoel
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2012
02:48 PM
Re: Playlists
You need to keep track of this in a separate variable, so when you create a playlist and initiate playback, lets say you start from the second item in the playlist because you don't like the first two songs, you would set your index variable to 1 since lists are arrays which are zero indexed where the first item in the list is list[0]. When you get an roAudioPlayerEvent that indicates the end of playback isrequestsucceeded() I think is the event, then you would increment your index, so you would know which song you are on.
I believe it will use whatever you setnext()
- Joel
I believe it will use whatever you setnext()
- Joel
kasiris
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2021
06:19 PM
Re: Playlists how to change data feed location?
How do I change the data feed from playlist=url:http://myserver
to my webhost url (example: http://www.myhost.com/a.json)?