W
W
Way2019-07-17 11:02:16
YouTube
Way, 2019-07-17 11:02:16

YouTube Video API how to run after AJAX?

Hi all.
I made custom controls for YouTube video, everything works fine if the element with the video is already on the page when loading. I did it off the dock, but my implementation is similar to the example from this article https://css-tricks.com/play-button-youtube-and-vim...
The problem is that onYouTubeIframeAPIReady is launched as we add an API file to the page https://www.youtube.com/player_api but if my element with video is loaded by ajax then controls don't work because onYouTubeIframeAPIReady has already been executed. The question is how can such a problem be solved?
I tried to delete the file from the API after Ajax and add it again, but it did not help.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question