Skip to content

Commit 8c246cc

Browse files
authored
fix: prefer the async apply constraints for flip (#1679)
### Overview This fixes the momentary mirror bug seen on iOS
1 parent a3a6f5a commit 8c246cc

File tree

6 files changed

+21
-24
lines changed

6 files changed

+21
-24
lines changed

packages/client/src/devices/CameraManager.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,14 @@ export class CameraManager extends InputMediaDeviceManager<CameraManagerState> {
3636
if (this.isDirectionSupportedByDevice()) {
3737
if (isReactNative()) {
3838
const videoTrack = this.getTracks()[0];
39-
if (!videoTrack) return;
40-
// @ts-expect-error _switchCamera() is only present in react-native-webrtc 124 and below
41-
if (typeof videoTrack._switchCamera === 'function') {
42-
// @ts-expect-error for older versions of react-native-webrtc support
43-
videoTrack._switchCamera();
44-
} else {
45-
const constraints = {
46-
facingMode: direction === 'front' ? 'user' : 'environment',
47-
};
48-
await videoTrack.applyConstraints(constraints);
39+
if (!videoTrack) {
40+
this.logger('warn', 'No video track found to do direction selection');
41+
return;
4942
}
43+
const constraints = {
44+
facingMode: direction === 'front' ? 'user' : 'environment',
45+
};
46+
await videoTrack.applyConstraints(constraints);
5047
this.state.setDirection(direction);
5148
this.state.setDevice(undefined);
5249
} else {

packages/react-native-sdk/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"@react-native-community/push-notification-ios": ">=1.11.0",
6161
"@react-native-firebase/app": ">=17.5.0",
6262
"@react-native-firebase/messaging": ">=17.5.0",
63-
"@stream-io/react-native-webrtc": ">=125.0.4",
63+
"@stream-io/react-native-webrtc": ">=125.0.5",
6464
"@stream-io/video-filters-react-native": ">=0.1.0",
6565
"expo": ">=47.0.0",
6666
"expo-build-properties": "*",
@@ -121,7 +121,7 @@
121121
"@react-native-firebase/app": "19.2.2",
122122
"@react-native-firebase/messaging": "19.2.2",
123123
"@react-native/eslint-config": "^0.74.84",
124-
"@stream-io/react-native-webrtc": "^125.0.4",
124+
"@stream-io/react-native-webrtc": "^125.0.5",
125125
"@stream-io/video-filters-react-native": "workspace:^",
126126
"@testing-library/jest-native": "^5.4.2",
127127
"@testing-library/react-native": "^12.1.2",

packages/video-filters-react-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
},
4949
"homepage": "https://github.com/GetStream/stream-video-js#readme",
5050
"devDependencies": {
51-
"@stream-io/react-native-webrtc": "^125.0.4",
51+
"@stream-io/react-native-webrtc": "^125.0.5",
5252
"react-native": "0.74.1",
5353
"react-native-builder-bob": "^0.23.2",
5454
"rimraf": "^5.0.7",

sample-apps/react-native/dogfood/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@react-native-google-signin/google-signin": "^11.0.0",
2929
"@react-navigation/native": "^7.0",
3030
"@react-navigation/native-stack": "^7.1",
31-
"@stream-io/react-native-webrtc": "^125.0.4",
31+
"@stream-io/react-native-webrtc": "^125.0.5",
3232
"@stream-io/video-filters-react-native": "workspace:^",
3333
"@stream-io/video-react-native-sdk": "workspace:^",
3434
"axios": "^1.6.0",

sample-apps/react-native/expo-video-sample/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@react-native-community/netinfo": "11.4.1",
1919
"@react-native-firebase/app": "21.6.0",
2020
"@react-native-firebase/messaging": "21.6.0",
21-
"@stream-io/react-native-webrtc": "^125.0.4",
21+
"@stream-io/react-native-webrtc": "^125.0.5",
2222
"@stream-io/video-react-native-sdk": "workspace:^",
2323
"expo": "~52.0.23",
2424
"expo-build-properties": "~0.13.1",

yarn.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8082,7 +8082,7 @@ __metadata:
80828082
"@react-native-firebase/messaging": 21.6.0
80838083
"@rnx-kit/metro-config": ^1.3.14
80848084
"@rnx-kit/metro-resolver-symlinks": ^0.1.34
8085-
"@stream-io/react-native-webrtc": ^125.0.4
8085+
"@stream-io/react-native-webrtc": ^125.0.5
80868086
"@stream-io/video-react-native-sdk": "workspace:^"
80878087
"@types/react": ~18.3.12
80888088
"@types/react-native-incall-manager": ^4
@@ -8168,16 +8168,16 @@ __metadata:
81688168
languageName: node
81698169
linkType: hard
81708170

8171-
"@stream-io/react-native-webrtc@npm:^125.0.4":
8172-
version: 125.0.4
8173-
resolution: "@stream-io/react-native-webrtc@npm:125.0.4"
8171+
"@stream-io/react-native-webrtc@npm:^125.0.5":
8172+
version: 125.0.5
8173+
resolution: "@stream-io/react-native-webrtc@npm:125.0.5"
81748174
dependencies:
81758175
base64-js: 1.5.1
81768176
debug: 4.3.4
81778177
event-target-shim: 6.0.2
81788178
peerDependencies:
81798179
react-native: ">=0.60.0"
8180-
checksum: 3f26100800a4859d41621a37f7cd68d68e90dd536ca70fb70725846aae6cc4d556e21c3fc16c110a02ed95c46d3c3c0be1cdd5a2b7a5d01f7068682a43c6071e
8180+
checksum: 44ae6df27a81d84fa6a01f9c513b0b71fd8565a04ccd20f1e797f5bb671529367c68cd3d7b9807762dd6a128c1e4ac241723fe5d38cb56bd79b4aa96e894e1d1
81818181
languageName: node
81828182
linkType: hard
81838183

@@ -8253,7 +8253,7 @@ __metadata:
82538253
version: 0.0.0-use.local
82548254
resolution: "@stream-io/video-filters-react-native@workspace:packages/video-filters-react-native"
82558255
dependencies:
8256-
"@stream-io/react-native-webrtc": ^125.0.4
8256+
"@stream-io/react-native-webrtc": ^125.0.5
82578257
react-native: 0.74.1
82588258
react-native-builder-bob: ^0.23.2
82598259
rimraf: ^5.0.7
@@ -8394,7 +8394,7 @@ __metadata:
83948394
"@rnx-kit/babel-preset-metro-react-native": ^1.1.3
83958395
"@rnx-kit/metro-config": ^1.3.3
83968396
"@rnx-kit/metro-resolver-symlinks": ^0.1.22
8397-
"@stream-io/react-native-webrtc": ^125.0.4
8397+
"@stream-io/react-native-webrtc": ^125.0.5
83988398
"@stream-io/video-filters-react-native": "workspace:^"
83998399
"@stream-io/video-react-native-sdk": "workspace:^"
84008400
"@types/eslint": ^8.56.10
@@ -8446,7 +8446,7 @@ __metadata:
84468446
"@react-native-firebase/app": 19.2.2
84478447
"@react-native-firebase/messaging": 19.2.2
84488448
"@react-native/eslint-config": ^0.74.84
8449-
"@stream-io/react-native-webrtc": ^125.0.4
8449+
"@stream-io/react-native-webrtc": ^125.0.5
84508450
"@stream-io/video-client": "workspace:*"
84518451
"@stream-io/video-filters-react-native": "workspace:^"
84528452
"@stream-io/video-react-bindings": "workspace:*"
@@ -8488,7 +8488,7 @@ __metadata:
84888488
"@react-native-community/push-notification-ios": ">=1.11.0"
84898489
"@react-native-firebase/app": ">=17.5.0"
84908490
"@react-native-firebase/messaging": ">=17.5.0"
8491-
"@stream-io/react-native-webrtc": ">=125.0.4"
8491+
"@stream-io/react-native-webrtc": ">=125.0.5"
84928492
"@stream-io/video-filters-react-native": ">=0.1.0"
84938493
expo: ">=47.0.0"
84948494
expo-build-properties: "*"

0 commit comments

Comments
 (0)