videojs / video.js

Video.js - open source HTML5 video player
https://videojs.com
Other
37.96k stars 7.44k forks source link

Multiple video players have the probability to throw html5#one exception when they are frequently generated and destroyed #8222

Open v-JialiChen opened 1 year ago

v-JialiChen commented 1 year ago

Description

I encountered an exception event when using video.es.js

I excluded all registered events one by one in my code, the exceptions still exist It looks like the problem comes from video.es

There is a time handler When players dispose, not clear it, there is a certain chance to encounter inactivityTimeout is triggered.

image

image

the tech exists But, tech.eventBusEl_ is null

image image

Reduced test case

No response

Steps to reproduce

  1. Channel Page Menu+Current Channel video List page
  2. The list page can be used to drop down and load more video players. The previous video player will be destroyed after a certain number of simultaneous downloads. 3.When you switch the channel menu, all videos are destroyed and the video list of the new channel is loaded.
  3. Scroll down the page quickly and keep making it load more video player At the same time, you can quickly click on the left menu to switch to other video channel and repeat the previous operation. Observe the console.

There is a chance to see videojs throw an exception error "html5#one" or "t#one"

Errors

Uncaught Error: Invalid target for t#one; must be a DOM node or evented object.","stack":"Error: Invalid target for t#one; must be a DOM node or evented object., Stack: Error: Invalid target for t#one; must be a DOM node or evented object.

What version of Video.js are you using?

7.20.3

Video.js plugins used.

No response

What browser(s) including version(s) does this occur with?

edge 111.0.1661.54 & chrome 111.0.5563.147

What OS(es) and version(s) does this occur with?

windows 11

welcome[bot] commented 1 year ago

👋 Thanks for opening your first issue here! 👋

If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. To help make it easier for us to investigate your issue, please follow the contributing guidelines.

mister-ben commented 1 year ago

That shouldn't be possible, as intervals are cleared on dispose. How are you disposing the players? What page do the steps to reproduce refer to?

mister-ben commented 1 year ago

I wasn't able to make this happen. Do yo uhave a test case?

zorent-zebra commented 5 months ago

@v-JialiChen I had the same issue. Here's how I fixed it:

if (this.player && !this.player.isDisposed()) {
    this.player.dispose();
}
zorent-zebra commented 5 months ago

@mister-ben I'm not a contributor to this repo at all. But maybe a thought is that internally video.js should maybe ignore calls to dispose if it's already disposed. One could argue that this situation represents a user error since a user shouldn't try to dispose when video.js is already disposed. Though it'd make it more user-friendly to have this fix/improvement. Thanks for all the work you do on this project; we benefit from it muchly.