Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery event handling for HTML5 media events

Tags:

html

jquery

I want to listen to some of the events fired by HTML5 <audio> element. Some of event attributes for <audio> element are : onplaying, onprogress, onseeked, onseeking etc.,

I tried to listen to these events in jquery using conventional live() function like below, but it didn't work.

        $('audio#voice').live('progress', function(){
            $('a#play').replaceWith("Playing...")
        });

I also tried with

        $('audio#voice').live('onprogress', function(){
            $('a#play').replaceWith("Playing...")
        });

Is there any other way I can listen to these HTML5 media events in jQuery?

like image 533
Anand Avatar asked Oct 09 '22 22:10

Anand


1 Answers

You can only use live() and delegate() for events that bubble. The audio events probably don't so you can only bind() them on existing elements.

like image 192
ThiefMaster Avatar answered Oct 13 '22 12:10

ThiefMaster