# Audio progress bar not showing

**URL:** <https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187>\
**Category:** Archived\
**Tags:** roku-developer-program\
**Created:** [December 22, 2011, 6:22pm UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187 "2011-12-22T18:22:51Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![agmark](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@agmark](https://forum.developer.roku.com/u/agmark)\
**Post date:** [December 22, 2011, 6:22pm UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187/1 "2011-12-22T18:22:51Z")

</div>

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.

```auto
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

```

---

<div class="post-metadata">

**Author:** ![RokuJoel](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@RokuJoel](https://forum.developer.roku.com/u/RokuJoel)\
**Post date:** [December 22, 2011, 7:04pm UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187/2 "2011-12-22T19:04:58Z")

</div>

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:

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

```

set the length of the track:

```auto

springboard.setprogressindicator(0,lengthOfTrackInSeconds) 

```

and count how many seconds have passed since the start with

```auto
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

---

<div class="post-metadata">

**Author:** ![agmark](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@agmark](https://forum.developer.roku.com/u/agmark)\
**Post date:** [December 23, 2011, 1:47am UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187/3 "2011-12-23T01:47:53Z")

</div>

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

```auto
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

---

<div class="post-metadata">

**Author:** ![RokuJoel](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@RokuJoel](https://forum.developer.roku.com/u/RokuJoel)\
**Post date:** [December 23, 2011, 4:43pm UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187/4 "2011-12-23T16:43:58Z")

</div>

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

- Joel

---

<div class="post-metadata">

**Author:** ![RokuJoel](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@RokuJoel](https://forum.developer.roku.com/u/RokuJoel)\
**Post date:** [December 23, 2011, 4:52pm UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187/5 "2011-12-23T16:52:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![roquoonewbie](https://avatars.discourse-cdn.com/v4/letter/r/3bc359/32.png) [@roquoonewbie](https://forum.developer.roku.com/u/roquoonewbie)\
**Post date:** [December 28, 2011, 8:57pm UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187/6 "2011-12-28T20:57:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![roquoonewbie](https://avatars.discourse-cdn.com/v4/letter/r/3bc359/32.png) [@roquoonewbie](https://forum.developer.roku.com/u/roquoonewbie)\
**Post date:** [December 28, 2011, 9:33pm UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187/7 "2011-12-28T21:33:48Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![TheEndless](https://avatars.discourse-cdn.com/v4/letter/t/ec9cab/32.png) [@TheEndless](https://forum.developer.roku.com/u/TheEndless)\
**Post date:** [December 28, 2011, 9:41pm UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187/8 "2011-12-28T21:41:10Z")

</div>

> “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.

---

<div class="post-metadata">

**Author:** ![roquoonewbie](https://avatars.discourse-cdn.com/v4/letter/r/3bc359/32.png) [@roquoonewbie](https://forum.developer.roku.com/u/roquoonewbie)\
**Post date:** [December 28, 2011, 10:21pm UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187/9 "2011-12-28T22:21:32Z")

</div>

Page 42/43.

[http://c1807832.cdn.cloudfiles.rackspac … ce\_v28.pdf](http://c1807832.cdn.cloudfiles.rackspacecloud.com/ComponentReference_v28.pdf)

Diagram: roSpringboard audio screen, ContentType=audio

---

<div class="post-metadata">

**Author:** ![TheEndless](https://avatars.discourse-cdn.com/v4/letter/t/ec9cab/32.png) [@TheEndless](https://forum.developer.roku.com/u/TheEndless)\
**Post date:** [December 28, 2011, 10:52pm UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187/10 "2011-12-28T22:52:37Z")

</div>

> “roquoonewbie” wrote:  
> Page 42/43.
> 
> [http://c1807832.cdn.cloudfiles.rackspac … ce\_v28.pdf](http://c1807832.cdn.cloudfiles.rackspacecloud.com/ComponentReference_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.

---

<div class="post-metadata">

**Author:** ![roquoonewbie](https://avatars.discourse-cdn.com/v4/letter/r/3bc359/32.png) [@roquoonewbie](https://forum.developer.roku.com/u/roquoonewbie)\
**Post date:** [December 28, 2011, 11:14pm UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187/11 "2011-12-28T23:14:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![roquoonewbie](https://avatars.discourse-cdn.com/v4/letter/r/3bc359/32.png) [@roquoonewbie](https://forum.developer.roku.com/u/roquoonewbie)\
**Post date:** [December 29, 2011, 10:31pm UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187/12 "2011-12-29T22:31:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![TheEndless](https://avatars.discourse-cdn.com/v4/letter/t/ec9cab/32.png) [@TheEndless](https://forum.developer.roku.com/u/TheEndless)\
**Post date:** [December 29, 2011, 10:45pm UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187/13 "2011-12-29T22:45:47Z")

</div>

> “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.. 😉  
> 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).

---

<div class="post-metadata">

**Author:** ![roquoonewbie](https://avatars.discourse-cdn.com/v4/letter/r/3bc359/32.png) [@roquoonewbie](https://forum.developer.roku.com/u/roquoonewbie)\
**Post date:** [December 30, 2011, 12:20am UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187/14 "2011-12-30T00:20:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![roquoonewbie](https://avatars.discourse-cdn.com/v4/letter/r/3bc359/32.png) [@roquoonewbie](https://forum.developer.roku.com/u/roquoonewbie)\
**Post date:** [December 30, 2011, 12:29am UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187/15 "2011-12-30T00:29:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![destruk](https://avatars.discourse-cdn.com/v4/letter/d/d07c76/32.png) [@destruk](https://forum.developer.roku.com/u/destruk)\
**Post date:** [December 30, 2011, 12:45am UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187/16 "2011-12-30T00:45:41Z")

</div>

would be nice.

---

<div class="post-metadata">

**Author:** ![TheEndless](https://avatars.discourse-cdn.com/v4/letter/t/ec9cab/32.png) [@TheEndless](https://forum.developer.roku.com/u/TheEndless)\
**Post date:** [December 30, 2011, 2:08am UTC](https://forum.developer.roku.com/t/audio-progress-bar-not-showing/2187/17 "2011-12-30T02:08:27Z")

</div>

> “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.
