backbone.js bind to audio events

后端 未结 1 1045
我寻月下人不归
我寻月下人不归 2021-01-28 14:57

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:         


        
相关标签:
1条回答
  • 2021-01-28 15:27

    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.

    0 讨论(0)
提交回复
热议问题