Answer the question
In order to leave comments, you need to log in
How to auto stop video?
The page has a slider component. it consists of pictures and one slide with video. for the slide that is currently being shown, isActive=true. How to automatically stop a video if it is on a slide that is not currently visible?
video component:
<video id="video" src={video} className={styles.video} loop muted autoPlay playsInline/>
Answer the question
In order to leave comments, you need to log in
The slide must have a visible/not visible attribute. And if "not visible" - then you can stop the video like this:
video.pause();
video.currentTime = 0;
// где video - ссылка на DOM элемент (по id или через ref)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question