Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix: enable local recording when embedded in a same-domain iframe (#16900)

RidaElmaaroufia06a338de5ed
diff --git a/react/features/base/util/embedUtils.native.ts b/react/features/base/util/embedUtils.native.ts
index 62eebdcd4c..efb0cd0f35 100644
--- a/react/features/base/util/embedUtils.native.ts
+++ b/react/features/base/util/embedUtils.native.ts
@@ -24,3 +24,13 @@ const JITSI_MEET_APPS = [
export function isEmbedded(): boolean {
return !JITSI_MEET_APPS.includes(getBundleId());
}
+
+/**
+ * React Native has no concept of same-domain embedding. SDK consumers are
+ * always treated as cross-domain embeddings.
+ *
+ * @returns {boolean} Always false in React Native.
+ */
+export function isEmbeddedFromSameDomain(): boolean {
+ return false;
+}
diff --git a/react/features/base/util/embedUtils.web.ts b/react/features/base/util/embedUtils.web.ts
index 9e267b872d..660a7e3269 100644
--- a/react/features/base/util/embedUtils.web.ts
+++ b/react/features/base/util/embedUtils.web.ts
@@ -10,3 +10,17 @@ export function isEmbedded(): boolean {
return true;
}
}
+
+
+/**
+ * Checks whether we are loaded in iframe with same parent domain.
+ *
+ * @returns {boolean} Whether the current page is loaded in an iframe with same parent domain.
+ */
+export function isEmbeddedFromSameDomain(): boolean {
+ try {
+ return window.self.location.host === window.parent.location.host;
+ } catch (e) {
+ return false;
+ }
+}
diff --git a/react/features/recording/functions.ts b/react/features/recording/functions.ts
index 05ed2fa61d..e23f94d6da 100644
--- a/react/features/recording/functions.ts
+++ b/react/features/recording/functions.ts
@@ -7,7 +7,7 @@ import { JitsiRecordingConstants } from '../base/lib-jitsi-meet';
import { getSoundFileSrc } from '../base/media/functions';
import { getLocalParticipant, getRemoteParticipants } from '../base/participants/functions';
import { registerSound, unregisterSound } from '../base/sounds/actions';
-import { isEmbedded } from '../base/util/embedUtils';
+import { isEmbedded, isEmbeddedFromSameDomain } from '../base/util/embedUtils';
import { isSpotTV } from '../base/util/spot';
import { isInBreakoutRoom as isInBreakoutRoomF } from '../breakout-rooms/functions';
import { isEnabled as isDropboxEnabled } from '../dropbox/functions';
@@ -153,7 +153,7 @@ export function getSessionStatusToShow(state: IReduxState, mode: string): string
* @returns {boolean} - Whether local recording is supported or not.
*/
export function supportsLocalRecording() {
- return LocalRecordingManager.isSupported() && !isEmbedded();
+ return LocalRecordingManager.isSupported() && (!isEmbedded() || isEmbeddedFromSameDomain());
}
/**