Skip to content Skip to sidebar Skip to footer

Backbone.js Bind To Audio Events

How to do it? I searched Stack Overflow, find one similar result, but it doesn't work. Here's my code: var Player = Backbone.Model.extend({ defaults: { //some variables

Solution 1:

All Backbone.View event handlers are delegated to the view's el. This means that any events that fire inside the view must bubble/propagate up to its el before your handlers will catch them.

Unfortunately for you, HTML5 audio and video elements do not propagate their events up through the DOM the way most other elements do. The only way to handle these events is to add eventListeners directly to the <audio> element after it has been inserted into the DOM.


Post a Comment for "Backbone.js Bind To Audio Events"