0

I am using React-Slick for slider . Here in one one of my slider I have a video to play. I am able to play video using React-Video But the video plays even if we change slide

const [ isplaying, setIsplaying ] = useState(false)

     <div>
      <ReactPlayer
               key={`frame'-${media.id}`}
               width={IMAGE_WIDTH}
               height={IMAGE_HEIGHT}
               allowFullScreen={true}
               playing={isplaying}
               controls
               url={media.src}></ReactPlayer>
            )}
    </div>  
 
         <Slider
          className={isViewWide ? css.sliderRegularWide : css.sliderRegularNarrow}
          asNavFor={nav2}
          beforeChange={(currentIndex, nextIndex) => {
            if (currentIndex === 4) { setIsplaying(false)}
          }}
          ref={slider1 => setNav1(slider1)}
          {...settingsRegular}>
          {regularImages}
        </Slider>

           

Even after setting playing false the video does not stop playing.

ganesh kaspate
  • 1
  • 9
  • 41
  • 88
  • I think you should probably use a React ref to pass to `Slider`. Can you share a more [Minimal, Complete, and Reproducible](https://stackoverflow.com/help/minimal-reproducible-example) code example so we've more context? – Drew Reese Feb 03 '21 at 05:03
  • https://github.com/cookpete/react-player/issues/1079 – Soldeplata Saketos Mar 05 '21 at 07:17

0 Answers0