미디어 데이터가 로드될 때 스크립트를 실행하려면 onloaddata 이벤트를 사용하십시오. onloaddata 이벤트를 구현하기 위해 다음 코드를 실행할 수 있습니다 -
예시
다음 코드는 동영상이 로드될 때 경고 상자를 생성합니다 -
<!DOCTYPE html>
<html>
<body>
<video controls onloadeddata = "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("Loaded!");
}
</script>
</body>
</html>