Skip to content

Commit

Permalink
- add setAudioSessionOperationRestriction and `sendCustomReportMess…
Browse files Browse the repository at this point in the history
…age` method
  • Loading branch information
LichKing-2234 committed Oct 12, 2020
1 parent d5af941 commit bace3d3
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## THE CHANGELOG

#### 3.1.3
- fix iOS `deinit` `[weak self]` crash
- make `RtcChannel.channelId` public
- add `setAudioSessionOperationRestriction` and `sendCustomReportMessage` method

#### 3.1.2-rc.2
- fix iOS `deinit` `[weak self]` crash
- fix `engine()` build error
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-agora",
"version": "3.1.2-rc.2",
"version": "3.1.3",
"description": "React Native around the Agora RTC SDKs for Android and iOS agora",
"summary": "agora native sdk for react-native",
"main": "lib/index.js",
Expand Down
26 changes: 26 additions & 0 deletions src/src/Enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2339,3 +2339,29 @@ export enum RtmpStreamingEvent {
*/
FailedLoadImage = 1,
}

/**
* Audio session restriction.
*/
export enum AudioSessionOperationRestriction {
/**
* No restriction, the SDK has full control of the audio session operations.
*/
None = 0,
/**
* The SDK does not change the audio session category.
*/
SetCategory = 1,
/**
* The SDK does not change any setting of the audio session (category, mode, categoryOptions).
*/
ConfigureSession = 1 << 1,
/**
* The SDK keeps the audio session active when leaving a channel.
*/
DeactivateSession = 1 << 2,
/**
* The SDK does not configure the audio session anymore.
*/
All = 1 << 7,
}
31 changes: 31 additions & 0 deletions src/src/RtcEngine.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
AudioReverbType,
AudioSampleRateType,
AudioScenario,
AudioSessionOperationRestriction,
AudioVoiceChanger,
BeautyOptions,
CameraCapturerConfiguration,
Expand Down Expand Up @@ -2276,6 +2277,32 @@ export default class RtcEngine implements RtcEngineInterface {
sendStreamMessage(streamId: number, message: string): Promise<void> {
return RtcEngine._callMethod('sendStreamMessage', {streamId, message})
}

/**
* This function is in the beta stage with a free trial. The ability provided in its beta test version is reporting a maximum of 10 message pieces within 6 seconds, with each message piece not exceeding 256 bytes and each string not exceeding 100 bytes. To try out this function, contact support@agora.io and discuss the format of customized messages with us.
* @param id
* @param category
* @param event
* @param label
* @param value
*/
sendCustomReportMessage(id: string, category: string, event: string, label: string, value: number): Promise<void> {
return RtcEngine._callMethod('sendCustomReportMessage', {id, category, event, label, value})
}

/**
* The SDK and the app can both configure the audio session by default. The app may occasionally use other apps or third-party components to manipulate the audio session and restrict the SDK from doing so. This method allows the app to restrict the SDK’s manipulation of the audio session.
*
* You can call this method at any time to return the control of the audio sessions to the SDK.
*
* **Note**
* - This method restricts the SDK’s manipulation of the audio session. Any operation to the audio session relies solely on the app, other apps, or third-party components.
*
* @param restriction The operational restriction (bit mask) of the SDK on the audio session. See [`AudioSessionOperationRestriction`]{@link AudioSessionOperationRestriction}.
*/
setAudioSessionOperationRestriction(restriction: AudioSessionOperationRestriction): Promise<void> {
return RtcEngine._callMethod('setAudioSessionOperationRestriction', {restriction})
}
}

/**
Expand Down Expand Up @@ -2304,6 +2331,8 @@ interface RtcEngineInterface extends RtcUserInfoInterface, RtcAudioInterface, Rt

getConnectionState(): Promise<ConnectionStateType>

sendCustomReportMessage(id: string, category: string, event: string, label: string, value: number): Promise<void>

getCallId(): Promise<string>

rate(callId: string, rating: Rate, description?: string): Promise<void>
Expand Down Expand Up @@ -2446,6 +2475,8 @@ interface RtcAudioEffectInterface {
resumeEffect(soundId: number): Promise<void>

resumeAllEffects(): Promise<void>

setAudioSessionOperationRestriction(restriction: AudioSessionOperationRestriction): Promise<void>
}

/**
Expand Down

0 comments on commit bace3d3

Please sign in to comment.