HTML 5 Video OnEnded Event not Firing
Posted
by Eric J.
on Stack Overflow
See other posts from Stack Overflow
or by Eric J.
Published on 2010-05-28T00:03:39Z
Indexed on
2010/06/02
3:33 UTC
Read the original article
Hit count: 888
jquery-events
|html5-video
I'm trying to react to the HTML 5 onended
event for the video
tag without success. In the code snippet below I added the mouseleave event to be sure the jQuery code is correct and that event does activate the alert()
box.
The video plays just fine but onended
does not cause my alert()
to fire off.
Testing in Chrome, updated today to version 5.0.375.55.
<html>
<head>
<script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script>
$(document).ready(function(){
$("#myVideoTag").bind('mouseleave onended', function(){
alert("All done, function!");
});
});
</script>
</head>
<body>
<video id="myVideoTag" width="640" height="360" poster="Fractal-zoom-1-04-Snowflake.jpg" controls>
<source src="Fractal-zoom-1-04-Snowflake.mp4" type="video/mp4"></source>
<source src="Fractal-zoom-1-04-Snowflake.ogg" type="video/ogg"></source>
</video>
<body>
<html>
© Stack Overflow or respective owner