Skip to content

Commit

Permalink
feat: add resumeAudioTrack method to javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
bang9 committed Dec 12, 2024
1 parent 7c2a522 commit b000f2e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
11 changes: 11 additions & 0 deletions src/libs/DirectCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 11 additions & 0 deletions src/libs/Participant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
}
2 changes: 1 addition & 1 deletion src/types/Call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ type JSDirectCallModule = AsJSDirectCall<NativeDirectCallModule>;
type JSDirectCallMediaDeviceControl = AsJSInterface<
JSMediaDeviceControl,
'android',
'selectAudioDevice' | 'resumeVideoCapturer'
'selectAudioDevice' | 'resumeVideoCapturer' | 'resumeAudioTrack'
>;

export interface DirectCallMethods extends JSDirectCallModule, JSDirectCallMediaDeviceControl {
Expand Down
2 changes: 2 additions & 0 deletions src/types/NativeModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export interface NativeMediaDeviceControl {
selectAudioDevice(type: ControllableModuleType, identifier: string, device: AudioDevice): Promise<void>;
/** @platform Android **/
resumeVideoCapturer(type: ControllableModuleType, identifier: string): void;
/** @platform Android **/
resumeAudioTrack(type: ControllableModuleType, identifier: string): void;
}

export interface NativeDirectCallModule {
Expand Down
10 changes: 8 additions & 2 deletions src/types/Participant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b000f2e

Please sign in to comment.