Skip to content

Commit 847dd30

Browse files
feat: move audio route manager inside SDK (#1840)
- Support for audio output device selection - Support to turn off low latency audio output for audio subscriber only usecases like livestream viewership - Support for system wide audio muting and unmuting fixes: #1829 📑 Docs: [https://github.com/GetStream/docs-content/pull/603](https://github.com/GetStream/docs-content/pull/603) --------- Co-authored-by: Oliver Lazoroski <[email protected]>
1 parent 48daf32 commit 847dd30

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3490
-149
lines changed

packages/client/src/devices/SpeakerManager.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,17 @@ export class SpeakerManager {
113113
* @param volume a number between 0 and 1. Set it to `undefined` to use the default volume.
114114
*/
115115
setParticipantVolume(sessionId: string, volume: number | undefined) {
116-
if (isReactNative()) {
117-
throw new Error(
118-
'This feature is not supported in React Native. Please visit https://getstream.io/video/docs/reactnative/core/camera-and-microphone/#speaker-management for more details',
119-
);
120-
}
121116
if (volume && (volume < 0 || volume > 1)) {
122117
throw new Error('Volume must be between 0 and 1, or undefined');
123118
}
124-
this.call.state.updateParticipant(sessionId, { audioVolume: volume });
119+
this.call.state.updateParticipant(sessionId, (p) => {
120+
if (isReactNative() && p.audioStream) {
121+
for (const track of p.audioStream.getAudioTracks()) {
122+
// @ts-expect-error track._setVolume is present in react-native-webrtc
123+
track?._setVolume(volume);
124+
}
125+
}
126+
return { audioVolume: volume };
127+
});
125128
}
126129
}

packages/noise-cancellation-react-native/android/build.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,19 @@ rootProject.allprojects {
7979
}
8080
}
8181

82+
rootProject.allprojects {
83+
repositories {
84+
maven {
85+
name = 'Central Sonatype Portal Snapshots'
86+
url = 'https://oss.sonatype.org/content/repositories/snapshots/'
87+
content {
88+
// This efficiently tells Gradle to only look for this specific dependency here
89+
includeModule('io.getstream', 'stream-video-android-noise-cancellation')
90+
}
91+
}
92+
}
93+
}
94+
8295
repositories {
8396
mavenCentral()
8497
google()

packages/react-native-sdk/__mocks__/react-native-incall-manager.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/react-native-sdk/android/src/main/java/com/streamvideo/reactnative/StreamVideoReactNativeModule.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class StreamVideoReactNativeModule(reactContext: ReactApplicationContext) :
8282
})
8383
}
8484

85+
8586
@ReactMethod
8687
fun getDefaultRingtoneUrl(promise: Promise) {
8788
val defaultRingtoneUri: Uri? =
@@ -131,6 +132,15 @@ class StreamVideoReactNativeModule(reactContext: ReactApplicationContext) :
131132
fun removeListeners(count: Int) {
132133
}
133134

135+
// This method was removed upstream in react-native 0.74+, replaced with invalidate
136+
// We will leave this stub here for older react-native versions compatibility
137+
// ...but it will just delegate to the new invalidate method
138+
@Deprecated("Deprecated in Java", ReplaceWith("invalidate()"))
139+
@Suppress("removal")
140+
override fun onCatalystInstanceDestroy() {
141+
invalidate()
142+
}
143+
134144
override fun invalidate() {
135145
StreamVideoReactNative.clearPipListeners()
136146
reactApplicationContext.unregisterReceiver(powerReceiver)

packages/react-native-sdk/android/src/main/java/com/streamvideo/reactnative/StreamVideoReactNativePackage.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import com.facebook.react.ReactPackage
44
import com.facebook.react.bridge.NativeModule
55
import com.facebook.react.bridge.ReactApplicationContext
66
import com.facebook.react.uimanager.ViewManager
7+
import com.streamvideo.reactnative.callmanager.StreamInCallManagerModule
78

89

910
class StreamVideoReactNativePackage : ReactPackage {
1011
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
11-
return listOf(StreamVideoReactNativeModule(reactContext))
12+
return listOf(StreamVideoReactNativeModule(reactContext), StreamInCallManagerModule(reactContext))
1213
}
1314

1415
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {

0 commit comments

Comments
 (0)