📅  最后修改于: 2023-12-03 15:31:12.710000             🧑  作者: Mango
The defaultPlaybackRate
property sets or returns the default speed of the video playback. This property does not affect the current playback rate of the video.
videoObject.defaultPlaybackRate = rate;
rate = videoObject.defaultPlaybackRate;
rate
A number that determines the default speed of the video playback. The value must be in the range 0.5 - 4.0. The default value is 1.0, which means normal speed.
<!DOCTYPE html>
<html>
<body>
<video id="myVideo" width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
<script>
var video = document.getElementById("myVideo");
video.defaultPlaybackRate = 2.0;
</script>
</body>
</html>
This example sets the default playback rate of the video to 2.0.
The defaultPlaybackRate
property does not affect the current playback rate of the video. To set the current playback rate, use the playbackRate
property.
This property can also be set in HTML using the defaultplaybackrate
attribute.
The defaultPlaybackRate
property is supported in all major browsers.
| Chrome | Edge | Firefox | IE | Opera | Safari | |--------|------|---------|----|-------|--------| | Yes | Yes | Yes | Yes| Yes | Yes |
The defaultPlaybackRate
property is a useful property that allows you to set the default playback speed of a video. This is a great way to optimize the video playback experience for your users.