0

I am using npm-react-youtube, I want to not display this div once the video ends.

The code is as follows :

const opts = {
height: '500',
width: '100%',
playerVars: {
  // https://developers.google.com/youtube/player_parameters
  autoplay: 1,
  rel: 0,
  controls : 0, 
   },
  }

 </div>
 {urlId && <Youtube className='player' videoId= {urlId.key} 
 opts= {opts}  />}

 </div>

I've tried many ways and nothing seems to help.

Ahmed Sbai
  • 10,695
  • 9
  • 19
  • 38
JayK
  • 76
  • 6
  • This code doesn't show what have you tried. You could use the code shown [here](https://stackoverflow.com/a/74881744/12511801) for check - once the video has ended `YT.PlayerState.ENDED` - then, close/hide the div that contains the video. – Marco Aurelio Fernandez Reyes Feb 08 '23 at 14:26

0 Answers0