Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to enable Picture in Picture (PiP) mode for YouTube videos #1855

Open
FindMalek opened this issue Jun 12, 2024 · 0 comments
Open

Unable to enable Picture in Picture (PiP) mode for YouTube videos #1855

FindMalek opened this issue Jun 12, 2024 · 0 comments

Comments

@FindMalek
Copy link

FindMalek commented Jun 12, 2024

Description:

I'm currently unable to enable Picture in Picture (PiP) mode for YouTube videos in my ReactPlayer component. I've set up the state for the ReactPlayer as follows:

const [state, setState] = useState({
  // ... your state configuration
  pip: true,
  // ... rest of your state configuration
});

And here's my ReactPlayer configuration:

<ReactPlayer
   {...state}
  onEnablePIP={() => console.log("onEnablePIP")}
  onDisablePIP={() => console.log("onDisablePIP")}
  // ... rest of your ReactPlayer configuration
/>

This is the button to activate the PIP

        <Button
          variant="ghost"
          size="icon"
          className="text-secondary-foreground"
          onClick={() => {
            if (ReactPlayer.canEnablePIP(state.url)) handlePip(state, setState)
          }}
        >
          <Icons.fullscreen className="size-5" />
        </Button>

I've tried using the YouTube URL 'https://www.youtube.com/watch?v=BBC2n_0y6cg', but the 'canEnablePIP' function always returns false, regardless of the URL.

Steps to Reproduce:

  1. Set up the ReactPlayer component with the provided state configuration.
  2. Use the YouTube URL 'https://www.youtube.com/watch?v=BBC2n_0y6cg' to test the PiP functionality.
  3. Observe that the ReactPlayer.canEnablePIP() function always returns false.

Environment:

Additional Information:

I've searched for similar issues on GitHub, but I couldn't find a solution that works for me. Any help or suggestions would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant