0
votes

i'am trying to play a RTMP stream with low latency uinsg HTML5, vido.js and videojs-flash. For now i can get the stream to display with a 3-4 seconds latency but playing the same stream with ffplay gives a sub-second latency.

Looking at older videojs version it seems that some code that allowed to specify flashvars to be passed to the swf object were never merged. In newer video.js version, one can use the videojs-flash plugin to play a flash video and this plugin seems to support flashVars in the player options and this vars are passed to the swf object.

Did anyone used this feature and how can i provide the flashVars option to the videojs object .

This is the code i tried so far :

var player = videojs('my-video', {
 autoplay: true,
 muted: true,
 preload: "auto",
 sources: [{
    type: "rtmp/flv",
 }],
 flashVars: {
    buffertime: 0
 }
});
1

1 Answers

0
votes

if found an answer to my own question that reduces the latency quite a lot. It's not very stable for now since i sometimes get ~1s latency but can go up to 3s. The solution is to use a patched swf that will interpre take into account the buffering options. Now the player initialization becomes:

var player = videojs('my-video', {
  techOrder: ['flash'],
  autoplay: true,
  sources: [{
  type: "rtmp/flv",
}],
bufferTime: 0,
flash: {
  swf: "js/video-js.swf",
  flashVars: {
    bufferTime: 0,
    autoPlay: true,
    bufferTimeMax: 0.25
  }
}
});

the video-js.swf is compiled from the patched version at :

https://github.com/sea-kg/video-js-swf.git

Just compile this version and use the "swf:" flash option to provide the path to this swf.

This reduces the latency significantly but in my experience, the latency can vary per connection.