oncanplay 사용 오디오/비디오 재생을 시작할 준비가 된 시기를 정의하는 속성입니다.
예시
미디어가 재생을 시작할 준비가 되었을 때 스크립트를 실행하는 방법을 배우기 위해 다음 코드를 실행할 수 있습니다 -
<!DOCTYPE html>
<html>
<body>
<video id = "myid" width = "320" height = "176" controls oncanplay="display()">
<source src = "/html5/foo.ogg" type = "video/ogg" />
<source src ="/html5/foo.mp4" type = "video/mp4" />
Your browser does not support the video element.
</video>
<script>
function display() {
alert("Video loaded!");
}
</script>
</body>
</html>