M
M
MrMaximum2017-07-29 14:24:39
YouTube
MrMaximum, 2017-07-29 14:24:39

How to stop youtube video when closing modal window?

Please tell me how to stop the video from YouTube in the modal window when the window is closed,
+ the video is in the owl carousel , the modal window is in css.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MrMaximum, 2017-07-29
@MrMaximum

It worked.
What was done:
1. Climbed into the owl carousel script and added enablejsapi=1 and id="Youtube" there so that it would be in the iframe
As a result, the output turned out to be
4 into the div where the carousel stands . I added it to the script

function onYouTubePlayerAPIReady() {
  player = new YT.Player('Youtube', {
    events: {'onReady': onPlayerReady}
  });
}
function onPlayerReady(event) {
  document.getElementById("playYoutube").addEventListener("click", function() {player.playVideo();});
  document.getElementById("pauseYoutube").addEventListener("click", function() {player.pauseVideo();});
}

A
A person from Kazakhstan, 2017-07-29
@LenovoId

shpargalkablog.ru/2014/01/pause-youtube.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question