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: 
johnny8ch
Visitor

SOLVED: roAudioPlayer Buffering Delays for Http mp3 streams

So for anyone out there who was running into the problem of the audio player buffer buffering for a ridiculous ( over 5 secs) amount of time i found a solution i think.

basically, just after setting the roPlayer object to play -- then set a negative Seek in milliseconds , i used -180000 for - 3minutes
thats a minus sign - not a dash

so i added the blablabla.Seek( -180000) to the files indicated below:

from the audioapp example file AudioPlayer.brs :
.....
else if newstate = 2 then ' PLAYING
if m.isplaystate = 0
m.audioPlayer.play() ' STOP->START
m.audioPlayer.Seek(-180000)
else
.....

or if your are using the videoplayer example to play audio, in appDetailScreen.brs ( modified according to:
viewtopic.php?p=352494 )
.....
else if button = AUDIO_BUTTON_PLAY()
isPlaying = true
isPaused = false
audio.Play()
audio.Seek(-180000)
show.CurrentPosition = 0
zeroProgressBar(screen, show)
.....

good luck

if anyone know a better way please let me know -- it took me forever to get anything going but this seems to work --
i was getting like 30-60 second delays and after unplugging my router with the stream playing noticed that it was playing
for like 2 minutes -- maybe, roAudioPlayer saves the position in the stream at which you stopped and tries to get back to that
position after you return to the same url ?

if this works for others maybe Roku folks would consider documenting

ps- im not a big forum poster guy so if this is not appropriate please inform me as such and direct accordingly, thx
0 Kudos
5 REPLIES 5
renojim
Community Streaming Expert

Re: SOLVED: roAudioPlayer Buffering Delays for Http mp3 stre

Bless you! I don't know if this is the best first post ever, but it's certainly the most timely. I've been struggling with this problem the whole weekend. For me, it only happens once in a while and often goes away by itself, so it's very hard to try to find some workaround. I'll give this a shot and see how it goes.

It was definitely appropriate for you to post here. The only suggestion I'd make is that the next time you post code, enclose it in "code" tags, then you can get proper formatting and set your code off from the rest of your post:
else if button = AUDIO_BUTTON_PLAY()
isPlaying = true
isPaused = false
audio.Play()
audio.Seek(-180000)
show.CurrentPosition = 0
zeroProgressBar(screen, show)
end if

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
renojim
Community Streaming Expert

Re: SOLVED: roAudioPlayer Buffering Delays for Http mp3 stre

To follow up, this definitely works! Thanks again.

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
bubasknr
Visitor

Re: SOLVED: roAudioPlayer Buffering Delays for Http mp3 stre

sweet thanks so much!
0 Kudos
greubel
Visitor

Re: SOLVED: roAudioPlayer Buffering Delays for Http mp3 stre

Please check this post ! http://forums.roku.com/viewtopic.php?f=34&t=56762
I have 5.1 build 1012
0 Kudos
steco
Visitor

Re: SOLVED: roAudioPlayer Buffering Delays for Http mp3 stre

Hi all

Where do I add the seek to the appvideoscreen.brs file?

This is what my appvideo.brs file looks like

Function showVideoScreen(episode As Object)
if type(episode) <> "roAssociativeArray" then
print "invalid data passed to showVideoScreen"
return -1
endif

port = CreateObject("roMessagePort")
screen = CreateObject("roVideoScreen")
screen.SetMessagePort(port)
screen.Show()
screen.SetContent(episode)
screen.Show()

'Uncomment his line to dump the contents of the episode to be played
'PrintAA(episode)

while true
msg = wait(0, port)

if type(msg) = "roVideoScreenEvent" then
print "showHomeScreen | msg = "; msg.getMessage() " | index = "; msg.GetIndex()
if msg.isScreenClosed()
print "Screen closed"
exit while
elseif msg.isRequestFailed()
print "Video request failure: "; msg.GetIndex(); " " msg.GetData()
elseif msg.isStatusMessage()
print "Video status: "; msg.GetIndex(); " " msg.GetData()
elseif msg.isButtonPressed()
print "Button pressed: "; msg.GetIndex(); " " msg.GetData()
else
print "Unexpected event type: "; msg.GetType()
end if
else
print "Unexpected message class: "; type(msg)
end if
end while
End Function
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.