Vimeo API:暂停事件仅响应一次

时间:2015-04-15 08:19:19

标签: javascript jquery vimeo vimeo-api froogaloop

使用以下代码。问题是暂停事件只是由于某种原因在开始时被触发,当我实际上通过iframe中的视频控制按钮暂停视频时,它没有响应。我做错了什么?

干杯!

// ------------------------------------------
// initialiaze video's
// ------------------------------------------

var readyness = new Array;

$( 'iframe.video-api' ).each( function() {

    var playerID = this,
        playerIDname = $( playerID ).attr('id');

    var playerFrame = $( '#' + playerIDname )[0];

    $f( playerFrame ).addEvent( 'ready', videoReady );

});

function videoReady( playerID ) {

    if ( $( '#' + playerID ).hasClass( 'video-single' ) ) {

        $f( playerID ).addEvent( 'pause', videoPauseSingle );

    }

    clearInterval( readyness[playerID] );

}

function videoPauseSingle( playerID ) {

    $( '#btn-single-video' ).fadeIn( 400 );

}

// ------------------------------------------
// control single video
// ------------------------------------------

$('#btn-single-video .video-button').click( function() {

    var playerID = $( this ).data('video-id');

    $f( playerID ).api('play');

    $( '#btn-single-video' ).fadeOut( 600 );

});

0 个答案:

没有答案