Javascript,一次加载多个源
我正在尝试制作一些可以快速加载第二个视频的东西,以使其看起来像是两个视频连接成一个(因为根据按键输入,一个视频可能会导致两个选择,具体取决于用户是否按下了正确的键)
现在我使用的基本功能是:
function play(first, second){
var video = document.getElementById("media")
video.setAttribute("src", first)
video.load()
video.play()
setTimeout(function(){
video.setAttribute("src", second)
video.load()
video.play()
}, 2000)
}
现在它有大约一秒的延迟,这样就不会显得两个视频是一个。关于如何解决这个问题有什么想法吗?
I'm trying to make something that will quickly load a second video to make it appear is if the two videos were concatenated into one (because depending on key inputs, one video could lead to two choices depending on if the user hits the correct key)
Right now the basic function I'm using is:
function play(first, second){
var video = document.getElementById("media")
video.setAttribute("src", first)
video.load()
video.play()
setTimeout(function(){
video.setAttribute("src", second)
video.load()
video.play()
}, 2000)
}
Right now it's got about a second of lag so that it doesn't appear as if the two videos are one. Any ideas on how to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论