HTML oncanplay Attribute
Definition and Usage
The oncanplay
attribute defines a script to run when the browser can start playing the specified media (when it has buffered enough to begin).
Applies to
The oncanplay
attribute is part of the Event Attributes, and can be used on the following elements:
Examples
Audio Example
Run "myFunction" when the audio is ready to start playing:
<audio oncanplay="myFunction()">
Video Example
Run "myFunction" when the video is ready to start playing:
<video oncanplay="myFunction()">
Browser Support
The oncanplay
attribute has the following browser support for each element:
Element | |||||
---|---|---|---|---|---|
audio | Yes | 9.0 | Yes | Yes | Yes |
embed | Not supported | Not supported | Not supported | Not supported | Not supported |
object | Not supported | Not supported | Not supported | Not supported | Not supported |
video | Yes | 9.0 | Yes | Yes | Yes |
Comments
Post a Comment