Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Tuning JWPlayer for real-time broadcasts (RTMP only), tweaking bufferLength doesn't work?

Hi I'm trying to stop JW Player from buffering ANY frames whatsoever. I have done some extensive tweaking on bufferLength and other options. In theory, having a bufferLength of 0 means JWPlayer should render frames as they are received from the server. This does not happen. If I look at the metadata, event.metadata.bufferfill shows a buffer of 1-2 seconds and over the duration of the stream this buffer increases to 10 seconds or more which eventually causes the client to become significantly behind the real-time stream, until they refresh the page to clear the buffer.

Oddly enough when setting a bufferLength to 0.1, event.metadata.bufferfill has a larger value but the stream has a shorter delay and it does not increase over time. Really trying to make sense of this setting here.

My workflow/setup:

Encoder -> Wowza -> live RTMP stream -> JWPlayer client

This is a realtime, broadcast application and I need to minimize delay and make sure JWPlayer does not hold a large buffer of frames. What else can I do? If JWPlayer does not support this kind of tweaking, that would be great to know as well so I can look into other options.

2 Community Answers


JW Player Support Agent  
0 rated :

Hi, there.

My name is Alex and I am one of the Support Engineers at JW Player. I will be more than happy to assist you with your questions.

There is a common misconception about the bufferlength that it will hold the buffer at whatever value you specify, but that is not the case. The value you set for bufferlength will be the amount of buffer the player will build up before beginning playback, whether it be initially, after pausing or when seeking. Depending on the viewer’s connection, the buffer will definitely fill to be larger than the value that you specify with this option.

I set up a test page in which this is demonstrated. I embedded a live RTMP stream and set bufferlength: 0.1. Then, whenever metadata is broadcast by the stream, it outputs the current value of e.metadata.bufferfill to the browser’s console. When the playback begins, the player will also broadcast “Playback began with a buffer of XX seconds.” to the console, where XX is the current bufferfill value. Looking at the console, you will see that as soon as the player has any buffer whatsoever, the playback will begin. This may not necessarily be at 0.1 seconds of buffer and most likely it won’t ever be that small. On my various tests, it’s been ranging between 1 and 2.5 seconds.

With that being said, I am seeing some odd differences of behavior depending on whether or not you set the bufferlength to 0.1 (which we say is the lowest value) or 0. When I set it to 0, the console will list several bufferfill values less than 1 but only start playback when the buffer reaches one second or so. So, I’m curious of two things – (1) why isn’t the console logging the bufferfills less than 1 second when setting bufferlength: 0.1 and (2) theoretically, having bufferlength: 0 should mean that the playback should start as soon as there is any buffer whatsoever, or at least I would think.

I’m going to have to escalate this to our Engineering team to see what they say. As soon as I hear back, I will let you know.


JW Player Support Agent  
0 rated :


In looking at this further, I believe I was incorrect in trying to record the buffer available when the .on(‘firstFrame’) event fires because the bufferlength setting would result in the playback beginning when a certain buffer reached. So, I changed this behavior on the test page with the bufferlength set 0.1 and it is now showing that playback is beginning a lot quicker than previously described.

Please let me know if you need any more help or have any other questions.

Thank you!

This question has received the maximum number of answers.