确实Facebook的嵌入式视频API仍然支持removeListener()?

问题描述:

根据Facebook的文档 - https://developers.facebook.com/docs/plugins/embedded-video-player/api,我们订阅播放器事件确实Facebook的嵌入式视频API仍然支持removeListener()?

var handleDesktopEvents = function (msg) { 
     if (msg.type === 'video') { 
      var player = msg.instance; 
      var playHandler = player.subscribe('startedPlaying', function() { 
       // Video started playing ... 
       player.unmute(); 
       console.log('detected video playing'); 
       ga_virtual_pagehit(msg.id); 
       console.log('sent event to GA'); 
       playHandler.removeListener('startedPlaying'); 
       // playHandler.release(); 
      }); 
      console.log('detected video ready'); 
      player.play(); 
      FB.Event.unsubscribe('xfbml.ready', handleDesktopEvents, handleDesktopEx); 
     } 
    }; 
    var handleDesktopEx = function() { 
     // Handle pause() and exceptions 
     console.log('detected pause'); 
    }; 

    FB.Event.subscribe('xfbml.ready', handleDesktopEvents, handleDesktopEx); 

似乎removeListener()不可由subscribe()返回的令牌。使用调试器,我们看到令牌上有一个可用的方法release()。应该使用吗?现在是官方吗?

我做错了什么?

+0

也有这个问题,并寻找一个解决方案。 –

出现了,并且可能仍然存在,除非FB再次更改了某个版本()方法。它执行removeListen()应该做的事情。