YT ビデオを「iframe」内に配置しようとしているときに、自動再生エラーが発生しました。基本的に、divが原因だと感じていますが、それを防ぐ方法がわかりません。全体のアイデアは次のとおりです-そのdivをクリックすると-(再生と呼ばれます)、もちろん2回クリックする代わりにytビデオが開始される場合があります。ただし、html と jQuery のコードは次のとおりです。
<div class="video">
  <img src="http://i.imgur.com/9EcjYs8.jpg" data-video="http://www.youtube.com/embed/OgAr66JbvtU autoplay=1"/>
    <div class="play"><i class="icon-play"> ► </i></div>
</div>
$(document).ready(function (){
$('.play').click(function () {
    video = '<iframe width="600" height="375" frameborder="0" src="' + $('img').attr('data-video') + '"></iframe>';
    $('.video').replaceWith(video);
});
});
PS .css コードも提供できます。どうぞ:
body{
  background-image: linear-gradient(#99ccff, #fff6e4);
}
html{
  min-height:100%;
}
.video {
    position: relative;
    height: 375px;
    width: 600px;
    background: #73AF96;
    position: absolute;
}
.video img {
    opacity: 0.65;
}
.play {
    opacity:0.5;
    height: 100px;
    width: 140px;
    position: absolute;
    text-align: center;
    cursor: pointer;
    border-radius: 5px;
    /*Centering*/
    margin: -60px 0 0 -60px;
    left: 50%;
    top: 50%;
    display: block;
    background: #FF9933;
    transition: background-color 1s ease;
    color: white;
}
.play:hover {
    opacity: 0.7;
    background: #FF6600;
}
.icon-play {
    text-align:center;
    line-height: 100px;
    font-size:2.5em;
}
.icon-play:before {
    cursor: pointer;
}
乾杯!