Skip to content

Commit

Permalink
feat: support 3.3.0 for TS
Browse files Browse the repository at this point in the history
  • Loading branch information
LichKing-2234 committed Jan 27, 2021
1 parent 81de737 commit fc9dd70
Show file tree
Hide file tree
Showing 12 changed files with 500 additions and 27 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
dependencies {
// noinspection GradleDynamicVersion
api 'com.facebook.react:react-native:+'
api "io.agora.rtc:full-sdk:3.2.1"
api "io.agora.rtc:full-sdk:3.3.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
}
14 changes: 9 additions & 5 deletions example/ios/AgoraExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,21 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-AgoraExample/Pods-AgoraExample-frameworks.sh",
"${PODS_ROOT}/AgoraRtcEngine_iOS/AgoraRtcKit.framework",
"${PODS_ROOT}/AgoraRtcEngine_iOS/Agorafdkaac.framework",
"${PODS_ROOT}/AgoraRtcEngine_iOS/Agoraffmpeg.framework",
"${PODS_ROOT}/AgoraRtcEngine_iOS/AgoraSoundTouch.framework",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraAIDenoiseExtension/AgoraAIDenoiseExtension.framework/AgoraAIDenoiseExtension",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraRtcKit/AgoraRtcKit.framework/AgoraRtcKit",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Agoraffmpeg/Agoraffmpeg.framework/Agoraffmpeg",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraCore/AgoraCore.framework/AgoraCore",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraSoundTouch/AgoraSoundTouch.framework/AgoraSoundTouch",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Agorafdkaac/Agorafdkaac.framework/Agorafdkaac",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraAIDenoiseExtension.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraRtcKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Agorafdkaac.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Agoraffmpeg.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraCore.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraSoundTouch.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Agorafdkaac.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down
5 changes: 4 additions & 1 deletion example/src/examples/advanced/MultiChannel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import RtcEngine, {
ChannelProfile,
ClientRole,
RtcChannel,
RtcEngineConfig,
RtcLocalView,
RtcRemoteView,
VideoRemoteState,
Expand Down Expand Up @@ -56,7 +57,9 @@ export default class MultiChannel extends Component<{}, State, any> {
}

_initEngine = async () => {
this._engine = await RtcEngine.create(config.appId);
this._engine = await RtcEngine.createWithConfig(
new RtcEngineConfig(config.appId)
);

await this._engine.enableVideo();
await this._engine.startPreview();
Expand Down
10 changes: 8 additions & 2 deletions example/src/examples/basic/JoinChannelAudio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import {
Platform,
} from 'react-native';

import RtcEngine, { ChannelProfile, ClientRole } from 'react-native-agora';
import RtcEngine, {
ChannelProfile,
ClientRole,
RtcEngineConfig,
} from 'react-native-agora';

const config = require('../../../agora.config.json');

Expand Down Expand Up @@ -41,7 +45,9 @@ export default class JoinChannelAudio extends Component<{}, State, any> {
}

_initEngine = async () => {
this._engine = await RtcEngine.create(config.appId);
this._engine = await RtcEngine.createWithConfig(
new RtcEngineConfig(config.appId)
);
this._addListeners();

await this._engine.enableAudio();
Expand Down
5 changes: 4 additions & 1 deletion example/src/examples/basic/JoinChannelVideo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import RtcEngine, {
ChannelProfile,
ClientRole,
RtcEngineConfig,
RtcLocalView,
RtcRemoteView,
} from 'react-native-agora';
Expand Down Expand Up @@ -50,7 +51,9 @@ export default class JoinChannelAudio extends Component<{}, State, any> {
}

_initEngine = async () => {
this._engine = await RtcEngine.create(config.appId);
this._engine = await RtcEngine.createWithConfig(
new RtcEngineConfig(config.appId)
);
this._addListeners();

await this._engine.enableVideo();
Expand Down
10 changes: 8 additions & 2 deletions example/src/examples/basic/StringUid.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import React, { Component } from 'react';
import { Button, StyleSheet, TextInput, View } from 'react-native';

import RtcEngine, { ChannelProfile, ClientRole } from 'react-native-agora';
import RtcEngine, {
ChannelProfile,
ClientRole,
RtcEngineConfig,
} from 'react-native-agora';

const config = require('../../../agora.config.json');

Expand Down Expand Up @@ -32,7 +36,9 @@ export default class StringUid extends Component<{}, State, any> {
}

_initEngine = async () => {
this._engine = await RtcEngine.create(config.appId);
this._engine = await RtcEngine.createWithConfig(
new RtcEngineConfig(config.appId)
);
this._addListeners();

await this._engine.setChannelProfile(ChannelProfile.LiveBroadcasting);
Expand Down
2 changes: 1 addition & 1 deletion react-native-agora.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ Pod::Spec.new do |s|
s.swift_version = "4.0"

s.dependency "React"
s.dependency "AgoraRtcEngine_iOS", "3.2.1"
s.dependency "AgoraRtcEngine_iOS", "3.3.0"
end
123 changes: 122 additions & 1 deletion src/common/Classes.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import type {
AreaCode,
AudienceLatencyLevelType,
AudioChannel,
AudioCodecProfileType,
AudioSampleRateType,
CameraCaptureOutputPreference,
CameraDirection,
CaptureBrightnessLevelType,
DegradationPreference,
EncryptionMode,
LastmileProbeResultState,
LighteningContrastLevel,
LogLevel,
NetworkQuality,
VideoCodecProfileType,
VideoCodecType,
Expand Down Expand Up @@ -846,17 +849,33 @@ export class CameraCapturerConfiguration {
* The camera capturer configuration.
*/
preference: CameraCaptureOutputPreference;
/**
* Camera Capture Width
*/
captureWidth?: number;
/**
* Camera Capture Height
*/
captureHeight?: number;
/**
* The camera direction.
*/
cameraDirection: CameraDirection;

constructor(
preference: CameraCaptureOutputPreference,
cameraDirection: CameraDirection
cameraDirection: CameraDirection,
params?: {
captureWidth?: number;
captureHeight?: number;
}
) {
this.preference = preference;
this.cameraDirection = cameraDirection;
if (params) {
this.captureWidth = params.captureWidth;
this.captureHeight = params.captureHeight;
}
}
}

Expand Down Expand Up @@ -1207,6 +1226,10 @@ export interface LocalVideoStats {
* @since v3.1.2.
*/
captureFrameRate: number;
/**
* The capture brightness level type.
*/
captureBrightnessLevel: CaptureBrightnessLevelType;
}

/**
Expand Down Expand Up @@ -1268,6 +1291,14 @@ export interface RemoteAudioStats {
*
*/
publishDuration: number;
/**
* Experience quality: #EXPERIENCE_QUALITY_TYPE
*/
qoeQuality: number;
/**
* The reason for poor experience quality: #EXPERIENCE_POOR_REASON
*/
qualityChangedReason: number;
}

/**
Expand Down Expand Up @@ -1381,3 +1412,93 @@ export class ClientRoleOptions {
this.audienceLatencyLevel = audienceLatencyLevel;
}
}

/**
* TODO(DOC)
* Definition of LogConfiguration
*/
export class LogConfig {
/**
* The log file path, default is NULL for default log path
*/
filePath?: string;
/**
* The log file size, KB , set -1 to use default log size
*/
fileSize?: number;
/**
* The log level, set LOG_LEVEL_INFO to use default log level
*/
level?: LogLevel;

constructor(params?: {
filePath?: string;
fileSize?: number;
level?: LogLevel;
}) {
if (params) {
this.filePath = params.filePath;
this.fileSize = params.fileSize;
this.level = params.level;
}
}
}

/**
* TODO(DOC)
* Data stream config
*/
export class DataStreamConfig {
/**
* syncWithAudio Sets whether or not the recipients receive the data stream sync with current audio stream.
*/
syncWithAudio?: boolean;
/**
* ordered Sets whether or not the recipients receive the data stream in the sent order:
*/
ordered?: boolean;

constructor(params?: { syncWithAudio?: boolean; ordered?: boolean }) {
if (params) {
this.syncWithAudio = params.syncWithAudio;
this.ordered = params.ordered;
}
}
}

/**
* TODO(DOC)
* Definition of RtcEngineConfig.
*/
export class RtcEngineConfig {
/**
* The App ID issued to you by Agora. See [How to get the App ID](https://docs.agora.io/en/Agora%20Platform/token#get-an-app-id).
* Only users in apps with the same App ID can join the same channel and communicate with each other. Use an App ID to create only
* one `IRtcEngine` instance. To change your App ID, call `release` to destroy the current `IRtcEngine` instance and then call `createAgoraRtcEngine`
* and `initialize` to create an `IRtcEngine` instance with the new App ID.
*/
appId: string;
/**
* The region for connection. This advanced feature applies to scenarios that have regional restrictions.
*
* For the regions that Agora supports, see #AREA_CODE. After specifying the region, the SDK connects to the Agora servers within that region.
*
* @note The SDK supports specify only one region.
*/
areaCode?: AreaCode;
/**
* The config for custumer set log path, log size and log level
*/
logConfig?: LogConfig;

constructor(
appId: string,
params?: { areaCode?: AreaCode; logConfig?: LogConfig }
) {
this.appId = appId;
if (params) {
this.areaCode = params.areaCode;
this.logConfig = params.logConfig;
}
}
}
Loading

0 comments on commit fc9dd70

Please sign in to comment.