我最近遇到了一个问题,当它们使用 Plyr 在同一页面上时,我无法自动播放/播放来自 vimeo 的两个视频,尽管它们适用于 youtube 视频。
这是一个片段
jQuery(document).ready(function($) {
var $videoComponent = $('.jsVideoComponent');
if ($videoComponent.length) {
$videoComponent.each(function(index) {
var $thisComponent = $(this);
console.log($thisComponent);
var $thisVideo = $thisComponent.find('.jsVideo');
// control video
var video = plyr.setup($thisComponent.find('.jsVideo').get());
var $button = $thisComponent.find('.jsVideoBtn');
$button.on('click', function() {
console.log($thisComponent);
$thisComponent.find('.plyr').show();
video[0].toggleFullscreen();
video[0].play();
});
video[0].on('exitfullscreen', function() {
$thisComponent.find('.plyr').hide();
video[0].stop();
});
});
}
});