does facebook embedded video api still support removeListener()?

荒凉一梦 提交于 2019-12-12 09:57:15

问题


According to facebook documentation - https://developers.facebook.com/docs/plugins/embedded-video-player/api , we subscribe to player events

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

It seems that removeListener() is not available on the token returned by subscribe(). With a debugger, we see that there is a method release() available on the token. Should that be used? Is it now official?

Am I doing something wrong?


回答1:


there was and probably still is, unless FB changed something again, a release() method. it does what removeListen() should be doing.



来源:https://stackoverflow.com/questions/38745635/does-facebook-embedded-video-api-still-support-removelistener

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!