videojs / videojs-contrib-hls

HLS library for video.js
http://videojs.github.io/videojs-contrib-hls/
Other
2.84k stars 791 forks source link

InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable #1411

Closed cf23318 closed 6 years ago

cf23318 commented 6 years ago

Description

firefox 59.0.2 (64 位) 出现错误,无法加载视频 http://jsbin.com/rafidev/edit?html,output

Error output

InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable

videojs-contrib-hls version

"videojs-contrib-hls": "^5.14.1",

videojs version

"video.js": "^6.7.3",

Browsers

firefox 59.0.2 (64 位)

Platforms

windows 10 64位 企业版

savroff commented 6 years ago

@cf23318 hey if you tried to load new src dynamically, then you should do player.reset() first. Then this error will not appear again

wowcut commented 5 years ago

I am getting this error not with setting a new src dynamically, so I am not replacing an old src, but with the initial use of player.src. I have basically just this code:

var video = videojs(player_element, player_options).ready(function(){
  player = this;
  player.src([array with multiple sources...]);
 }); // player ready

and this error is triggered.

I would like to ask for reopening this issue, as this is not resolved.

Question: where should I put the player.reset() call? I put it just before player.src but the error still occurs.

Some more details:

This error occurs not with this url: http://d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8

But it happens with a live stream url - in this case generated by a wowza server. The stream plays fine in VLC and Chromium, even with IE11 - this error only shows up in Firefox.

BTW the stream sometimes plays and sometimes not (just Firefox) - the error is printed to console every time, but the stream does not play always - not playing the stream we see the spinner and no chunks are loaded. There seems to be some randomness involved - however, the error is always there, even when the stream is playing.

wowcut commented 5 years ago

This same error also happens with videojs-7.3.0 I just checked.

Snowbell92 commented 5 years ago

I am getting the same error too, in live streams. The only difference is that I have a pre-roll ad, and the stream does not autoplay if ad is skipped or finished. the error is present in the console every time, but my stream also plays just fine.

My code is almost identical to @wowcut , so not posting it here.

Note: I am using the updated videojs-http-streaming plugin and videojs 6.8.0.