From ceb30191b3f831fef9d01e26c55fd6a8c44cf998 Mon Sep 17 00:00:00 2001 From: Milosz Filimowski Date: Tue, 17 Feb 2026 15:01:22 +0100 Subject: [PATCH 1/5] fix module resolution --- packages/mobile-client/package.json | 20 ++++++-------------- yarn.lock | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/packages/mobile-client/package.json b/packages/mobile-client/package.json index a1169c63..d850879a 100644 --- a/packages/mobile-client/package.json +++ b/packages/mobile-client/package.json @@ -5,9 +5,8 @@ "license": "Apache-2.0", "author": "Fishjam Team", "main": "./dist/index.js", - "module": "./dist/index.js", "types": "./dist/index.d.ts", - "react-native": "src/index.ts", + "react-native": "dist/index.js", "files": [ "dist/**", "plugin/build/**", @@ -25,29 +24,22 @@ "webrtc", "fishjam" ], - "exports": { - ".": { - "import": "./dist/index.js", - "types": "./dist/index.d.ts" - }, - "./app.plugin": "./app.plugin.js", - "./app.plugin.js": "./app.plugin.js", - "./package.json": "./package.json" - }, "scripts": { "build": "tsc && EXPO_NONINTERACTIVE=1 expo-module build plugin", "lint": "eslint . --ext .ts,.tsx --fix", "prepare": "tsc && EXPO_NONINTERACTIVE=1 expo-module build plugin" }, "peerDependencies": { + "@fishjam-cloud/react-native-webrtc": "0.25.2", "expo": "*", "react": "*", - "react-native": "*" + "react-native": "*", + "react-native-get-random-values": "1.11.0" }, "dependencies": { "@fishjam-cloud/react-client": "workspace:*", - "@fishjam-cloud/react-native-webrtc": "0.25.0", - "react-native-get-random-values": "^1.11.0" + "@fishjam-cloud/react-native-webrtc": "0.25.2", + "react-native-get-random-values": "1.11.0" }, "devDependencies": { "eslint-config-expo": "~9.2.0", diff --git a/yarn.lock b/yarn.lock index 8e78d6c2..801f0d01 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3864,28 +3864,30 @@ __metadata: resolution: "@fishjam-cloud/react-native-client@workspace:packages/mobile-client" dependencies: "@fishjam-cloud/react-client": "workspace:*" - "@fishjam-cloud/react-native-webrtc": "npm:0.25.0" + "@fishjam-cloud/react-native-webrtc": "npm:0.25.2" eslint-config-expo: "npm:~9.2.0" eslint-plugin-prettier: "npm:^5.5.1" expo-module-scripts: "npm:^5.0.7" - react-native-get-random-values: "npm:^1.11.0" + react-native-get-random-values: "npm:1.11.0" peerDependencies: + "@fishjam-cloud/react-native-webrtc": 0.25.2 expo: "*" react: "*" react-native: "*" + react-native-get-random-values: 1.11.0 languageName: unknown linkType: soft -"@fishjam-cloud/react-native-webrtc@npm:0.25.0": - version: 0.25.0 - resolution: "@fishjam-cloud/react-native-webrtc@npm:0.25.0" +"@fishjam-cloud/react-native-webrtc@npm:0.25.2": + version: 0.25.2 + resolution: "@fishjam-cloud/react-native-webrtc@npm:0.25.2" dependencies: base64-js: "npm:1.5.1" debug: "npm:4.3.4" event-target-shim: "npm:6.0.2" peerDependencies: - react-native: "*" - checksum: 10c0/f36e8e6ac6057f0cf0911e408f629255a646e848d8149d1225ade3bf0afdb9bd90a7dc60edbaa152184dd79c7d415796050aef77c19e64541625ca051645376e + react-native: ">=0.60.0" + checksum: 10c0/eef477e684d13dca72018b33561307db90a11395c76c97644afa54c45d6b5c880cae19afc79895922276329830f48b7b38510c0bc999b324f47ef2e474b50ff0 languageName: node linkType: hard @@ -16729,7 +16731,7 @@ __metadata: languageName: node linkType: hard -"react-native-get-random-values@npm:^1.11.0": +"react-native-get-random-values@npm:1.11.0": version: 1.11.0 resolution: "react-native-get-random-values@npm:1.11.0" dependencies: From bd36ce85bb6a66adfdad421b1b1315d1e974ff77 Mon Sep 17 00:00:00 2001 From: Milosz Filimowski Date: Tue, 17 Feb 2026 15:08:39 +0100 Subject: [PATCH 2/5] adjust resolveFishjamUrl to work with RN --- packages/react-client/src/utils/fishjamUrl.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/react-client/src/utils/fishjamUrl.ts b/packages/react-client/src/utils/fishjamUrl.ts index e4428aee..8291aa88 100644 --- a/packages/react-client/src/utils/fishjamUrl.ts +++ b/packages/react-client/src/utils/fishjamUrl.ts @@ -1,11 +1,10 @@ type LivestreamKind = "whip" | "whep"; export function resolveFishjamUrl(fishjamId: string): string { - try { + if (/^https?:\/\//.test(fishjamId)) { return new URL(fishjamId).href; - } catch { - return `https://fishjam.io/api/v1/connect/${fishjamId}`; } + return `https://fishjam.io/api/v1/connect/${fishjamId}`; } export function httpToWebsocketUrl(url: string): string { From bdf77523d6fb0d8f6d23b04d41d7382c10216561 Mon Sep 17 00:00:00 2001 From: Milosz Filimowski Date: Tue, 17 Feb 2026 16:10:45 +0100 Subject: [PATCH 3/5] import binbat dynamically --- packages/ts-client/src/livestream.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/ts-client/src/livestream.ts b/packages/ts-client/src/livestream.ts index a94fdcf6..424a25f5 100644 --- a/packages/ts-client/src/livestream.ts +++ b/packages/ts-client/src/livestream.ts @@ -1,5 +1,5 @@ -import { WHEPClient } from '@binbat/whip-whep/whep'; -import { WHIPClient } from '@binbat/whip-whep/whip'; +// import { WHEPClient } from '@binbat/whip-whep/whep'; +// import { WHIPClient } from '@binbat/whip-whep/whip'; export type ReceiveLivestreamResult = { stream: MediaStream; @@ -21,13 +21,14 @@ export type LivestreamCallbacks = { onConnectionStateChange?: (pc: RTCPeerConnection) => void; }; -export function receiveLivestream(url: string, token?: string, callbacks?: LivestreamCallbacks) { +export async function receiveLivestream(url: string, token?: string, callbacks?: LivestreamCallbacks) { const pc = new RTCPeerConnection({ bundlePolicy: 'max-bundle' }); pc.addTransceiver('video', { direction: 'recvonly' }); pc.addTransceiver('audio', { direction: 'recvonly' }); pc.onconnectionstatechange = (_ev) => callbacks?.onConnectionStateChange?.(pc); + const { WHEPClient } = await import('@binbat/whip-whep/whep'); const whep = new WHEPClient(); return new Promise((resolve, reject) => { @@ -77,6 +78,7 @@ export async function publishLivestream( if (video) pc.addTransceiver(video, { direction: 'sendonly' }); if (audio) pc.addTransceiver(audio, { direction: 'sendonly' }); + const { WHIPClient } = await import('@binbat/whip-whep/whip'); const whip = new WHIPClient(); try { await whip.publish(pc, url, token); From b3800864f552bb35da8261a438a427ce268eff3c Mon Sep 17 00:00:00 2001 From: Milosz Filimowski Date: Tue, 17 Feb 2026 16:13:37 +0100 Subject: [PATCH 4/5] add text encoding polyfill --- packages/mobile-client/package.json | 5 +++-- packages/mobile-client/src/webrtc-polyfill.ts | 1 + yarn.lock | 22 +++++++++++++------ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/packages/mobile-client/package.json b/packages/mobile-client/package.json index d850879a..39d852de 100644 --- a/packages/mobile-client/package.json +++ b/packages/mobile-client/package.json @@ -30,7 +30,7 @@ "prepare": "tsc && EXPO_NONINTERACTIVE=1 expo-module build plugin" }, "peerDependencies": { - "@fishjam-cloud/react-native-webrtc": "0.25.2", + "@fishjam-cloud/react-native-webrtc": "0.25.0", "expo": "*", "react": "*", "react-native": "*", @@ -38,7 +38,8 @@ }, "dependencies": { "@fishjam-cloud/react-client": "workspace:*", - "@fishjam-cloud/react-native-webrtc": "0.25.2", + "@fishjam-cloud/react-native-webrtc": "0.25.0", + "fast-text-encoding": "^1.0.6", "react-native-get-random-values": "1.11.0" }, "devDependencies": { diff --git a/packages/mobile-client/src/webrtc-polyfill.ts b/packages/mobile-client/src/webrtc-polyfill.ts index b18d33a0..4310fada 100644 --- a/packages/mobile-client/src/webrtc-polyfill.ts +++ b/packages/mobile-client/src/webrtc-polyfill.ts @@ -1,3 +1,4 @@ +import 'fast-text-encoding'; import 'react-native-get-random-values'; import { registerGlobals } from '@fishjam-cloud/react-native-webrtc'; diff --git a/yarn.lock b/yarn.lock index 801f0d01..bf799f1a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3864,13 +3864,14 @@ __metadata: resolution: "@fishjam-cloud/react-native-client@workspace:packages/mobile-client" dependencies: "@fishjam-cloud/react-client": "workspace:*" - "@fishjam-cloud/react-native-webrtc": "npm:0.25.2" + "@fishjam-cloud/react-native-webrtc": "npm:0.25.0" eslint-config-expo: "npm:~9.2.0" eslint-plugin-prettier: "npm:^5.5.1" expo-module-scripts: "npm:^5.0.7" + fast-text-encoding: "npm:^1.0.6" react-native-get-random-values: "npm:1.11.0" peerDependencies: - "@fishjam-cloud/react-native-webrtc": 0.25.2 + "@fishjam-cloud/react-native-webrtc": 0.25.0 expo: "*" react: "*" react-native: "*" @@ -3878,16 +3879,16 @@ __metadata: languageName: unknown linkType: soft -"@fishjam-cloud/react-native-webrtc@npm:0.25.2": - version: 0.25.2 - resolution: "@fishjam-cloud/react-native-webrtc@npm:0.25.2" +"@fishjam-cloud/react-native-webrtc@npm:0.25.0": + version: 0.25.0 + resolution: "@fishjam-cloud/react-native-webrtc@npm:0.25.0" dependencies: base64-js: "npm:1.5.1" debug: "npm:4.3.4" event-target-shim: "npm:6.0.2" peerDependencies: - react-native: ">=0.60.0" - checksum: 10c0/eef477e684d13dca72018b33561307db90a11395c76c97644afa54c45d6b5c880cae19afc79895922276329830f48b7b38510c0bc999b324f47ef2e474b50ff0 + react-native: "*" + checksum: 10c0/f36e8e6ac6057f0cf0911e408f629255a646e848d8149d1225ade3bf0afdb9bd90a7dc60edbaa152184dd79c7d415796050aef77c19e64541625ca051645376e languageName: node linkType: hard @@ -11867,6 +11868,13 @@ __metadata: languageName: node linkType: hard +"fast-text-encoding@npm:^1.0.6": + version: 1.0.6 + resolution: "fast-text-encoding@npm:1.0.6" + checksum: 10c0/e1d0381bda229c92c7906f63308f3b9caca8c78b732768b1ee16f560089ed21bc159bbe1434138ccd3815931ec8d4785bdade1ad1c45accfdf27ac6606ac67d2 + languageName: node + linkType: hard + "fastq@npm:^1.6.0": version: 1.19.1 resolution: "fastq@npm:1.19.1" From 787e8af8eeaa949373eb4070d489202fb7536e5b Mon Sep 17 00:00:00 2001 From: Milosz Filimowski Date: Tue, 17 Feb 2026 16:50:38 +0100 Subject: [PATCH 5/5] remove commented imports --- packages/ts-client/src/livestream.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/ts-client/src/livestream.ts b/packages/ts-client/src/livestream.ts index 424a25f5..a00ab1dc 100644 --- a/packages/ts-client/src/livestream.ts +++ b/packages/ts-client/src/livestream.ts @@ -1,6 +1,3 @@ -// import { WHEPClient } from '@binbat/whip-whep/whep'; -// import { WHIPClient } from '@binbat/whip-whep/whip'; - export type ReceiveLivestreamResult = { stream: MediaStream; stop: () => Promise;