Maybe you've done something similar with window heights or widths. We use that and then save what we need to the state of our component. Luckily, Javascript has a specific listener for updates in playing time. So when the element has appeared we add the listener, and when the element is about to be erased, we remove the listener. They have a life that begins and ends (the cycle!). Moreover, playback may be controlled using JavaScript.
Now, the HTML5