oncanplay event
Examples
Execute JavaScript in the video (video) ready to start playing:
<Video oncanplay = "myFunction ()">
try it"
At the bottom of this article to see more instances.
Definition and Usage
Oncanplay event triggered the user can start playing video / audio (audio / video).
In the video / audio (audio / video) loading process, triggering the sequence of events is as follows:
Browser Support
Figures in the table represent the first browser to support this version of events.
event | |||||
---|---|---|---|---|---|
oncanplay | Yes | 9.0 | Yes | Yes | Yes |
grammar
In HTML:
<Elementoncanplay = "myScript"> try
In JavaScript:
object .oncanplay = function () {myScript }; try
JavaScript, use the addEventListener () method:
object .addEventListener ( "canplay", 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
JavaScript is executed when the audio is ready to play:
<Audio oncanplay = "myFunction ()">
try it"
Event objects