Skip to content

Commit

Permalink
optimize ts
Browse files Browse the repository at this point in the history
  • Loading branch information
LichKing-2234 committed Sep 27, 2020
1 parent 4f25232 commit 4808ad9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 241 deletions.
226 changes: 0 additions & 226 deletions src/src/Enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,26 +254,6 @@ export enum AudioProfile {
MusicHighQualityStereo = 5,
}

/**
* Use mode of the `RecordAudioFrame` callback.
*
* //TODO setPlaybackAudioFrameParameters
*/
export enum AudioRawFrameOperationMode {
/**
* 0: Users only read the AudioFrame data without modifying anything. For example, when users acquire data with the Agora SDK then push the RTMP streams.
*/
ReadOnly = 0,
/**
* 1: Users replace the AudioFrame data with their own data and pass them to the SDK for encoding. For example, when users acquire data.
*/
WriteOnly = 1,
/**
* 2: Users read the data from AudioFrame, modify it, and then play it. For example, when users have their own sound-effect processing module and perform some voice pre-processing such as a voice change.
*/
ReadWrite = 2,
}

/**
* Audio recording quality.
*/
Expand Down Expand Up @@ -515,33 +495,6 @@ export enum AudioScenario {
ChatRoomGaming = 5,
}

/**
* Audio session restriction.
*/
//TODO iOS setAudioSessionOperationRestriction
export enum AudioSessionOperationRestriction {
/**
* 0: No restriction, the SDK has full control of the audio session operations.
*/
None = 0,
/**
* 1: The SDK does not change the audio session category.
*/
SetCategory = 1,
/**
* 1 << 1: The SDK does not change any setting of the audio session (category, mode, categoryOptions).
*/
ConfigureSession = 1 << 1,
/**
* 1 << 2: The SDK keeps the audio session active when leaving a channel.
*/
DeactivateSession = 1 << 2,
/**
* 1 << 7: The SDK does not configure the audio session anymore.
*/
All = 1 << 7,
}

/**
* The preset audio voice configuration used to change the voice effect.
*/
Expand Down Expand Up @@ -1491,73 +1444,6 @@ export enum LogFilter {
Critical = 0x0008,
}

/**
* Media device type.
*
*/
//TODO MacOS AgoraMediaDeviceType
export enum MediaDeviceType {
/**
* -1: Unknown device.
*/
AudioUnknown = -1,
/**
* 0: Audio playback device.
*/
AudioPlayout = 0,
/**
* 1: Audio recording device.
*/
AudioRecording = 1,
/**
* 2: Video render device.
*/
VideoRender = 2,
/**
* 3: Video capture device.
*/
VideoCapture = 3,
}

/**
* Media type.
*
*/
//TODO LiveEngine
export enum MediaType {
/**
* 0: No audio and video.
*/
None = 0,
/**
* 1: Audio only.
*/
AudioOnly = 1,
/**
* 2: Video only.
*/
VideoOnly = 2,
/**
* 3: Audio and video.
*/
AudioAndVideo = 3,
}

/**
* The metadata type.
*/
//TODO registerMediaMetadataObserver
export enum MetadataType {
/**
* -1: The metadata type is unknown.
*/
Unknown = -1,
/**
* 0: The metadata type is video.
*/
Video = 0,
}

/**
* Network quality.
*/
Expand Down Expand Up @@ -1634,38 +1520,6 @@ export enum NetworkType {
Mobile4G = 5,
}

/**
* Default camera position.
*
*/
//TODO AgoraRtcDefaultCamera
export enum RtcDefaultCameraPosition {
/**
* 0: Front camera
*/
Front = 0,
/**
* 1: Rear camera
*/
Back = 1,
}

/**
* Lifecycle of the CDN live video stream.
*
*/
//TODO AgoraPublisherConfiguration
export enum RtmpStreamLifeCycle {
/**
* 1: Bound to the channel lifecycle. If all hosts leave the channel, the CDN live streaming stops after 30 seconds.
*/
BindToChannel = 1,
/**
* 2: Bound to the owner of the RTMP stream. If the owner leaves the channel, the CDN live streaming stops immediately.
*/
BindToOwnner = 2,
}

/**
* The detailed error information for streaming.
*/
Expand Down Expand Up @@ -1807,22 +1661,6 @@ export enum UserPriority {
Normal = 100,
}

/**
* Video buffer type.
*
*/
//TODO iOS AgoraVideoSourceProtocol AgoraVideoSinkProtocol
export enum VideoBufferType {
/**
* 1: Use a pixel buffer to transmit the video data.
*/
PixelBuffer = 1,
/**
* 2: Use raw data to transmit the video data.
*/
RawData = 2,
}

/**
* Self-defined video codec profile.
*/
Expand All @@ -1841,26 +1679,6 @@ export enum VideoCodecProfileType {
High = 100,
}

/**
* The content hint for screen sharing.
*
*/
//TODO MacOS setScreenCaptureContentHint
export enum VideoContentHint {
/**
* 0: (Default) No content hint.
*/
None = 0,
/**
* 1: Motion-intensive content. Choose this option if you prefer smoothness or when you are sharing a video clip, movie, or video game.
*/
Motion = 1,
/**
* 2: Motionless content. Choose this option if you prefer sharpness or when you are sharing a picture, PowerPoint slide, or text.
*/
Details = 2,
}

/**
* Video frame rate.
*/
Expand Down Expand Up @@ -2125,26 +1943,6 @@ export enum VideoOutputOrientationMode {
FixedPortrait = 2,
}

