Audio progress bar not showing

I’ve tried about every idea I can come up with to have a Springboard screen display a ProgressIndicator when I add an AudioPlayer, but I’m not getting something right. The screen displays the “audio” style when I add the SetDescriptionStyle (“audio”) and I have the ContentType = “audio” along with the setProgressIndicatorEnabled(true). I’ve been hacking the following relevant code. Can you see anything that prevents the progress bar from being displayed.

springBoard = CreateObject("roSpringboardScreen")
				springBoard.SetBreadcrumbText("Breadcrumb Text","")
				port = CreateObject("roMessagePort")
				springBoard.SetMessagePort(port)
				springBoard.SetDescriptionStyle("audio")
				springBoard.setProgressIndicatorEnabled(true)
				springBoard.setProgressIndicator(0, 1)
				springboard.AllowUpdates(true)
				springBoard.Show()
										
					audioPlayer = CreateObject("roAudioPlayer") 	
					port = CreateObject("roMessagePort") 		
					audioPlayer.SetMessagePort(port)
						
					song = CreateObject("roAssociativeArray")
					song.url = "http://www.my.music.com/song.mp3
					song.ContentType = "audio"
					song.Title = "Title"
					song.Artist = "Artist"
					song.Album = "Album"
					song.HDPosterUrl = "pkg:/images/test_188x188.png"
					song.SDPosterUrl = ""
					springBoard.SetContent(song) 'adds song
					audioplayer.addcontent(song) 
					audioplayer.setloop(false)				
					audioplayer.play()
					springBoard.Show()
						while true
						msg = wait(0, port)
						if type(msg) = "roAudioPlayerEvent"
						if msg.isStatusMessage() then
						print "roAudioPlayerEvent: "; msg.getmessage()
						if msg.getmessage() = "end of playlist" return
						endif
						endif
						end while

Hi,

you need to update the first parameter of the progress indicator with the amount of time passed. (0,1) indicates your content is one second long, which is unlikely, so you need to set a timer with roTimeSpan:

timer=createobject("rotimespan")
timer.mark()

set the length of the track:


springboard.setprogressindicator(0,lengthOfTrackInSeconds) 

and count how many seconds have passed since the start with

springBoard.setProgressIndicator(timer.totalseconds(), LengthofTrackInSeconds)

note that LengthOfTrackInSeconds is just an arbitrary name, use whatever variable you have for the actual length of the track.

You might want to listen for the status message “start of play” before displaying and updating your progress indicator, so that it is more accurate.

  • Joel

Thanks Joel. I’m still missing something here. As a test, I changed the setprogressindicator to:

springboard.setProgressIndicator(0,10000)

just to see if the indicator would display and I’m not getting it to even show up. I tried changing the first variable to simulate the track in progress and it makes no difference. I’ve tried making a few changes and still nothing. Anything else you can see?
Mark

what if you set the progress indicator to (100,1000) do you see anything?

  • Joel

Also, you need to set your msg=wait(0,port) to a number higher than 0, like msg=wait(100,port) or nothing will update because your program will stop and wait for input, so it can’t possibly update the screen.

  • Joel

I am having this same exact issue. Is there a sample app that demonstrates an roAudioPlayer which shows the progress bar? I cannot find one anywhere.

Also, where is the progress bar supposed to appear? In different SDK docments, it shows it in different places. The ComponentReference.pdf shows the progress bar at the bottom of the screen. But the MockUpTool.pptx shows the progress bar right below the poster image.

This would imply one could configure the screen to do one or the other, but I see no such option. So where would/should it appear given this?

“roquoonewbie” wrote:
Also, where is the progress bar supposed to appear? In different SDK docments, it shows it in different places. The ComponentReference.pdf shows the progress bar at the bottom of the screen. But the MockUpTool.pptx shows the progress bar right below the poster image.

This would imply one could configure the screen to do one or the other, but I see no such option. So where would/should it appear given this?
I’m not sure what you’re looking at in the component reference, but the progress bar for audio shows under the poster/icon on the roSpringboardScreen. Only the roVideoScreen has a progress bar at the bottom of the screen.

Page 42/43.

http://c1807832.cdn.cloudfiles.rackspac … ce_v28.pdf

Diagram: roSpringboard audio screen, ContentType=audio

“roquoonewbie” wrote:
Page 42/43.

http://c1807832.cdn.cloudfiles.rackspac … ce_v28.pdf

Diagram: roSpringboard audio screen, ContentType=audio
Interesting. I never noticed that before. I’m pretty sure it’s an error in the mock-up. The progress bar is definitely under the poster.

OK, thanks for the clarification. So is there any sample app that shows the progress bar?

Even the audio player sample app in the sdk has no progress bar. And I am at a loss how to get it to show.

Still no love here? Does anyone have a single functioning example of an audio player app that shows a progress bar? Googling around seems to bring up nothing but this thread about it not showing for others.

Also, how do you get the current playback position of the audio player (to update the progress bar via the SetProgressIndicator method)? The videoplayer object exposes the position to Brightscript. But I don’t see how the audioplayer does the same. So how would the application know what the correct position is? Keeping a timer wil be very inaccurate and error prone (through pauses/resumes/buffers, etc), so I assume there must be a way to query the player to get the correct position at any given time?

“roquoonewbie” wrote:
Keeping a timer wil be very inaccurate and error prone (through pauses/resumes/buffers, etc), so I assume there must be a way to query the player to get the correct position at any given time?
Bad assumption.. :wink:
There have been a couple of discussions about it in the past. Your best bet is probably to use a “timer” roTimespan and a “playingTime” Integer to track the seconds during playback. Mark() the “timer” at the start of play, then store the elapsed seconds (additive) in “playingTime” any time you enter a pause or buffer state, then re-Mark() on resume. If playing, your elapsed time (the time you pass to SetProgressIndicator) would be playingTime + timer.TotalSeconds(). If paused, your elapsed time would simply be playingTime.

Does that make sense?

As for showing the progress bar, make sure your contentType is “audio” and you call SetProgressIndicatorEnabled(True).

Mystery solved. Apparently if you do a SetPosterStyle on an audio springboard, it overrides the setting to include the progress bar.

So the answer is…to get a progress bar to show, don’t call SetPosterStyle. Strange that these two things affect each other.

Regarding your timer suggestion, how does one know when the audioPlayer goes into a buffer state? I see no such event/state.

Seems really silly that you can’t just tell the screen to show the bar and let it manage the playhead position/updates.

The player is aware of the duration and the position, so I don’t see why hacking a separate timer in the script is required here when the sub-system can do this all.

would be nice.

“roquoonewbie” wrote:
Regarding your timer suggestion, how does one know when the audioPlayer goes into a buffer state? I see no such event/state.
isStatusMessage(), look for “startup progress”.

“roquoonewbie” wrote:
Seems really silly that you can’t just tell the screen to show the bar and let it manage the playhead position/updates.

The player is aware of the duration and the position, so I don’t see why hacking a separate timer in the script is required here when the sub-system can do this all.
That, my good man, is a fine question… one that you’ll have to ask Roku. I suspect it’s related to the same reason you can’t call Seek() on MP3 files, which is also a mystery.