有没有办法在使用JavaScript的Vimeo播放器上触发全屏模式? 我想隐藏玩家的所有控件,我有一个侧面自定义按钮,我想触发全屏。
<script src="//f.vimeocdn.com/js/froogaloop2.min.js"></script>
<iframe id="player1" src="//player.vimeo.com/video/76979871?api=1&player_id=player1" width="630" height="354" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<div>
<button>Play</button>
<button>Pause</button>
<button class="fullscreen">FullScreen</button>
</div>
$(function() {
var iframe = $('#player1')[0];
var player = $f(iframe);
// When the player is ready, add listeners for pause, finish, and playProgress
player.addEvent('ready', function() {
status.text('ready');
player.addEvent('pause', onPause);
player.addEvent('finish', onFinish);
player.addEvent('playProgress', onPlayProgress);
});
// button to trigger fullscreen
$('button.fullscreen').bind('click', function() {
// here i want trigger fullscreen on player Vimeo
});
});
答案 0 :(得分:0)
不幸的是,没有。 Fullscreen API需要直接的用户操作,并且postMessage
对播放器的操作会丢失。