简单 Javascript/jQuery Vimeo Froogaloop 的调试帮助
Debug Help for Simple Javascript/jQuery Vimeo Froogaloop
看到这个link:http://jitimanagementcoach.com/TC_test/tabbed4try.html
我已经有了要播放的视频 and/or 单击一个选项卡时在一个或另一个选项卡上暂停...但现在 我需要 Prelearn 选项卡上的视频 "click" Prelearn 视频完成后,解决方案选项卡并播放视频。这是代码:
<script>
var iframe1 = document.getElementById("prelearnvid");
var iframe2 = document.getElementById("solutionvid");
var player1 = $f(iframe1);
var player2 = $f(iframe2);
var prelearnBtn = document.getElementById("prelearnbtn");
prelearnBtn.addEventListener("click", function() {player1.api("play");player2.api("pause");});
var solutionBtn = document.getElementById("solutionbtn");
solutionBtn.addEventListener("click", function() {player2.api("play");player1.api("pause");});
player1.addEvent('ready', function() {player1.addEvent('finish', onFinish);});
function onFinish(id) {window.location.href = '#solution-tab';};
</script>
在最后两行之前一切正常...我哪里出错了?
ready
事件没有为您的播放器触发。为了触发玩家的事件,您需要向 URL 添加一个 player_id
参数,其中包括 <iframe>
的 id
。
将 <iframe>
的 src
属性更改为:
<iframe id="prelearnvid" src="http://player.vimeo.com/video/92349330?&player_id=prelearnvid"
If you’re embedding and controlling multiple players on a page or
using our JS API library (Froogaloop), you should give each player a
player_id
that matches the id of the iframe element.
这 Whosebug answer and this forum post 帮助发现了这个解决方案。
看到这个link:http://jitimanagementcoach.com/TC_test/tabbed4try.html 我已经有了要播放的视频 and/or 单击一个选项卡时在一个或另一个选项卡上暂停...但现在 我需要 Prelearn 选项卡上的视频 "click" Prelearn 视频完成后,解决方案选项卡并播放视频。这是代码:
<script>
var iframe1 = document.getElementById("prelearnvid");
var iframe2 = document.getElementById("solutionvid");
var player1 = $f(iframe1);
var player2 = $f(iframe2);
var prelearnBtn = document.getElementById("prelearnbtn");
prelearnBtn.addEventListener("click", function() {player1.api("play");player2.api("pause");});
var solutionBtn = document.getElementById("solutionbtn");
solutionBtn.addEventListener("click", function() {player2.api("play");player1.api("pause");});
player1.addEvent('ready', function() {player1.addEvent('finish', onFinish);});
function onFinish(id) {window.location.href = '#solution-tab';};
</script>
在最后两行之前一切正常...我哪里出错了?
ready
事件没有为您的播放器触发。为了触发玩家的事件,您需要向 URL 添加一个 player_id
参数,其中包括 <iframe>
的 id
。
将 <iframe>
的 src
属性更改为:
<iframe id="prelearnvid" src="http://player.vimeo.com/video/92349330?&player_id=prelearnvid"
If you’re embedding and controlling multiple players on a page or using our JS API library (Froogaloop), you should give each player a
player_id
that matches the id of the iframe element.
这 Whosebug answer and this forum post 帮助发现了这个解决方案。