HTMLMediaElement.loop

 
HTMLMediaElement.loop 属性是 HTML 标签 loop 属性的映射,它决定了媒体元素播放结束时是否重新开始。
 

原文:The HTMLMediaElement.loop property reflects the loop HTML attribute, which controls whether the media element should start over when it reaches the end.

语法

var loop = video.loop;
audio.loop = true;

返回值

一个布尔值 Boolean (en-US).

示例

var obj = document.createElement('video');
obj.loop = true; // true

规范

Specification Status Comment
HTML Living Standard
HTMLMediaElement.loop
Living Standard No change from HTML5
HTML5
HTMLMediaElement.loop
Recommendation Initial definition.

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help! (en-US)

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
loop property (Yes) (Yes) 11.0 (11.0) 9 ? ?
Feature Android Edge Firefox Mobile (Gecko) Firefox OS (Gecko) IE Mobile Opera Mobile Safari Mobile
loop property (Yes) (Yes) 11.0 (11.0) (Yes) ? ? ?

相关链接