Dash playlist loader is breaking the `dispose` API
Please do not delete the template, by filling out the required information we can investigate your issue more quickly.
Before opening an issue see if your problem can be resolved with the troubleshooting guide.
Description
Briefly describe the issue. Include a reduced test case, we have a starter template on JSBin you can use.
Sources
Is a certain source or a certain segment affected? please provide a public (accessible over the internet) link to it below.
Steps to reproduce
Explain in detail the exact steps necessary to reproduce the issue.
- Create a new video with Dash source type
- Start the streaming
- Dispose the player
Results
Expected
The video runtime gracefully dispose and clears all timeouts
Error output
After the dispose call you get multiple stacktraces:
video.cjs.js:99 VIDEOJS: ERROR: TypeError: Cannot read property 'buffered' of null
at Html5.<computed> [as buffered] (video.cjs.js:20462)
at MasterPlaylistController.updateDuration (video.cjs.js:43251)
at DashPlaylistLoader.<anonymous> (video.cjs.js:42474)
at DashPlaylistLoader.data.dispatcher (video.cjs.js:1902)
at trigger (video.cjs.js:2038)
at DashPlaylistLoader.EventTarget.trigger (video.cjs.js:2440)
at DashPlaylistLoader.refreshMedia_ (video.cjs.js:37115)
at DashPlaylistLoader.<anonymous> (video.cjs.js:36541)
at DashPlaylistLoader.data.dispatcher (video.cjs.js:1902)
at trigger (video.cjs.js:2038)
Additional Information
When this event is triggered, https://github.com/videojs/http-streaming/blob/master/src/dash-playlist-loader.js#L269
the timeout is renewed again and again https://github.com/videojs/http-streaming/blob/master/src/dash-playlist-loader.js#L818
Please include any additional information necessary here. Including the following:
videojs-http-streaming version
what version of videojs-http-streaming does this occur with? @videojs/[email protected]
videojs version
what version of videojs does this occur with? video.js 7.7.5
Browsers
what browsers are affected? please include browser and version for each Chrome: Version 81.0.4044.138 (Official Build) (64-bit)
Platforms
what platforms are affected? please include operating system and version or device and version for each Mac Os
Other Plugins
are any other videojs plugins being used on the page? If so, please list them with version below. *
Other JavaScript
are you using any other javascript libraries or frameworks on the page? if so please list them below. *
👋 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.
why did you close this issue? i have the same problem and is looking for a solution
Unfortunately, I'm unable to reproduce. @NujiaLin can you create some kind of reduced test case that shows off the issue reliably? Thanks.
I just ran into the same error.
It seems to originate in the ABR code.
There's an interval in there that calls checkABR_ every 250 milliseconds:
this.abrTimer_ = window.setInterval(function () {
return _this2.checkABR_();
}, 250);
My guess is that there's an issue in clearing this timer when the video is disposed (but based on the code I don't see why)
Our quick and dirty fix is to delay the disposal of the player with 500ms:
setTimeout(() => player.current.dispose(), 500);
Hope this helps.
Alternative fix that worked for me: pausing the player, waiting until it is paused, and then disposing of it
const dispose = () => {
if (playerRef.current) {
playerRef.current.dispose();
playerRef.current = undefined;
}
};
if (!playerRef.current.paused()) {
playerRef.current.one('pause', dispose);
playerRef.current.pause();
} else {
dispose();
}