簡體   English   中英

如何在頁面加載后讓視頻開始在特定位置播放?

[英]How can I let the video start playing at particular position when after the page is loaded?

在頁面加載后,我想讓視頻在50秒開始播放。
我該怎么編碼呢?

我目前的代碼是這樣的。

<video id="video" controls="controls" autoplay="autoplay" name="media"><source src="video.mp4" type="video/mp4"></video>

<button name="test" onclick="alert(Math.floor(document.getElementById('video').currentTime) + ' secs elapsed!');">How much time has already elapsed?</button>

這篇文章MDN文檔建議您只需在頁面加載時設置video元素currentTime = 50

設置currentTime應該尋找你設置它的值

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM