0
我想播放嵌入的iframe中的自定義按鈕點擊使用jquery的YouTube。播放內置iframe的自定義按鈕中的YouTube視頻點擊
jQuery(document).ready(function($){
$(".playButton").click(function(){
$(".flex-active-slide .player")[0].src += "?autoplay=1";
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="playButton">Play button</div>
<iframe>
<html>
<body>
<div class="embedVideo">
<div class="player">
<iframe src="//www.youtube.com/embed/sqpKq6k04vk?width%3D640%26amp%3Bheight%3D360%26amp%3Bautoplay%3D0%26amp%3Bvq%3Dlarge%26amp%3Brel%3D0%26amp%3Bcontrols%3D1%26amp%3Bautohide%3D2%26amp%3Bshowinfo%3D1%26amp%3Bmodestbranding%3D0%26amp%3Btheme%3Ddark%26amp%3Biv_load_policy%3D1%26amp%3Bwmode%3Dopaque">
<html>
<body>
<div id="player">
<div class="html5-videoPlayer">
<video ></video>
</div>
</div>
</body>
</html>
</iframe>
</div>
</div>
</body>
</html>
</iframe>
看到這一點:'http://stackoverflow.com/questions/6246939/start-play-embedded-iframe-youtube-video-on-click-of-an- image' –