I know there are similar questions to this, but I haven\'t quite been able to get it to work.
This code shows a YouTube video which is within an iframe. When a button (
Well, you just need to change the source (src) attribute value of iframe tag. It's that simple! :)
With javascript, you can do it as follows:
var stopButton = document.getElementById('video-close-button-id');
stopButton.onclick = function() {
  var myPlayer = document.getElementById("youtube-player-id"); 
  myPlayer.setAttribute("src", " ");
}; 
Happy coding.