E
E
Evgeny Zhurov2018-03-18 15:19:54
YouTube
Evgeny Zhurov, 2018-03-18 15:19:54

How to track video start and stop in youtube iframe if there is no id?

Good afternoon. Tortured with one problem. The site dynamically loads posts from facebook. Some posts contain a video (iframe from youtube) instead of a preview image. When a video is clicked (i.e., when it is launched), the container in which this video is located must be assigned a different class. All these containers are not present in the layout initially, but are also loaded from facebook. Neither the containers nor the iframe itself have any id. I tried to do it according to the documentation , but apparently, without an id (which is written here: this whole song does not work. Maybe there are some options how to still track the moment the video starts and assign a class to the parent container, and how to track the pause and remove the class.The structure of all this disgrace is as follows:player = new YT.Player('id_элемента')


<div> <!-- контейнер, которому надо присвоить/убрать класс -->
    <div>
        <span>
            <iframe></iframe>
        </span>
    </div>
</div>

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