Open ericlyoung opened 3 months ago
Similar issue to #14 Will be resolved in the next major update 👍🏻
Similar issue to #14 Will be resolved in the next major update 👍🏻
Got any quick hint at how to hack around this for now?
Similar issue to #14 Will be resolved in the next major update 👍🏻
Got any quick hint at how to hack around this for now?
If you're using the new expo router did you try to disable SRR? On app.json switch web output to single.
@8BallBomBom sorry, when this major update is roughly expected?
Similar issue to #14 Will be resolved in the next major update 👍🏻
Got any quick hint at how to hack around this for now?
Here is the patch we use:
diff --git a/node_modules/react-native-webrtc-web-shim/src/react-native-webrtc-web-shim.web.js b/node_modules/react-native-webrtc-web-shim/src/react-native-webrtc-web-shim.web.js
index 7d10049..5b823e6 100644
--- a/node_modules/react-native-webrtc-web-shim/src/react-native-webrtc-web-shim.web.js
+++ b/node_modules/react-native-webrtc-web-shim/src/react-native-webrtc-web-shim.web.js
@@ -1,5 +1,7 @@
import RTCView from './RTCView';
+if (typeof window !== "undefined") {
+
window.MediaStream.prototype.release = function release() {
this.getTracks().forEach((track) => track.stop());
};
@@ -8,6 +10,8 @@ window.MediaStreamTrack.prototype._switchCamera = function _switchCamera() {
console.warn('_switchCamera is not implemented on web.');
};
+}
+
const {
RTCPeerConnection,
RTCIceCandidate,
@@ -18,13 +22,15 @@ const {
RTCErrorEvent,
MediaStream,
MediaStreamTrack,
-} = window;
+} = typeof window !== "undefined" ? window : {};
-const { mediaDevices, permissions } = navigator;
+const { mediaDevices, permissions } = typeof window !== "undefined" ? navigator : {};
function registerGlobals() {
- window.mediaDevices = navigator.mediaDevices;
- window.permissions = navigator.permissions;
+ if (typeof window !== "undefined") {
+ window.mediaDevices = navigator.mediaDevices;
+ window.permissions = navigator.permissions;
+ }
}
export {
Currently focused on the New Arch update for the main repo but hoping to address all outstanding issues on this repo within the next few weeks give or take.
Will need to look into this before deciding the best course of action 🤔
running:
npx expo export -p web
as described on https://docs.expo.dev/distribution/publishing-websites/╰─>$ npx expo export -p web Static rendering is enabled. Learn more Starting Metro Bundler λ Bundled 6747ms (node_modules/expo-router/node/render.js) Web Bundled 6871ms (node_modules/expo-router/entry.js)
Metro error: window is not defined
1 | import RTCView from './RTCView'; 2 |
Call Stack factory (node_modules/react-native-webrtc-web-shim/src/react-native-webrtc-web-shim.web.js:3) loadModuleImplementation (node_modules/metro-runtime/src/polyfills/require.js:342:5) guardedLoadModule (node_modules/metro-runtime/src/polyfills/require.js:240:12) r (node_modules/metro-runtime/src/polyfills/require.js:127:7) factory (node_modules/react-native-webrtc-web-shim/index.js:1) loadModuleImplementation (node_modules/metro-runtime/src/polyfills/require.js:342:5) guardedLoadModule (node_modules/metro-runtime/src/polyfills/require.js:240:12) r (node_modules/metro-runtime/src/polyfills/require.js:127:7) factory (app/calls/[id].js:8) h (node_modules/metro-runtime/src/polyfills/require.js:342:5)