/**
* Video pixel format.
*
*/
//TODO iOS AgoraVideoSinkProtocol
export enum VideoPixelFormat {
/**
* 1: I420
*/
I420 = 1,
/**
* 2: BGRA
*/
BGRA = 2,
/**
* 8: NV12
*/
NV12 = 8,
}

/**
* Quality change of the local video in terms of target frame rate and target bit rate since last count.
*/
Expand Down Expand Up @@ -2267,30 +2065,6 @@ export enum VideoRenderMode {
FILL = 4,
}

/**
* Video rotation.
*
*/
//TODO iOS AgoraVideoSourceProtocol AgoraVideoSinkProtocol
export enum VideoRotation {
/**
* 0: No rotation
*/
RotationNone = 0,
/**
* 1: 90 degrees
*/
Rotation90 = 1,
/**
* 2: 180 degrees
*/
Rotation180 = 2,
/**
* 3: 270 degrees
*/
Rotation270 = 3,
}

/**
* Video stream type.
*/
Expand Down
32 changes: 32 additions & 0 deletions src/src/RtcChannel.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
ChannelMediaRelayConfiguration,
ClientRole,
ConnectionStateType,
EncryptionConfig,
EncryptionMode,
LiveInjectStreamConfig,
LiveTranscoding,
Expand Down Expand Up @@ -598,9 +599,35 @@ export default class RtcChannel implements RtcAudioInterface, RtcVideoInterface,
return AgoraRtcChannelModule.unregisterMediaMetadataObserver(this._channelId)
}

/**
* Enables/Disables the built-in encryption.
*
* @since v3.1.2.
*
* In scenarios requiring high security, Agora recommends calling `enableEncryption` to enable the built-in encryption before joining a channel.
*
* All users in the same channel must use the same encryption mode and encryption key. Once all users leave the channel, the encryption key of this channel is automatically cleared.
*
* **Note**
* - If you enable the built-in encryption, you cannot use the RTMP streaming function.
* - Agora supports four encryption modes. If you choose an encryption mode (excepting `SM4128ECB` mode), you need to add an external encryption library when integrating the SDK. For details, see the advanced guide *Channel Encryption*.
*
*
* @param enabled Whether to enable the built-in encryption.
* - `true`: Enable the built-in encryption.
* - `false`: Disable the built-in encryption.
* @param config Configurations of built-in encryption schemas. See [`EncryptionConfig`]{@link EncryptionConfig}.
*/
enableEncryption(enabled: boolean, config: EncryptionConfig): Promise<void> {
return AgoraRtcChannelModule.enableEncryption(enabled, config);
}

/**
* Sets the built-in encryption mode.
*
* @deprecated
* Deprecated as of v3.1.2. Use [`enableEncryption`]{@link enableEncryption} instead.
*
* The Agora SDK supports built-in encryption, which is set to aes-128-xts mode by default.
* Call this method to set the encryption mode to use other encryption modes.
* All users in the same channel must use the same encryption mode and password.
Expand All @@ -619,6 +646,9 @@ export default class RtcChannel implements RtcAudioInterface, RtcVideoInterface,
/**
* Enables built-in encryption with an encryption password before joining a channel.
*
* @deprecated
* Deprecated as of v3.1.2. Use [`enableEncryption`]{@link enableEncryption} instead.
*
* All users in a channel must set the same encryption password.
* The encryption password is automatically cleared once a user leaves the channel.
* If the encryption password is not specified or set to empty, the encryption functionality is disabled.
Expand Down Expand Up @@ -809,6 +839,8 @@ interface RtcEncryptionInterface {
setEncryptionSecret(secret: string): Promise<void>

setEncryptionMode(encryptionMode: EncryptionMode): Promise<void>

enableEncryption(enabled: boolean, config: EncryptionConfig): Promise<void>
}

/**
Expand Down
16 changes: 1 addition & 15 deletions src/src/RtcEngine.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1861,7 +1861,6 @@ export default class RtcEngine implements RtcUserInfoInterface, RtcAudioInterfac

/**
* Unregisters the metadata observer.
*
*/
unregisterMediaMetadataObserver(): Promise<void> {
return AgoraRtcEngineModule.unregisterMediaMetadataObserver()
Expand Down Expand Up @@ -1906,7 +1905,6 @@ export default class RtcEngine implements RtcUserInfoInterface, RtcAudioInterfac

/**
* Removes the watermark image from the video stream added by [`addVideoWatermark`]{@link addVideoWatermark}.
*
*/
clearVideoWatermarks(): Promise<void> {
return AgoraRtcEngineModule.clearVideoWatermarks()
Expand Down Expand Up @@ -1954,19 +1952,7 @@ export default class RtcEngine implements RtcUserInfoInterface, RtcAudioInterfac
* @param encryptionMode Sets the encryption mode.
*/
setEncryptionMode(encryptionMode: EncryptionMode): Promise<void> {
let mode = ''
switch (encryptionMode) {
case EncryptionMode.AES128XTS:
mode = 'aes-128-xts'
break
case EncryptionMode.AES128ECB:
mode = 'aes-128-ecb'
break
case EncryptionMode.AES256XTS:
mode = 'aes-256-xts'
break
}
return AgoraRtcEngineModule.setEncryptionMode(mode)
return AgoraRtcEngineModule.setEncryptionMode(encryptionMode)
}

/**
Expand Down

0 comments on commit 4808ad9

Please sign in to comment.