HTMLMediaElement: canplay
El evento canplay es lanzado cuando el elemento <video> o <audio> puede ser iniciado o fue iniciado satisfactoriamente.
Lo que puede evitar que el evento canplay
se dispare puede ser por alguna de estás razones:
- El ruta del
audio
ovideo
están mal especificadas. - El navegador no soporta la etiqueta.``
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Evento oncanplay - Javascript</title>
<script>
function Start() {
alert("Start")
}
</script>
</head>
<body>
<video controls autoplay oncanplay="Start()">
<source src="audio.mp4" type="video/mp4">
</video>
</body>
</html>
Intente especificar mal la ruta del src
y comprobrará que el evento no funciona.
General info
- Specification
- Interface
-
Event
- Bubbles
-
No
- Cancelable
-
No
- Target
-
Element
- Default Action
-
None.
Properties
Property | Type | Description |
---|---|---|
target Read only |
EventTarget |
The event target (the topmost target in the DOM tree). |
type Read only |
DOMString |
The type of event. |
bubbles Read only |
Boolean |
Whether the event normally bubbles or not. |
cancelable Read only |
Boolean |
Whether the event is cancellable or not. |