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

Properly disable picture-in-picture controls #1913

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
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
16 changes: 15 additions & 1 deletion src/room/VideoPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,21 @@ export const VideoPreview: FC<Props> = ({

const content = (
<>
<video ref={videoEl} muted playsInline disablePictureInPicture />
<video
ref={videoEl}
muted
playsInline
// There's no reason for this to be focusable
tabIndex={-1}
// React supports the disablePictureInPicture attribute, but Firefox
// only recognizes a value of "true", whereas React sets it to the empty
// string. So we need to bypass React and set it specifically to "true".
// https://bugzilla.mozilla.org/show_bug.cgi?id=1865748
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line react/no-unknown-property
disablepictureinpicture="true"
/>
{!muteStates.video.enabled && (
<div className={styles.avatarContainer}>
<Avatar
Expand Down
13 changes: 10 additions & 3 deletions src/video-grid/VideoTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ export const VideoTile = forwardRef<HTMLDivElement, Props>(
}
}

// Firefox doesn't respect the disablePictureInPicture attribute
// https://bugzilla.mozilla.org/show_bug.cgi?id=1611831

return (
<animated.div
className={classNames(styles.videoTile, className, {
Expand Down Expand Up @@ -220,6 +217,16 @@ export const VideoTile = forwardRef<HTMLDivElement, Props>(
? Track.Source.Camera
: Track.Source.ScreenShare
}
// There's no reason for this to be focusable
tabIndex={-1}
// React supports the disablePictureInPicture attribute, but Firefox
// only recognizes a value of "true", whereas React sets it to the empty
// string. So we need to bypass React and set it specifically to "true".
// https://bugzilla.mozilla.org/show_bug.cgi?id=1865748
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line react/no-unknown-property
disablepictureinpicture="true"
/>
{!maximised && (
<VideoTileSettingsModal
Expand Down