onplay event
Examples
Executed when the video starts playing JavaScript:
<Video onplay = "myFunction ()">
try it"
Bottom of this article contains more examples.
Definition and Usage
onplay event is triggered when the video / audio (audio / video) to start playback.
Tip: onPause trigger event in the video / audio (audio / video) Pause.
Browser Support
Figures in the table represent the first browser to support this version of events.
event | |||||
---|---|---|---|---|---|
onplay | Yes | 9.0 | Yes | Yes | Yes |
grammar
In HTML:
<Elementonplay = "myScript"> try
In JavaScript:
object .onplay = function () {myScript }; try
JavaScript, use the addEventListener () method:
object .addEventListener ( "play", myScript ); try
Note: Internet Explorer 8 and earlier versions of IE do not support addEventListener () method.
technical details
Whether to support the bubble: | No |
---|---|
It can be canceled: | No |
Event Type: | Event |
Supported HTML tags: | <Audio>, <video> |
More examples
Examples
Executed when the audio starts playing JavaScript:
<Audio onplay = "myFunction ()">
try it"
Event objects