u-wave/react-youtube

Is there any way to minimize full screen video if some state change?

sabit990928 opened this issue · 2 comments

@goto-bus-stop @fawaf @Authchirion. I have a case when there is paused state change(not manually), when it happens I want to minimize the video. Do you have any idea how call it?

The YouTube API doesn't have a fullscreen API, but the DOM APIs provided by the browser should do the trick here. You can call document.exitFullscreen() in an onPause function:

<YouTube
  onPause={() => {
    if (document.fullscreenElement)
      document.exitFullscreen()
  }}
/>

@goto-bus-stop, thanks it works for me