From 5c1d99422cf595a7e43b6b442b54f347c64f368d Mon Sep 17 00:00:00 2001 From: Jason Beetham Date: Sat, 7 Mar 2026 23:16:45 -0700 Subject: [PATCH 1/2] Fix picture in picture setting not effecting element-call --- ..._picture_setting_not_effecting_element_call.md | 5 +++++ src/app/hooks/useCallEmbed.ts | 15 +++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 .changeset/fix_picture_in_picture_setting_not_effecting_element_call.md diff --git a/.changeset/fix_picture_in_picture_setting_not_effecting_element_call.md b/.changeset/fix_picture_in_picture_setting_not_effecting_element_call.md new file mode 100644 index 00000000..b9416bb4 --- /dev/null +++ b/.changeset/fix_picture_in_picture_setting_not_effecting_element_call.md @@ -0,0 +1,5 @@ +--- +sable: minor +--- + +# Fix picture in picture setting not effecting element-call diff --git a/src/app/hooks/useCallEmbed.ts b/src/app/hooks/useCallEmbed.ts index e04182dd..280d2095 100644 --- a/src/app/hooks/useCallEmbed.ts +++ b/src/app/hooks/useCallEmbed.ts @@ -2,6 +2,8 @@ import { createContext, RefObject, useCallback, useContext, useEffect, useState import { MatrixRTCSession } from 'matrix-js-sdk/lib/matrixrtc/MatrixRTCSession'; import { MatrixClient, Room } from 'matrix-js-sdk'; import { useSetAtom } from 'jotai'; +import { settingsAtom } from '$state/settings'; +import { useSetting } from '$state/hooks/settings'; import { CallEmbed, ElementCallThemeKind, @@ -77,6 +79,19 @@ export const useCallStart = (dm = false) => { export const useCallJoined = (embed?: CallEmbed): boolean => { const [joined, setJoined] = useState(embed?.joined ?? false); + const [allowPip] = useSetting(settingsAtom, 'allowPipVideos'); + + if (embed && allowPip) { + 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(embed.iframe.contentDocument!, { subtree: true, childList: true }); + } useClientWidgetApiEvent( embed?.call, From cb807c2ef2f5a13931151671df53073a137707b9 Mon Sep 17 00:00:00 2001 From: 7w1 Date: Sun, 8 Mar 2026 10:48:22 -0500 Subject: [PATCH 2/2] Update changeset for picture in picture setting fix --- ...x_picture_in_picture_setting_not_effecting_element_call.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/fix_picture_in_picture_setting_not_effecting_element_call.md b/.changeset/fix_picture_in_picture_setting_not_effecting_element_call.md index b9416bb4..ce411992 100644 --- a/.changeset/fix_picture_in_picture_setting_not_effecting_element_call.md +++ b/.changeset/fix_picture_in_picture_setting_not_effecting_element_call.md @@ -1,5 +1,5 @@ --- -sable: minor +sable: patch --- -# Fix picture in picture setting not effecting element-call +Fix picture in picture setting not effecting element-call