Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3712

Youtube video pausing from coding [closed]

$
0
0

I am trying to stop the embedded video of Youtube from code so can someone help me in this?

<div class="youtube-video"><iframe width="853" height="480" src="https://www.youtube.com/embed/uisBaTkQAEs" class="abc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div><script>       document.querySelector(".youtube-div").addEventListener('click', function(e){           if(e.target != document.querySelector(".youtube-video") ) {            youtubeDiv.style.visibility = "hidden";            // player.stopVideo();        }    });

So , this is my code where when i click a button youtube opens and i can play video.After we click outside of youtube , the youtube-div gets hidden. But when we hide the div again , i want to stop the video , tried using player.stopVideo() , but i dont get this nor does it works.


Viewing all articles
Browse latest Browse all 3712

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>