0

ここに vimeo JavaScript があります。終了したら vimeo ビデオを開始できるかどうか誰か教えてください。

JavaScriptを使用してこれまでに作成したコードは次のとおりです

// JavaScript Document

var animSpeed = 400;

function onPlay(id) {
jQuery('.blankOverlay').fadeIn(animSpeed);
jQuery('h2').text('You clicked play!');
}

function onPause(id) {

jQuery('.blankOverlay').fadeOut(animSpeed);
jQuery('h2').text('The video is paused.');
}

function onFinish(id) {
jQuery('.blankOverlay').fadeOut(animSpeed);
jQuery('h2').text('The video has now finished.');
}


jQuery(function($) {
// ---------------------------------------------------------------------------------------------

// --------------------------------------------- PHYSICIAN INDIVIDUAL PAGES --
/* ----- video player api (vimeo) ----- */
var iframe = $('#vplayer')[0],
player = $f(iframe);

// When the player is ready, add listeners for play, pause, finish, and playProgress
player.addEvent('ready', function() {

player.addEvent('play', onPlay);
player.addEvent('pause', onPause);
player.addEvent('finish', onFinish);
player.addEvent('playProgress', onPlayProgress);

});

$('.introContent, iframe').click(function(){    $('.blankOverlay').fadeIn(animSpeed); });
$('.blankOverlay').click(function(){ $(this).fadeOut(animSpeed);  player.api('pause'); });

// ---------------------------------------------------------------------------------------------
});
4

1 に答える 1

0

イベント ハンドラで試してくださいplayer.api('play');finish

このようなもの

player.addEvent('finish', onFinish);

function onFinish(){
  player.api('play'); // this should take the video to the start again
}

ビデオを初期状態に戻したい場合は、使用できます

player.api('unload'); // this should take the video to initial state but will not automatically start

これは更新されたデモで、ここにはその他のメソッドのリファレンスがあります。

アップデート

  1. 変数playerは関数内で定義され、外部からアクセスされます
  2. エラーがスローされるイベント ハンドラーonPlayProgressがまったく定義されていません。

更新されたデモはこちら

お役に立てれば。

于 2015-04-16T14:59:18.463 に答える