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