This is the part I don't understand. If you need this code, please add a comment explaining how we can get into this situation where playerShowing is true, currentVideo is set, the app has just become visible but restoreTime is not set.

I suppose that if currentVideo is set, then restoreVideo should restore it, even if for some reason restoreTime is not set...  So maybe at the start of restoreVideo() you should test whether currentVideo is defined, and if so, call setVideoURL.  Then, maybe all you have to do is set dom.player.currentTime = restoreTime || currentVideo.metadata.currentTime || 0?

Or actually, maybe the issue here is that releaseVideo() does not always set restoreTime.  How about changing that, so that


Is this something that is needed for Flatfish maybe?  If so, consider making the Flatfish change in a separate bug to keep this blocker patch as simple as possible.