在所有示例中,我發現在線向視頻標簽添加自動播放靜音回圈是如何使用 html 回圈視頻?但是為什么我的視頻只播放一次?
它確實適用于鉻
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<video width="320" height="240" autoplay muted loop>
<source src="1.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</body>
</html>
uj5u.com熱心網友回復:
根據我的閱讀和以前的經驗,并非所有瀏覽器都支持回圈屬性。也許您可以使用一些 JavaScript 來強制視頻回圈播放。這是我在另一個問題上找到的片段:所以這基本上是聽“結束”媒體事件,然后將視頻重置為 0 并再次強制播放。
編輯:為此,您需要洗掉要觸發的“結束”事件的“回圈”屬性。
此處歸功于@asmmahmud:在 HTML5 中播放無限回圈加載視頻
window.addEventListener('load', function(){
var newVideo = document.getElementById('videoElementId');
newVideo.addEventListener('ended', function() {
this.currentTime = 0;
this.play();
}, false);
newVideo.play();
});
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/521743.html
標籤:html火狐
