需求:我正在使用Youtube iframe api和slick.js进行功能开发,这是一个轮播,其中包含多个视频和图像,且自动播放设置为true。如果是视频,则应先播放完整的视频,然后再播放继续下一张幻灯片。自动播放周期将继续。
问题:-目前,我的问题是播放视频后,自动播放无法恢复,视频继续循环播放。永远不会触发youtube iframe api的onPlayerStateChange回调。
HTML代码:
"Floating point exception (core dumped)"
JS代码
iframe api
int mcd(int x, int y) { //computes greatest common divisor
if (x == 0) return y;
return mcd(y, x % y);
}
int mcm(int x, int y) { //computes smallest common multiple
return x * y / mcd(x, y);
}
int main() {
int a, b;
int counter = 0;
while (cin >> a >> b) {
++counter;
cout << "#" << counter
<< " : " << mcm(a, b) << endl;
}
}
光滑代码
<div class="main-slide">
<div class="banner-image image">
<div class="b-img">
<div class="videoContainer" id="youtubeContainer" data-video-id="x48n5t-KTYY">
<div id="youtubePlayer-0" class="youtubeFrame"></div>
</div>
</div>
</div>
<div class="banner-image image">
<div class="b-img desktop-image hidden-xs "><img src="images/homepage/banner.jpg" /></div>
<div class="b-img visible-xs"><img src="images/homepage/banner.jpg" /></div>
<div class="banner-content">
<h2>Dream House</h2>
<p>For Real</p>
</div>
</div>
<div class="banner-image image">
<div class="b-img">
<div class="videoContainer" id="youtubeContainer" data-video-id="NsZ2nwWRH5c">
<div id="youtubePlayer-1" class="youtubeFrame"></div>
</div>
</div>
</div>
<div class="banner-image image">
<div class="b-img desktop-image hidden-xs "><img src="images/homepage/banner-home.jpg" /></div>
<div class="b-img visible-xs"><img src="images/homepage/banner.jpg" /></div>
<div class="banner-content">
<h2>Dream homes</h2>
<p>For Real</p>
<a href="#">Register Now</a>
</div>
</div>
<div class="banner-image image">
<div class="b-img">
<div class="videoContainer" id="youtubeContainer" data-video-id="3Fbf7KovGAE">
<div id="youtubePlayer-2" class="youtubeFrame"></div>
</div>
</div>
</div>
</div>
我已经在$(window).on('load')中初始化了slick,因为如果我仅在document.ready中对其进行了初始化,那么就无法按我指定的顺序播放视频。
我非常感谢您为解决此问题提供的帮助。