HTML DOM中的视频结束属性用于返回视频的播放是否结束。当播放位置位于视频结尾时,我们认为视频已经结束。视频结束属性是只读属性。
返回值:如果视频已结束,则视频结束属性将返回布尔值true,否则返回false。
用法:
videoObject.ended
以下示例程序旨在说明视频结束属性:
例:查找视频是否已结束。
HTML | DOM Video ended Property
h1 {
color:green;
}
h2 {
font-family:Impact;
}
body {
text-align:center;
}
GeeksforGeeks
Video ended Property
width="360"
height="240"
controls>
type="video/mp4">
type="video/ogg">
For checking whether the video has
ended or not, double click the
"Try it" button.
type="button">
Try it
function My_Video() {
var v =
document.getElementById(
"Test_Video").ended;
document.getElementById(
"test").innerHTML = v;
}
输出:
单击按钮之前:
单击按钮后:
支持的浏览器:HTML | DOM视频结束的属性如下所示:
谷歌浏览器
IE浏览器
Firefox
Opera
苹果Safari