Skip to content

Instantly share code, notes, and snippets.

@stanruss
Created March 5, 2018 09:32
Show Gist options
  • Save stanruss/b355c2a30f9af10aac2fb7722500ab5f to your computer and use it in GitHub Desktop.
Save stanruss/b355c2a30f9af10aac2fb7722500ab5f to your computer and use it in GitHub Desktop.
stop play on youtube
<a href="http://www.youtube.com/embed/JMJXvsCLu6s" target="_blank" onclick="window.open(this.href, '', 'width='+screen.availWidth/2+',height='+screen.availHeight/2+',top='+screen.availHeight/4+',left='+screen.availWidth/4); return false;"> <i class="far fa-file-video white-text"></i> </a>
OR
<div id="play"></div>
<div id="playYoutube1">воспроизведение</div>
<div id="pauseYoutube1">пауза</div>
<script src="//www.youtube.com/player_api"></script>
<script>
var play;
function onYouTubePlayerAPIReady() {
play = new YT.Player('play', {videoId: 'JMJXvsCLu6s',});
document.getElementById('playYoutube1').onclick = function() {play.playVideo();};
document.getElementById('pauseYoutube1').onclick = function() {play.pauseVideo();};
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment