可以'不要让popcorn.js工作
can't make popcorn.js work
我认为这是一个非常基本/愚蠢的问题,但我不明白我做错了什么。。。我想使用popcorn.js.为html5视频添加字幕和时间线
这是html5代码:
<script src="http://popcornjs.org/code/dist/popcorn-complete.js">
</script>
(...)
<nav id="timeline"> </nav>
(...)
<video id="video" controls>
<source src="media/ita.webm" type="video/webm">
<source src="media/ita.mp4" type="video/mp4">
</video>
(...)
这是爆米花部分:
document.addEventListener( "DOMContentLoaded", function() {
var popcorn = Popcorn('#video', { pauseOnLinkClicked: true });
popcorn.timeline({
start: 1,
target: "timeline",
title: "This is a title",
text: "this is some interesting text that goes inside",
innerHTML: "Click here for <a href='http://www.google.ca'>Google</a>" ,
direction: "down"
})
.timeline({
start: 3,
target: "#timeline",
title: "double as interesting",
text: "this is some interesting text that goes inside",
innerHTML: "Maybe a button? <button onClick='"window.location.href='http://www.google.com''">Click Me</button>",
direction: "down"
})
.timeline({
start: 7,
end: 10,
target: "#timeline",
title: "3x as interesting",
text: "this is some interesting text that goes inside",
innerHTML: "",
direction: "down"
});
popcorn.subtitle({
start: 1,
end: 5,
text: "Subtitle",
});
popcorn.play();
}, false);
pauseOnLinkClicked: true
是唯一工作的部件。。。
以下是您发布的实际操作。
在你的JS中你有
target: "timeline"
最初设置,但在您设置之后
target: "#timeline"
在时间线数组中的下一个元素上。
HTML:
<html>
<head>
<title>PopcornJS Test</title>
<script src="http://popcornjs.org/code/dist/popcorn-complete.js"></script>
</head>
<body>
<nav id="timeline"></nav>
<video id="video" controls>
<source src="http://www.w3schools.com/html/mov_bbb.mp4" type="video/webm">
<source src="media/ita.mp4" type="video/mp4">
</video>
</body>
</html>
JS:
document.addEventListener("DOMContentLoaded", function() {
var popcorn = Popcorn('#video', { pauseOnLinkClicked: true });
popcorn.timeline({
start: 1,
target: "timeline",
title: "This is a title",
text: "this is some interesting text that goes inside",
innerHTML: "Click here for <a href='http://www.google.ca'>Google</a>" ,
direction: "down"
})
.timeline({
start: 3,
target: "timeline",
title: "double as interesting",
text: "this is some interesting text that goes inside",
innerHTML: "Maybe a button? <button onClick='"window.location.href='http://www.google.com''">Click Me</button>",
direction: "down"
})
.timeline({
start: 7,
end: 10,
target: "timeline",
title: "3x as interesting",
text: "this is some interesting text that goes inside",
innerHTML: "",
direction: "down"
});
popcorn.subtitle({
start: 1,
end: 5,
text: "Subtitle",
});
popcorn.play();
}, false);
相关文章:
- 可以't让我的if语句处理js中的html表单输入
- 使用agility.js进行页面布局和合成
- 使用Clipboard.js复制span文本
- 使用JS如何动态更改显示的html文件中的文本背景颜色
- 强制模板刷新ember.js
- 如何编写HTML输入的JS内联
- Angular JS IE9 Hashbang url rewriting
- 如何销毁popcorn.js动画
- 在机身上显示从Popcorn.js拍摄的图像
- 插件popcorn.js不工作
- 如何使用popcorn.js在localhost上播放webm视频
- popcorn.js可以检测切换视频,无需重启即可继续
- 可以'不要让popcorn.js工作
- Popcorn.js:手机浏览器YouTube "play"按钮不显示
- Popcorn.js可以用来给YouTube视频添加字幕吗?
- 函数返回的奇异值(使用popcorn.js、angular和jade)
- 如何使用popcorn.js暂停和播放视频
- 为什么使用popcorn.js不能显示XML字幕?
- 如何在点击链接时在popcorn.js中设置currentTime
- url中的控件“;0〃-HTMLYouTubeVideoElement-Popcorn.js 1.5.6