Hello gsap,
I have an animation and i want to play a youtube video when the animation finishes.
I aded the onComplete property to play the video,
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player1;
function onYouTubePlayerAPIReady() {
player1 = new YT.Player('video', {
width: '100%',
height: '100%',
videoId: 'reAlJKv7ptU'
});
}
function play(){
player1.playVideo();
}
gsap.to(".video", {duration:1 , x:100, onComplete:play})
it seems that it plays the video but it stops instantly.
Thank you.