-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dispose of player does not stop tracking current time #1431
Comments
@dmlap can you take a look at this? |
@apptv: your fix will cause multiple players in the same page to overwrite existing interval handlers as they're initialized. I suspect it's working in your case because you're creating your HTML5 player after the YouTube player is initialized and that's incidentally cleaning up the YouTube tech's intervals. The MediaTechController prototype is a page-level singleton so it's probably not the right scope for player-level state. I would say that the problem is the YouTube tech invokes its superclass init() before setting up its |
Make sure time and progress event synthesis is turned off after the tech is disposed.For videojs#1431.
@dmlap: Thank you for the quick and deep analysis. It's totally clear to me that putting instance data into the prototype is not a solution. It was only intended to provide you a hint and a more complete bug report. Sure the youtube tech has to fix this issue, but nevertheless I think there should be a kind of exception handling inside of the MediaTechController in case the vdata node is not existing anymore for what reason ever. In that case the interval should be cleared avoiding infinite loops of exceptions. |
Sorry, I didn't mean to seem dismissive of the workaround. I was in "report the facts"-mode :) I think you have a point about the error behavior when vdata is missing. If it's safe to automatically clean them up when we discover they're gone, I'd be all for it. Can you think of a reason that wouldn't work, @heff? |
Once the youtube issue is fixed, what other specific cases might trigger that error? I don't love the idea of catching unknown errors, which would hide them from us an potentially make it harder to debug things. Assuming that's what's being described here. |
In case you remove the player with dom operation like a one page app.
The timer keeps running forever leaking cpu and memory which is especially bad for mobile devices. I totally agree that it should not be hidden. A warning message in the console indicating that something has gone wrong disposing the player should be sufficient and then stop the timer not leaking cpu and memory. |
That makes sense, but sounds like a slightly different scenario. Could we set up a reduced test case to reproduce that (jsbin)? The original issue has to do with the element not existing anymore, but if you just do $.remove the player instance will still exist and should still have a reference to the element, preventing the browser from cleaning it up. So there might be something different we have to do to fix the issue of the timers still running after removing the player el. Otherwise, for the vdata error, I'm wondering if there's another we can know that the player's been destroyed before we try to trigger the timeupdate. We could probably just check that the player el still exists. |
Yes you are right. I think these are 2 seperate issues.
The fix proposed in
has no effect, even if set on the very first line. My feeling is that the timers are still in an experimental stage and therefore should be disabled by default. Are you sure you need a event triggered 4 times a sec? |
For the order of contractor triggering, I think #1412 might address that.
As far as timeupdates go, 250ms is actually conservative. Some browsers trigger them every 15ms. |
This seems to still be an issue, using the current master of video.js & youtube tech. The Although not getting to the root of the issue, we should ditch the two boolean flags |
I'm not sure what the next steps should be on this issue. If we can set up a reduced test case I think it would help clear things up. |
Hey guys, I'm experiencing this as well and I think I got the reduced test case. Please take a look at this fiddle: The trick here is that you need to seek before disposing the player, that's how the error occurs. So play the video, seek to some random time and then click the 'destroy' button, you'll see the errors in the console. Tested on latest Chrome. Hope this helps. |
Very interesting. Thanks for the reduced test case, @jpfranco, this is helpful. |
I've got a pretty simple fix for this that should be ready to go out soon (when I can get the tests to play nice). |
Is there a eta on this fix getting merged? |
@nery We fixed this issue specifically and improved timeout handling in general with the 4.11 release. |
I have two players on my side. One with HTML5 Tech and one with youtube tech.
When calling dispose of the players the time tracking interval is not cleared correctly ( this.currentTimeInterval = undefined when stopTrackingCurrentTime is called ), leading to an endless loop of exceptions in the console.
Storing the Interval ID in the prototype fixed my problem.
Changing the following lines fixed my problem:
The text was updated successfully, but these errors were encountered: