Home > Article > Web Front-end > The oncanplay event triggered when the user can start playing video/audio in html5
Example
Execute when the video (video) is ready to start playingJavaScript:
<video oncanplay="myFunction()">
Definition and usage
oncanplay event when the user can start Triggered when playing video/audio (audio/video).
During the video/audio (audio/video) loading process, the triggering sequence of events is as follows:
Browser support
The number in the table indicates the version number of the first browser that supports this event.
Syntax
HTML:
<element oncanplay="myScript">
JavaScript:
object.oncanplay=function(){myScript};
JavaScript, use the addEventListener() method :
object.addEventListener("canplay", myScript);
Note: Internet Explorer 8 and earlier IE versions do not support the addEventListener() method.
Technical details
Whether bubbling is supported: | No |
Can be canceled : | No |
Event type: | Event |
Supported HTML tags: |
<audio oncanplay="myFunction()">
The above is the detailed content of The oncanplay event triggered when the user can start playing video/audio in html5. For more information, please follow other related articles on the PHP Chinese website!