Skip to content

Fix pip bug on brave #1797

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/components/VideoPlayer2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const VideoPlayer: FunctionComponent<VideoPlayerProps> = ({
if (document.pictureInPictureElement) {
await document.exitPictureInPicture();
} else if (document.pictureInPictureEnabled && playerRef.current) {
playerRef.current.requestPictureInPicture();
await playerRef.current.requestPictureInPicture()
}
} catch (error) {
// Ignore specific errors that might occur during normal operation
Expand Down Expand Up @@ -327,7 +327,6 @@ export const VideoPlayer: FunctionComponent<VideoPlayerProps> = ({
}
}
}

const handleTrackChange = () => {
for (let i = 0; i < tracks.length; i++) {
const track = tracks[i];
Expand Down Expand Up @@ -503,7 +502,9 @@ export const VideoPlayer: FunctionComponent<VideoPlayerProps> = ({
event.stopPropagation();
break;
case 'KeyP': // 'P' key to toggle picture-in-picture(pip) mode
togglePictureInPicture();
if(!navigator.brave) {
togglePictureInPicture();
}
event.stopPropagation();
break;
case 'KeyC':
Expand Down Expand Up @@ -652,8 +653,10 @@ export const VideoPlayer: FunctionComponent<VideoPlayerProps> = ({
.el()
.insertBefore(qualitySelector.el(), fullscreenToggle.el());

const pipButton = createPipButton(player);
controlBar.el().insertBefore(pipButton.el(), fullscreenToggle.el());
if(!navigator.brave) {
const pipButton = createPipButton(player);
controlBar.el().insertBefore(pipButton.el(), fullscreenToggle.el());
}

setPlayer(player);
if (options.isComposite) {
Expand Down