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

Is there a way to set the amount buffered?

It looks like once a stream starts, it will buffer until the buffer is full (I think 64mb). Is there a way to tell it buffer a specific amount i.e. 2 sec or 200KB or something else?
0 Kudos
8 REPLIES 8
danstl
Visitor

Re: Is there a way to set the amount buffered?

I think if were to hard code the bitrate of the stream this may help... Otherwise my guess is the roku will buffer "worst case".

StreamBitrates
roArray
Array of bitrates in kbps for content streams
[384, 500, 1000, 1500]

But im not sure if this is supported when doing audio...
Model: 2050X - wired
S/N: J0A07F000104
Location: St. Louis, MO
ISP: At&t 12Mb (primary) -- Charter 20Mb (secondary)
0 Kudos
buaboo
Visitor

Re: Is there a way to set the amount buffered?

Thank you
Not being a programmer, I was hoping that I could do something to the audiosample code that is provided in the SDK. I will chat with a programmer friend to see if he can help.

As a simple alternative, I was thinking I could look at the sample code and create an extra button which would be flush buffer. When you click this, I could execute Stop stream followed by play stream which would flush the buffer. Not sure how hard that would be, but I am hoping that since code for various buttons is already there, I should be able to just copy snipets of code to make it work.. wishful thinking I am sure.. 🙂

Thank you again for the response. I appreciate it..

"danstl" wrote:
I think if were to hard code the bitrate of the stream this may help... Otherwise my guess is the roku will buffer "worst case".

StreamBitrates
roArray
Array of bitrates in kbps for content streams
[384, 500, 1000, 1500]

But im not sure if this is supported when doing audio...
0 Kudos
RokuMarkn
Visitor

Re: Is there a way to set the amount buffered?

It doesn't buffer 64MB at the start of the stream. It only buffers the amount that it calculates that it needs to buffer, based on the bandwidth of the stream and the recent network bandwidth. It would not be a good idea to try to override this calculation, since that might cause increased rebuffers for the customers.

--Mark
0 Kudos
dupondt
Channel Surfer

Re: Is there a way to set the amount buffered?

Mark,

It only buffers the amount that it calculates that it needs to buffer, based on the bandwidth of the stream and the recent network bandwidth.


in this case it might be time to revise the algorithm 😉

SoundBridge M1001 and M1000 • Clint L1 (retired) • DNT IP-dio (retired)
Google Chromecast • Amazon Fire TV • Amazon Echo and Echo Dot
0 Kudos
buaboo
Visitor

Re: Is there a way to set the amount buffered?

Thank you for linking this back to the other thread 🙂

For clarification, I don't know how buffering works for netflix/amazon/etc. I just know that when I do the Squeezecenter stream, it seems to buffer about 64mb of stuff.

I also just tried this with pandora, and if I disconnect the ethernet, it looks like it plays the remaining song but not the next song.. I assume because pandora only gives out 1 song at a time..

Anyway, buffering overall is a great thing but for my application, it becomes a problem.

Thank you again for the help!!!

"dupondt" wrote:
Mark,

It only buffers the amount that it calculates that it needs to buffer, based on the bandwidth of the stream and the recent network bandwidth.

in this case it might be time to revise the algorithm 😉

Buaboo is talking of audio-only streams, and according to his posts in this thread[/url:2mctimun] the Netflix/Amazon Wonderbox-Thingy (TM alanmc) seems to fill the entire ...


0 Kudos
RokuMarkn
Visitor

Re: Is there a way to set the amount buffered?

Well, I can't tell exactly what's happening without more information. Obviously Pandora and other audio streams start up almost instantly and don't do a lot of pre buffering. I've seen cases like this caused by the script passing an invalid value for the stream bandwidth. That's the first thing I'd check.

--Mark
0 Kudos
buaboo
Visitor

Re: Is there a way to set the amount buffered?

Here is my complete setup...

I have on a PC running Squeezecenter Server. This server streams stuff using http://ipaddress:9000/stream.mp3.

. So when a audio device executes that url, it gets an enter in squeezecenter server and it starts to stream mp3s. The wat you control what is being sent to audio device (Roku in this case), is to use a laptop or other device (in my case a palmtx which has wifi), and go to url 

http://ipaddress:9000.

. The url will show you the squeezecenter and all the devices it linked to at the moment. You can click on a device on your browser and you have a nifty way to search your collection and then you say play that album or whatever on that device. Once you click the play button, your selection gets put on the stream.mp3 url referenced above.

So, in my case, what is happening is, Roku connects to Squeezecenter server just fine, I can start playing my selection just fine, but what I noticed, is that while the Roku is playing a particular song, it is also download about 64mb (I think) of content. So essentially, after a couple of mins of starting the stream, I could turn of my squeeze center PC and roku could care less.. It will keep playing I assume until the buffer runs dry.

Overall, this is a GREAT thing, however, the issue comes in when, while listening to let's say ACDC music, I want to switch to Phil Colins. Since the so much music is buffered, Phil won't start playing for essentially 35 to 40 mins. This is why I would like to limit the buffering.

The easy answer right now is in the sample audio application, there is a stop play button, so in my example, I start the phil stream while acdc is playing, then I hit stop then play which flushes the buffer and restarts the buffer.. I lose a little of the first song but who cares, its only phil 🙂

Anyway, I hope that makes sense... I am sure noone else likes my setup, but I have gotten used to it based on some other media devices I have.

BTW, if I execute that steam.mp3 url in winamp or mediaplayer on a laptop, it doesn't seem to buffer, so when I change what I want to play, it nearly immediate switch the song on my laptop.

Thank you for the help... I wish I was more of a pgmr to better understand some of the advice and provide the level detail you need.

Let me know if I can explain my setup further...

thx

Edit: In case I haven't said it before, I am using the sample Audio/mp3.brs to test with...


"RokuMarkn" wrote:
Well, I can't tell exactly what's happening without more information. Obviously Pandora and other audio streams start up almost instantly and don't do a lot of pre buffering. I've seen cases like this caused by the script passing an invalid value for the stream bandwidth. That's the first thing I'd check.

--Mark
0 Kudos
buaboo
Visitor

Re: Is there a way to set the amount buffered?

I figured out how to create a Flush Buffer button so, now when I start a new "stream", I can hit Flush buffer, which does a stop and play and the new "stream" starts playing.. I lose the first few seconds, but oh well...

If anyone figures out a way to control the buffering, please let me know...

thx
0 Kudos