audiojs icon indicating copy to clipboard operation
audiojs copied to clipboard

Adds event triggering to callbacks

Open rtibbles opened this issue 10 years ago • 3 comments

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.

rtibbles avatar Dec 05 '14 15:12 rtibbles

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);

pangolingo avatar Dec 17 '14 17:12 pangolingo

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.

pangolingo avatar Dec 17 '14 17:12 pangolingo

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,

CeloGomesBR avatar Jul 02 '16 23:07 CeloGomesBR