Home › Forums › JavaScript › Media Events Not Working in Safari/Chrome › Reply To: Media Events Not Working in Safari/Chrome
August 8, 2013 at 8:33 pm
#146199
Participant
Looks like you’re using jQuery. Try using bind() to handle your video events. I have found that adding event listeners in JS for audio/video events can be wonky sometimes.
Try this (note – omit the [0] in the video reference when working with video events):
var v = $('#video');
v.bind('playing', function() {
alert("Video has started");
});
v.bind('ended', function() {
alert("Video has ended");
});