以下のサイトのコード参考に、音をmuteにしたいのですが、
どうすれば、いいでしょうか。
http://qiita.com/bass-inu/items/cb72543ae72be458f5c9
html
1<div class="youtube"> 2<iframe width="320" height="180" src="https://www.youtube.com/embed/zOBfofzr0_c?rel=0" frameborder="0" allowfullscreen></iframe> 3</div> 4
js
1<script> 2 $(function (){ 3 var movies = []; 4 var movies_w = []; 5 var movies_h = []; 6 var images = []; 7 $('.youtube iframe').each(function(index, element) { 8 //属性を取得 9 var movie_src = $(this).attr('src'); 10 var movie_width = $(this).attr('width'); 11 var movie_height = $(this).attr('height'); 12 //配列へ 13 movies[index] = movie_src 14 movies_w[index] = movie_width 15 movies_h[index] = movie_height 16 //サムネイルを取得(この場合は320x180) 17 images[index] = 'http://i.ytimg.com/vi' + movie_src.substring(movie_src.lastIndexOf("/"),movie_src.lastIndexOf("?")) + '/mqdefault.jpg' 18 //置き換え 19 $(this).after('<div class="youtube_play"><img src="' + images[index] + '" width="' + movies_w[index] + '"><div class="youtube_btn"></div></div>').remove(); 20 $(this).mute(); 21 22 }); 23 24 $('.youtube_play').each(function(index, element) { 25 $(this).click(function(){ 26 //クリックで置き換え 27 $(this).after('<iframe src="' + movies[index] + '&autoplay=1" width="' + movies_w[index] + '" height="' + movies_h[index] + '" frameborder="0"></iframe>').remove(); 28 }); 29 $(this).hover(function(){ 30 //ロールオーバー 31 $(".youtube_btn").eq([index]).css("background-image","url(マウスが乗っている.png)"); 32 },function(){ 33 $(".youtube_btn").eq([index]).css("background-image",""); 34 }); 35 }); 36});
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。