【问题标题】:Vimeo play eventListener fires before Play button is clickedVimeo 播放 eventListener 在单击播放按钮之前触发
【发布时间】:2012-03-07 12:33:51
【问题描述】:

单击 Vimeo 视频上的播放按钮后,我正在尝试调用一个函数。

由于某种原因,该函数在 iframe 加载时调用,而不是在单击播放时调用。有人能解释一下原因吗?

这是我的代码:

    // Enable the API on each Vimeo video
        jQuery('iframe.vimeo').each(function(){
            Froogaloop(this).addEvent('ready', ready);
        });

        function ready(playerID){
            // Add event listerns
            // http://vimeo.com/api/docs/player-js#events
            Froogaloop(playerID).addEvent('play', play(playerID));
        }
        function play(playerID){
            alert(playerID + " is playing!!!");
        }

谢谢!

【问题讨论】:

    标签: javascript html vimeo froogaloop


    【解决方案1】:

    啊哈,想通了!

    // Enable the API on each Vimeo video
        jQuery('iframe.vimeo').each(function(){
            Froogaloop(this).addEvent('ready', ready);
        });
    
        function ready(playerID){
            // Add event listerns
            // http://vimeo.com/api/docs/player-js#events
                Froogaloop(playerID).addEvent('play', function(data) {play(playerID);});
        }
        function play(playerID){
            alert(playerID + " is playing!!!");
        }
    

    希望有人会觉得这很有帮助!

    【讨论】:

      猜你喜欢
      • 2021-12-31
      • 1970-01-01
      • 2012-10-15
      • 2012-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-01
      • 2015-06-16
      相关资源
      最近更新 更多