- From: Philip Jägenstedt <philipj@opera.com>
- Date: Fri, 13 May 2011 11:40:59 +0200
Problem: <video src="video.webm"></video> ... <script> document.querySelector('video').oncanplay = function() { /* will it run? */ }; </script> In the above the canplay event can be replaced with many others, like loadedmetadata and loadeddata. Whether or not the event handler has been registered by the time the event is fired depends on how fast decoding is, how fast the network is and how much "..." there is. This is not new information, Simon Pieters wrote extensively about the problem in http://dev.opera.com/articles/view/consistent-event-firing-with-html5-video/ The reason I write now is that in one of our projects this exact race condition happens to be hit for http://html5demos.com/video which is where the above code snippet comes from. Does anyone have ideas about how to deal with this problem, which *is* going to appear on many real-world pages? Is there any browser that has already done something to mitigate the problem? -- Philip J?genstedt Core Developer Opera Software
Received on Friday, 13 May 2011 02:40:59 UTC