diff --git a/android/build.gradle b/android/build.gradle index b59854f..68dae36 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -96,7 +96,7 @@ dependencies { // noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" implementation "org.jetbrains.kotlin:kotlin-stdlib:${ReactNative.ext.getVersion("android", "kotlin")}" - implementation("com.sendbird.sdk:sendbird-calls:1.11.10") + implementation("com.sendbird.sdk:sendbird-calls:1.12.1") } ReactNative.shared.applyPackageVersion() diff --git a/android/src/main/java/com/sendbird/calls/reactnative/module/CallsDirectCallModule.kt b/android/src/main/java/com/sendbird/calls/reactnative/module/CallsDirectCallModule.kt index 45791d2..f461e18 100644 --- a/android/src/main/java/com/sendbird/calls/reactnative/module/CallsDirectCallModule.kt +++ b/android/src/main/java/com/sendbird/calls/reactnative/module/CallsDirectCallModule.kt @@ -191,4 +191,13 @@ class CallsDirectCallModule(private val root: CallsModule): DirectCallModule { CallsUtils.findDirectCall(identifier, from).resumeVideoCapturer() } } + + override fun resumeAudioTrack(type: String, identifier: String) { + val from = "directCall/resumeAudioTrack" + RNCallsLogger.d("[DirectCallModule] $from ($identifier)") + + CallsUtils.safeRun { + CallsUtils.findDirectCall(identifier, from).resumeAudioTrack() + } + } } diff --git a/android/src/main/java/com/sendbird/calls/reactnative/module/CallsGroupCallModule.kt b/android/src/main/java/com/sendbird/calls/reactnative/module/CallsGroupCallModule.kt index 4ae4648..40a77cb 100644 --- a/android/src/main/java/com/sendbird/calls/reactnative/module/CallsGroupCallModule.kt +++ b/android/src/main/java/com/sendbird/calls/reactnative/module/CallsGroupCallModule.kt @@ -138,4 +138,13 @@ class CallsGroupCallModule: GroupCallModule { CallsUtils.findRoom(identifier, from).localParticipant?.resumeVideoCapturer() } } + + override fun resumeAudioTrack(type: String, identifier: String) { + val from = "groupCall/resumeAudioTrack" + RNCallsLogger.d("[GroupCallModule] $from ($identifier)") + + CallsUtils.safeRun { + CallsUtils.findRoom(identifier, from).localParticipant?.resumeAudioTrack() + } + } } diff --git a/android/src/main/java/com/sendbird/calls/reactnative/module/CallsModule.kt b/android/src/main/java/com/sendbird/calls/reactnative/module/CallsModule.kt index 69adc94..b6b03c4 100644 --- a/android/src/main/java/com/sendbird/calls/reactnative/module/CallsModule.kt +++ b/android/src/main/java/com/sendbird/calls/reactnative/module/CallsModule.kt @@ -86,6 +86,7 @@ class CallsModule(val reactContext: ReactApplicationContext) : CallsModuleStruct override fun selectAudioDevice(type: String, identifier: String, device: String, promise: Promise) = getControllableModule(type).selectAudioDevice(type, identifier, device, promise) override fun selectVideoDevice(type: String, identifier: String, device: ReadableMap, promise: Promise) = getControllableModule(type).selectVideoDevice(type, identifier, device, promise) override fun resumeVideoCapturer(type: String, identifier: String) = getControllableModule(type).resumeVideoCapturer(type, identifier) + override fun resumeAudioTrack(type: String, identifier: String) = getControllableModule(type).resumeAudioTrack(type, identifier) /** DirectCall module interface **/ override fun accept(callId: String, options: ReadableMap, holdActiveCall: Boolean, promise: Promise) = directCallModule.accept(callId, options, holdActiveCall, promise) diff --git a/android/src/main/java/com/sendbird/calls/reactnative/module/CallsModuleStruct.kt b/android/src/main/java/com/sendbird/calls/reactnative/module/CallsModuleStruct.kt index 0e15a42..9f6c26f 100644 --- a/android/src/main/java/com/sendbird/calls/reactnative/module/CallsModuleStruct.kt +++ b/android/src/main/java/com/sendbird/calls/reactnative/module/CallsModuleStruct.kt @@ -57,4 +57,5 @@ interface MediaDeviceControl { fun selectAudioDevice(type: String, identifier: String, device: String, promise: Promise) fun selectVideoDevice(type: String, identifier: String, device: ReadableMap, promise: Promise) fun resumeVideoCapturer(type: String, identifier: String) + fun resumeAudioTrack(type: String, identifier: String) } \ No newline at end of file diff --git a/android/src/oldarch/java/com/sendbird/calls/reactnative/RNSendbirdCallsModule.kt b/android/src/oldarch/java/com/sendbird/calls/reactnative/RNSendbirdCallsModule.kt index 7af8120..b0b7bd2 100644 --- a/android/src/oldarch/java/com/sendbird/calls/reactnative/RNSendbirdCallsModule.kt +++ b/android/src/oldarch/java/com/sendbird/calls/reactnative/RNSendbirdCallsModule.kt @@ -93,6 +93,8 @@ class RNSendbirdCallsModule(private val reactContext: ReactApplicationContext) : override fun selectVideoDevice(type: String, identifier: String, device: ReadableMap, promise: Promise) = module.selectVideoDevice(type, identifier, device, promise) @ReactMethod override fun resumeVideoCapturer(type: String, identifier: String) = module.resumeVideoCapturer(type, identifier) + @ReactMethod + override fun resumeAudioTrack(type: String, identifier: String) = module.resumeAudioTrack(type, identifier) /** DirectCall **/ @ReactMethod diff --git a/src/libs/DirectCall.ts b/src/libs/DirectCall.ts index a79d2de..1cc633e 100644 --- a/src/libs/DirectCall.ts +++ b/src/libs/DirectCall.ts @@ -299,6 +299,17 @@ export class DirectCall implements DirectCallProperties, DirectCallMethods { this._binder.nativeModule.resumeVideoCapturer(ControllableModuleType.DIRECT_CALL, this.callId); }; + /** + * Connects the device audio and Sendbird Calls SDK to stream audio. + * + * @platform Android + * @since 1.1.5 + * */ + public android_resumeAudioTrack = () => { + if (Platform.OS !== 'android') return; + this._binder.nativeModule.resumeAudioTrack(ControllableModuleType.DIRECT_CALL, this.callId); + }; + /** * Mutes the audio of local user. * Will trigger {@link DirectCallListener.onRemoteAudioSettingsChanged} method of the remote user. diff --git a/src/libs/Participant.ts b/src/libs/Participant.ts index f89b7e2..4e6bab3 100644 --- a/src/libs/Participant.ts +++ b/src/libs/Participant.ts @@ -171,4 +171,15 @@ export class LocalParticipant extends Participant implements LocalParticipantMet if (Platform.OS !== 'android') return; return this._binder.nativeModule.resumeVideoCapturer(ControllableModuleType.GROUP_CALL, this._roomId); }; + + /** + * Connects the device audio and Sendbird Calls SDK to stream audio. + * + * @platform Android + * @since 1.1.5 + * */ + public android_resumeAudioTrack = () => { + if (Platform.OS !== 'android') return; + return this._binder.nativeModule.resumeAudioTrack(ControllableModuleType.GROUP_CALL, this._roomId); + }; } diff --git a/src/types/Call.ts b/src/types/Call.ts index f4a1827..142ee8f 100644 --- a/src/types/Call.ts +++ b/src/types/Call.ts @@ -338,7 +338,7 @@ type JSDirectCallModule = AsJSDirectCall; type JSDirectCallMediaDeviceControl = AsJSInterface< JSMediaDeviceControl, 'android', - 'selectAudioDevice' | 'resumeVideoCapturer' + 'selectAudioDevice' | 'resumeVideoCapturer' | 'resumeAudioTrack' >; export interface DirectCallMethods extends JSDirectCallModule, JSDirectCallMediaDeviceControl { diff --git a/src/types/NativeModule.ts b/src/types/NativeModule.ts index c19dc7e..454145a 100644 --- a/src/types/NativeModule.ts +++ b/src/types/NativeModule.ts @@ -83,6 +83,8 @@ export interface NativeMediaDeviceControl { selectAudioDevice(type: ControllableModuleType, identifier: string, device: AudioDevice): Promise; /** @platform Android **/ resumeVideoCapturer(type: ControllableModuleType, identifier: string): void; + /** @platform Android **/ + resumeAudioTrack(type: ControllableModuleType, identifier: string): void; } export interface NativeDirectCallModule { diff --git a/src/types/Participant.ts b/src/types/Participant.ts index e567c9d..a042f5a 100644 --- a/src/types/Participant.ts +++ b/src/types/Participant.ts @@ -18,13 +18,19 @@ export interface ParticipantProperties { type JSLocalParticipantMediaDeviceControl = Pick< JSMediaDeviceControl, - 'muteMicrophone' | 'unmuteMicrophone' | 'switchCamera' | 'startVideo' | 'stopVideo' | 'resumeVideoCapturer' + | 'muteMicrophone' + | 'unmuteMicrophone' + | 'switchCamera' + | 'startVideo' + | 'stopVideo' + | 'resumeVideoCapturer' + | 'resumeAudioTrack' >; export type LocalParticipantMethods = AsJSInterface< JSLocalParticipantMediaDeviceControl, 'android', - 'resumeVideoCapturer' + 'resumeVideoCapturer' | 'resumeAudioTrack' >; export enum ParticipantState {