- From: Silvia Pfeiffer <silviapfeiffer1@gmail.com>
- Date: Wed, 21 Aug 2013 22:13:53 +1000
- To: Simon Pieters <simonp@opera.com>
- Cc: WHAT Working Group <whatwg@lists.whatwg.org>, Brian Chirls <brian.chirls@gmail.com>
On Wed, Aug 21, 2013 at 8:59 PM, Simon Pieters <simonp@opera.com> wrote: > The problem was this: if you want to do something when a user clicks on a > video but not when the user interacts with the native controls, you're > basically out of luck. > No, you can do as you do below: you can define an onclick handler and do something. As long as you don't do something that the native controls are already taking care of, such as play() and pause(). If you are indeed trying to influence the play/pause state of the video element both from script and native controls, you need to be more creative with your event handlers and use onclick and onpause and onplay event handlers and carefully manage which ones cancel out which other ones. <video controls onclick="if (paused) play(); else pause()" > src=foobar></video> > > If the user clicks on the video's rendering area (i.e. outside the > controls), this works as intended. However, if the user clicks on the > native play/pause button, the video plays and then immediately pauses > again. The change fixes this. > It also means that in the case of Firefox or in the case of Android Chrome, where the native controls cover the full video with a overlay button when not on autoplay, you cannot get any onclick events on the video element at all. Silvia.
Received on Wednesday, 21 August 2013 12:14:37 UTC