I think this is a very basic/dumb question but I can't understand what I'm doing wrong... I would like to add subtitles and a timeline to an html5 video using popcorn.js.
Here's the html5 code:
<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>
(...)
Here's the popcorn part:
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);
The pauseOnLinkClicked: true is the only part that's working...
Here's what you've posted working in action.
In your JS you had
set initially, but after you were setting
on the next elements in the timeline array.
HTML:
JS: