O
O
orsodev2019-10-18 17:13:42
YouTube
orsodev, 2019-10-18 17:13:42

How to pause video on slide change in Slick slider?

There is a slide with a youtube video connected via the YouTube Player API.
How to make it so that when changing a slide, the video stops on the previous slide and starts playing on the current slide
https://codepen.io/MikD/pen/yLLJMOz

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vadim Bogomazov, 2019-10-18
@bogomazov_vadim

There are two events in the slider api - beforeChange and afterChange.

S
Sergey Kotov, 2019-10-18
@liqrizz

create only one object. and when changing the slide, call the player.loadVideoById(videoId) object method

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question