我对js很新,显然不知道我在做什么,但我非常沮丧,非常感谢任何帮助,这就是我正在做的事情:
var pop;
var intermission = {
ogg: "https://ia802300.us.archive.org/24/items/DriveInIntermission13/Drive-inIntermission13.ogv",
mp4: "https://ia802300.us.archive.org/24/items/DriveInIntermission13/Drive-inIntermission13_512kb.mp4"
};
var vid;
document.addEventListener("DOMContentLoaded", function (event) {
vid = document.querySelector('#tehvidya'); //this is a dom object;
pop = Popcorn('#tehvidya', {
frameAnimation: true
});
}
pop.on()
"loadedmetadata",
function() {
pop.play();
//video has loaded, we now have duration and other metadata
console.log(pop.duration());
h1.style.opacity = 0;
});
h1.addEventListener("transitionend", function () {
pop.play();
</script>
答案 0 :(得分:2)
您似乎遇到问题:
pop.on()
"loadedmetadata",
function() {
pop.play();
//video has loaded, we now have duration and other metadata
console.log(pop.duration());
h1.style.opacity = 0;
});
我怀疑这应该是:
pop.on("loadedmetadata",function() {
pop.play();
//video has loaded, we now have duration and other metadata
console.log(pop.duration());
h1.style.opacity = 0;
});
你有一些无关紧要的)
搞砸了。
另外,在此:
h1.addEventListener("transitionend", function () {
pop.play();
</script>
你在});
之前错过了</script>
......可能还有其他事情,但你肯定错过了接近该函数表达式。