2
根據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()
。應該使用嗎?現在是官方嗎?
我做錯了什麼?
也有這個問題,並尋找一個解決方案。 –