Merge pull request #203 from beef331/merry-and-pippin

Add setting to disable element-call disabling of picture in picture
This commit is contained in:
7w1 authored and GitHub committed 2026-03-06 16:49:56 -06:00
commit 9e17002fdc
4 files changed
+43

No files matched your search

@@ -0,0 +1,5 @@
---
sable: minor
---
# Add setting to enable picture-in-picture in element-call
+18
View File
@@ -26,6 +26,8 @@ import { usePowerLevelsContext } from '$hooks/usePowerLevels';
import { useRoomName } from '$hooks/useRoomMeta';
import { useAtomValue } from 'jotai';
import { nicknamesAtom } from '$state/nicknames';
import { settingsAtom } from '$state/settings';
import { useSetting } from '$state/hooks/settings';
import * as css from './CallView.css';
import { CallViewUser } from './CallViewUser';
@@ -138,10 +140,25 @@ export function CallView({ room }: { room: Room }) {
wait: 50,
immediate: false,
});
const [allowPipVideos] = useSetting(settingsAtom, 'allowPipVideos');
useEffect(() => {
const iframeElement = activeIframeDisplayRef?.current;
const hostElement = iframeHostRef?.current;
if (allowPipVideos) {
const removeDisablePictureInPicture = (mutated: any) => {
mutated.forEach((event: any) => {
Array.from(event.target.getElementsByTagName('video')).forEach((video: any) => {
video.removeAttribute('disablepictureinpicture');
});
});
};
const pipObserver = new MutationObserver(removeDisablePictureInPicture);
pipObserver.observe(iframeElement?.contentDocument!, { subtree: true, childList: true });
}
if (room.isCallRoom() || (callIsCurrentAndReady && iframeElement && hostElement)) {
applyFixedPositioningToIframe();
@@ -172,6 +189,7 @@ export function CallView({ room }: { room: Room }) {
debouncedApplyFixedPositioning,
callIsCurrentAndReady,
room,
allowPipVideos,
]);
const handleJoinVCClick: MouseEventHandler<HTMLElement> = (evt) => {
@@ -240,6 +240,23 @@ function IdentityCosmetics() {
);
}
function VideoCosmetics() {
const [allowPipVideos, setPipVideos] = useSetting(settingsAtom, 'allowPipVideos');
return (
<Box direction="Column" gap="100">
<Text size="L400">Video</Text>
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
<SettingTile
title="Picture in Picture Videos"
description="If your browser has it enabled, allows you to pop out the videos in the video call interface. Does not apply retroactively to current joined voice rooms."
after={<Switch variant="Primary" value={allowPipVideos} onChange={setPipVideos} />}
/>
</SequenceCard>
</Box>
);
}
type CosmeticsProps = {
requestClose: () => void;
};
@@ -269,6 +286,7 @@ export function Cosmetics({ requestClose }: CosmeticsProps) {
<IdentityCosmetics />
<JumboEmoji />
<Privacy />
<VideoCosmetics />
</Box>
</PageContent>
</Scroll>
+2
View File
@@ -43,6 +43,7 @@ export interface Settings {
encUrlPreview: boolean;
showHiddenEvents: boolean;
legacyUsernameColor: boolean;
allowPipVideos: boolean;
usePushNotifications: boolean;
useInAppNotifications: boolean;
@@ -105,6 +106,7 @@ const defaultSettings: Settings = {
encUrlPreview: false,
showHiddenEvents: false,
legacyUsernameColor: false,
allowPipVideos: false,
// Push notifications (SW/Sygnal): default on for mobile, opt-in on desktop.
// In-app pill banner: default on for mobile (primary foreground alert), opt-in on desktop.