I have to create an interactive video using HTML5 and jQuery. My goal is to:
- Play
video1
- When
video1
ends showbutton1
,onClick
change tovideo2
and hidebutton1
- Play
video2
On Ended
showbutton 2
,OnClick
change tovideo 3
- and so on...
My question to you is, what am I doing wrong? This is my code.
<section>
<video autoplay="autoplay" controls="controls" onended="testEnded()">
<source id="srcWebm" src="media/Madagascar.webm"/>
</video>
</section>
<section id="buttons" class="btnShow">
<ul id="buttons2" hidden>
<li><a href="#" id="choice1" onclick="changeSrc1()">VW</a></li>
</ul>
</section>
The function testEnded()
is in an external sheet (which is linked properly to the html).
The script is as follows:
function changeSrc1() {
$('#srcWebm').attr('src','media/VW.webm');
}
function testEnded() {
$('#buttons2').removeAttr('hidden');
}
When I execute changeSrc1()
nothing happens. I have tried linting the code - no errors...
What should I do? Thanks!