audiojs
audiojs copied to clipboard
Adds event triggering to callbacks
This pull request follows up on #137, to allow events to be listened to, rather than just overwriting default behaviours through setting of callback functions within audiojs.
Also fixes some regex that the closure compiler was incorrectly escaping.
Great pull request.
Testing on Internet Explorer 9, this fails. I get an error on the line
event = new Event(eventName);
Seems that syntax isn't supported in this browser. Fixed by changing to
var event = document.createEvent('Event');
event.initEvent(eventName, true, true);
Also seeing issues on IE8: it seems custom events are supported, so "onplay" doesn't work. I'm fixing by using jQuery to trigger events:
$(element).trigger(eventName, args);
Unfortunately this creates a jQuery dependency.
Hi, good job. I need this! But, how can I use it in a multiple instances? For example, how can I call an external function on play? I want to receive parameters too, like the exact element is playing and your currentTime (if 0 I will do A thing, if not I will do B thing). Thank you,