A
A
Anto2021-07-13 18:20:34
YouTube
Anto, 2021-07-13 18:20:34

How to play a YouTube video on a mobile phone by clicking on a link?

Good afternoon!

Tell me how to start a YouTube video on mobile phones by clicking on a link? Everything works but on PC.
here is the code:
Button

<a href="#Watch_now" class="button_blok font-Roboto-Regular link-bottom animation_link-bottom">Watch<span class="flare"></span></a>


Script
$(document).on('click', '.button_blok', function() {
  var $video = $('#video'),
    src = $video.attr('src');
 
  $video.attr('src', src + '&autoplay=1');
});


HTML
<section id="Watch_now" class="margin">
<div class="video">
  <div class="video-wrp">
    <iframe id="video" width="560" height="315" 
src="https://www.youtube-nocookie.com/embed/u-OZ...?rel=0&showinfo=0" 
    title="YouTube video player" frameborder="0" 
    allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; 
picture-in-picture" allowfullscreen></iframe>
  </div>
</div>	
</section>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question