Get this error if I reload a page with a live stream on it.
Uncaught InvalidStateError: MediaSource.addSeekableRange() can only be invoked when the duration is Infinity
I get the error when I reload the page on which I have a videojs player with a live stream HLS source. The duration IS Infinity, but this error is still thrown. Does not appear to happen on the first load of the live stream page, only after a page refresh.
After digging and debugging a bit, it turns out that when that error is thrown the player isn't initialized yet. Apparently, whatever is leaving it in that uninitialized state can be forced to complete initialization by calling play().
So, the work around for when this happens is to call play() before the player.ready() function is invoked.
Try player.load() instead.
That was the first thing we tried a long time ago. No effect. The only thing we've found that causes it to fire .ready is to play()
Hi!
Can you please elaborate on how to fix it exactly. Some code may be?
Thanks id advance.
MRamirez
For me, adding in the src call and the play call after making sure videojs was ready worked. E.g my code now looks like:
this.brightcovePlayer = videojs(this.video).ready( () => {
this.brightcovePlayer.src({
src: program.high_res,
type: 'application/x-mpegURL'
});
this.brightcovePlayer.play();
});