Answer the question
In order to leave comments, you need to log in
Why doesn't iframe autoplay start when clicking on a button on mobile?
$(".butt_play").click(function(){
var dataYoutube = $(this).parents('.video').attr('data-youtube');
$(this).parents('.video').html('<iframe width="100%" height="100%" src="https://www.youtube.com/embed/'+ dataYoutube +'?rel=0&autoplay=1&enablejsapi=1" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>');
dataYoutube.playVideo();
});
<div class="tc video container">
<div class="video_about_park">
<div class="video" data-youtube='Q-gw49LH1oA'>
<img src="images/img_zakaz.png" id="movie" class="butt_play img-responsive" alt="" />
</div>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question