onratechange 사용 HTML의 HTML에서 재생 속도가 변경될 때마다 스크립트를 실행하는 속성입니다.
예시
다음 코드를 실행하여 onratechange를 구현할 수 있습니다. 속성 -
<!DOCTYPE html>
<html>
<body>
<video id = "myid" width = "320" height = "176" controls onratechange = "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>
<p id="test">Change the speed of the video</p>
<input type = "range" min = "0.1" max = "3" step = "0.2" value = "1"oninput = "update(this)">
<script>
function display() {
document.getElementById("test").innerHTML = "Speed: " + document.getElementById("myid").playbackRate;
}
function update(ob) {
document.getElementById("myid").playbackRate = ob.value;
}
</script>
</body>
</html> 출력
