我尝试仅在用户到达视频的特定时间时才显示按钮,类似按钮仅在用户观看了 20 分钟的视频时才会出现。对此一无所知,非常感谢您的意见。谢谢
最佳答案
如果视频是通过 html5(视频标签)播放,但未嵌入,则以下代码是您可以采取的一种途径。
// the video element
var video = document.getElementsByTagName('video')[0];
// add an event listener for 'timeupdate'
video.addEventListener('timeupdate', function() {
// 20 mins in seconds
if ( this.currentTime == 1200) {
// code to add the button here...
}
}, false);
你真的应该看看html5 audio/video api
关于javascript - 带有视频时间的链接按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26245356/