Vimeo iframe API卸载并重新加载同一视频

时间:2018-07-26 15:13:46

标签: vimeo vimeo-api vimeo-player

我正在使用新的vimeo api。问题是当您卸载视频,然后稍后再尝试播放同一视频时,加载的事件不会触发,视频也不会再次自动播放。仅当您加载其他视频时,您才能将其自动播放。有办法解决这个问题吗?

jsfiddle:https://jsfiddle.net/2drvfjwm/9/

var options = {
  id: 59777392,
  width: 400
};

var player = new Vimeo.Player('test', options);

player.on('loaded', function() {
  console.log('loaded!');
  player.play()
});

$('#unload').on('click', function() {
  player.unload();
})
$('#same').on('click', function() {
  player.loadVideo('59777392');
})
$('#new').on('click', function() {
  player.loadVideo('9998536');
})



<script src="https://player.vimeo.com/api/player.js"></script>

<div id="test"></div>

<div id="unload">unload</div>
<div id="same">same video</div>
<div id="new">new video</div>

0 个答案:

没有答案