Reputation:
Im trying to play a HLS using VideoJS. Basically the stream itself is working fine but it seems that the buffer size is to small and the video lags every couple of seconds/minutes for 1-2 sec. Is there any way to increase the actual size of segemnts preloaded? Currently I have VideoJS implemented like so:
...
<div class="container-fluid">
<div class="row">
<div class="player-center">
<video-js autoplay id=player class="vjs-fluid" controls="true">
<source src="{{ playlist_url }}" type="application/x-mpegURL">
</video-js>
<script src="{% static 'videojs_old/video.js' %}"></script>
<script src="{% static 'videojs_old/videojs-http-streaming.js' %}"></script>
<script>
videojs.Vhs.xhr.beforeRequest = function(options) {
options.headers = options.headers || {};
options.headers.Authorization = "{{ access_token }}";
console.log('options', options)
return options;
};
var player = videojs('player',
{fill: false},
{autoplay: true},
{responsive: true},
{fluid: true},
{GOAL_BUFFER_LENGTH: 100},
{CMAX_GOAL_BUFFER_LENGTH: 150},
{preload: "auto"});
player.play();
</script>
</div>
</div>
</div>
But it seems that GOAL_BUFFER_LENGTH nor CMAX_GOAL_BUFFER_LENGTH has any effect.
Upvotes: 0
Views: 3598
Reputation: 7821
The constants are not player level options. Also you can pass only one options object.
videojs.Vhs.GOAL_BUFFER_LENGTH = 100;
videojs.Vhs.MAX_GOAL_BUFFER_LENGTH = 150;
var player = videojs('player', {
fill: false,
autoplay: true,
responsive: true,
fluid: true,
preload: "auto"
});
Upvotes: 1