I want to know the difference between onplay and onplaying events.
I've looked at the examples in the W3C, but I could not find any differences. (https://www.w3.org/2010/05/video/mediaevents.html)
Help me!
They might sound similar but are fired in different conditions.
The W3C Media Elements event summary gives pretty good definitions of the events, and regarding your question:
play event is simple, and is fired when video starts due to autoplay attribute being true, or if the play() method has returned, and only when paused was true.playing event is a bit more tricky. It is fired if paused was true, but also on different cases depending on the element state. These cases are well defined, but remain obscure without an example.Hopefully, the link you provided actually shows these differences, and if you use the seek bar a couple of times, you will see that the playing event is called whereas the play event isn't.
The play event indicates that the media element is started or restarted see: play() and pause(), think of the media element as being in "playback mode" (where "playback mode" is my term and not a term found in the specifications).
The playing and waiting events may alternate while the media element is in "playback mode" as the source is buffered.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With