diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 5d401a7da..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,98 +0,0 @@ -version: 2.1 - -executors: - default: - docker: - - image: circleci/node:10 - working_directory: ~/project - -commands: - attach_project: - steps: - - attach_workspace: - at: ~/project - -jobs: - install-dependencies: - executor: default - steps: - - checkout - - attach_project - - restore_cache: - keys: - - dependencies-{{ checksum "package.json" }} - - dependencies- - - restore_cache: - keys: - - dependencies-example-{{ checksum "example/package.json" }} - - dependencies-example- - - run: - name: Install dependencies - command: | - yarn install --cwd example --frozen-lockfile - yarn install --frozen-lockfile - - save_cache: - key: dependencies-{{ checksum "package.json" }} - paths: node_modules - - save_cache: - key: dependencies-example-{{ checksum "example/package.json" }} - paths: example/node_modules - - persist_to_workspace: - root: . - paths: . - - lint: - executor: default - steps: - - attach_project - - run: - name: Lint files - command: | - yarn lint - - typescript: - executor: default - steps: - - attach_project - - run: - name: Typecheck files - command: | - yarn typescript - - unit-tests: - executor: default - steps: - - attach_project - - run: - name: Run unit tests - command: | - yarn test --coverage - - store_artifacts: - path: coverage - destination: coverage - - build-package: - executor: default - steps: - - attach_project - - run: - name: Build package - command: | - yarn prepare - -workflows: - build-and-test: - jobs: - - install-dependencies - - lint: - requires: - - install-dependencies - - typescript: - requires: - - install-dependencies - - unit-tests: - requires: - - install-dependencies - - build-package: - requires: - - install-dependencies diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 65365be68..000000000 --- a/.editorconfig +++ /dev/null @@ -1,15 +0,0 @@ -# EditorConfig helps developers define and maintain consistent -# coding styles between different editors and IDEs -# editorconfig.org - -root = true - -[*] - -indent_style = space -indent_size = 2 - -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index e27f70fa4..000000000 --- a/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -*.pbxproj -text -# specific for windows script files -*.bat text eol=crlf diff --git a/.gitignore b/.gitignore index c4fdeaf0a..9f11b755a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,66 +1 @@ -# OSX -# -.DS_Store - -# XDE -.expo/ - -# VSCode -.vscode/ -jsconfig.json - -# Xcode -# -build/ -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata -*.xccheckout -*.moved-aside -DerivedData -*.hmap -*.ipa -*.xcuserstate -project.xcworkspace - -# Android/IJ -# -.idea -.gradle -local.properties -android.iml - -# Cocoapods -# -example/ios/Pods -example/ios/Podfile.lock - -# node.js -# -node_modules/ -npm-debug.log -yarn-debug.log -yarn-error.log -package-lock.json -yarn.lock - -# BUCK -buck-out/ -\.buckd/ -android/app/libs -android/keystores/debug.keystore -docs/api/ -gitpull.sh -gitpush.sh - -# Expo -.expo/* - -# generated by bob -lib/ +.idea/ diff --git a/.npmignore b/.npmignore deleted file mode 100644 index d880c2da3..000000000 --- a/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -docs/ -example/ -src/ diff --git a/ios/RCTAgora/Base/AgoraRtcEngineKit.h b/AgoraRtcEngineKit.h similarity index 100% rename from ios/RCTAgora/Base/AgoraRtcEngineKit.h rename to AgoraRtcEngineKit.h diff --git a/ios/RCTAgora/Base/BeanCovertor.swift b/BeanCovertor.swift similarity index 100% rename from ios/RCTAgora/Base/BeanCovertor.swift rename to BeanCovertor.swift diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 216931cb3..000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,370 +0,0 @@ -## [3.3.2-rc.0](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.3.1...v3.3.2-rc.0) (2021-03-19) - - -### Bug Fixes - -* support react-native 0.64.0 close [#334](https://github.com/AgoraIO-Community/react-native-agora/issues/334) ([0140754](https://github.com/AgoraIO-Community/react-native-agora/commit/014075441ec3479e7abe84768c3e00b1da2d97fc)) - -## [3.3.1](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.3.1-rc.0...v3.3.1) (2021-03-12) - -## [3.3.1-rc.0](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.3.0-rc.1...v3.3.1-rc.0) (2021-03-09) - - -### Bug Fixes - -* annotation build warning ([551ebfe](https://github.com/AgoraIO-Community/react-native-agora/commit/551ebfe3c8dec34cfdf7e006d38523c60123bc58)) -* type cast error ([f5af6dc](https://github.com/AgoraIO-Community/react-native-agora/commit/f5af6dc9cec642dd3ae5d1507913141e95dbb71f)) -* type cast error ([98c4331](https://github.com/AgoraIO-Community/react-native-agora/commit/98c4331bd97ab1e2dc7216470fc2978c5d4dcd74)) - - -### Features - -* add example for `playEffect` ([7987121](https://github.com/AgoraIO-Community/react-native-agora/commit/7987121ff2822c053f327ccdeb60ff17202f6c53)) -* support 3.3.1 for Android ([cd7a2cd](https://github.com/AgoraIO-Community/react-native-agora/commit/cd7a2cdaff747cad9d2e386d79589c7299036ff6)) -* support 3.3.1 for iOS ([836f3b4](https://github.com/AgoraIO-Community/react-native-agora/commit/836f3b4c87f0c0a478c135a4a6ed0ed4279a446e)) -* support 3.3.1 for TS ([b7a1d00](https://github.com/AgoraIO-Community/react-native-agora/commit/b7a1d006bbbd6a635b8cee18c4a50c4a1ab5bbdd)) - -# [3.3.0-rc.1](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.3.0-rc.0...v3.3.0-rc.1) (2021-01-28) - - -### Bug Fixes - -* type error ([1ffd0f8](https://github.com/AgoraIO-Community/react-native-agora/commit/1ffd0f8923b2968d1d908d4c672ab8c40072635e)) - -# [3.3.0-rc.0](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.2.2...v3.3.0-rc.0) (2021-01-28) - - -### Features - -* support 3.3.0 for Android ([9c48594](https://github.com/AgoraIO-Community/react-native-agora/commit/9c485942661c0e60c8413f9088b4ed0fa37ae2da)) -* support 3.3.0 for iOS ([b422ce8](https://github.com/AgoraIO-Community/react-native-agora/commit/b422ce8e8660067075317e4f0f16a29f5a49b6b7)) -* support 3.3.0 for TS ([fc9dd70](https://github.com/AgoraIO-Community/react-native-agora/commit/fc9dd70fd32402f5eed281b4007ffd3aacaf51e0)) - -## [3.2.2](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.2.1...v3.2.2) (2020-12-28) - - -### Bug Fixes - -* process resolve value type ([d28c79d](https://github.com/AgoraIO-Community/react-native-agora/commit/d28c79d18338604cbc6e723baedd9618e8a11374)) - -## [3.2.1](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.2.0...v3.2.1) (2020-12-24) - -## [3.2.0](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.2.0-rc.0...v3.2.0) (2020-12-23) - - -### Features - -* upgrade native SDK to 3.2.1 ([3dcc489](https://github.com/AgoraIO-Community/react-native-agora/commit/3dcc489bb52daaf8a794554f6048f343cbff5d8f)) - -## [3.2.0-rc.0](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.1.6...v3.2.0-rc.0) (2020-12-21) - - -### Features - -* add `setClientRole(role: ClientRole, options?: ClientRoleOptions): Promise` ([721604e](https://github.com/AgoraIO-Community/react-native-agora/commit/721604ee94c3f7e3a0485b5b5db7fb5973e30665)) -* add `setClientRole(role: ClientRole, options?: ClientRoleOptions): Promise` ([2fef3ae](https://github.com/AgoraIO-Community/react-native-agora/commit/2fef3aee038b31808af53cee80a0fddc8d444fe8)) -* add `setClientRole(role: ClientRole, options?: ClientRoleOptions): Promise` ([3a55997](https://github.com/AgoraIO-Community/react-native-agora/commit/3a55997db81dcd16e68ee551d69b9079ff8052b0)) -* upgrade to 3.2.0 ([fcb57cc](https://github.com/AgoraIO-Community/react-native-agora/commit/fcb57cc3e2cbb3e16750e9ce8ddca069184ac1c0)) -* upgrade to 3.2.0 ([4ee51a9](https://github.com/AgoraIO-Community/react-native-agora/commit/4ee51a9b405deb17b467f5359f6717033c3961a2)) -* upgrade to 3.2.0 ([680048f](https://github.com/AgoraIO-Community/react-native-agora/commit/680048f7836940f586ce7228559ba2cde9e0de62)) - -## [3.1.7](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.1.6...v3.1.7) (2020-12-28) - - -### Bug Fixes - -* process resolve value type ([d28c79d](https://github.com/AgoraIO-Community/react-native-agora/commit/d28c79d18338604cbc6e723baedd9618e8a11374)) - -## [3.1.6](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.1.5...v3.1.6) (2020-12-21) - - -### Bug Fixes - -* `MetadataReceived` event parameters bug ([bda6ec0](https://github.com/AgoraIO-Community/react-native-agora/commit/bda6ec081ab95fd3295de89d4bdfe0bcb4b2a0a2)) -* some rendering problems when change render widget order ([12e2561](https://github.com/AgoraIO-Community/react-native-agora/commit/12e25618ce8fabd5bf9b34e418792450518e219e)) -* some rendering problems when change render widget order ([c737102](https://github.com/AgoraIO-Community/react-native-agora/commit/c737102ecc22e3cb563f9762a88d9b519fdc599f)) -* use the better way to fix rendering problems ([f0c044f](https://github.com/AgoraIO-Community/react-native-agora/commit/f0c044f7248f5c301c7dec087aa33a9941f10fca)) - - -### Features - -* example support render multi remote-videos ([af68969](https://github.com/AgoraIO-Community/react-native-agora/commit/af68969cf18b355cae22fe5999ae9b00c912c879)) - -## [3.1.5](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.1.4...v3.1.5) (2020-12-15) - - -### Bug Fixes - -* `RtcSurfaceView` memory leak ([c8845fe](https://github.com/AgoraIO-Community/react-native-agora/commit/c8845fe04c1596fe2e7242302bf160bc671910cb)) - - -### Features - -* example support `switchRender` ([a6a509e](https://github.com/AgoraIO-Community/react-native-agora/commit/a6a509e273f64c67dce67fc61a9451d5b0ffeb70)), closes [#309](https://github.com/AgoraIO-Community/react-native-agora/issues/309) - -## [3.1.4](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.1.4-rc.1...v3.1.4) (2020-12-02) - - -### Bug Fixes - -* `JoinChannelSuccess` `RejoinChannelSuccess` type in `RtcChannelEvents` ([25cf253](https://github.com/AgoraIO-Community/react-native-agora/commit/25cf2536df117bdd0b3fcb4d4e91f099f9649487)) -* miss `uid` in `StreamSubscribeStateCallback` ([9bc680f](https://github.com/AgoraIO-Community/react-native-agora/commit/9bc680f1ee7a6b7e3926a7e29847013950841d84)) -* RtcChannel `destroyAll` ([d647049](https://github.com/AgoraIO-Community/react-native-agora/commit/d6470492b25116054fd7969ad8d408ce34fce6c2)) - -## [3.1.4-rc.1](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.1.4-rc.0...v3.1.4-rc.1) (2020-10-22) - - -### Bug Fixes - -* Android setData error ([69a7a96](https://github.com/AgoraIO-Community/react-native-agora/commit/69a7a96ec35037f5dbcc5a0e67285eb1d4c59c08)) - - -### Features - -* add API example ([652c346](https://github.com/AgoraIO-Community/react-native-agora/commit/652c346821f63546aaaa1cf7b677781b87dd87b2)) -* Android add getNativeHandle ([0eab471](https://github.com/AgoraIO-Community/react-native-agora/commit/0eab47114cde933482f90879e177fd019430cafd)) -* js add getNativeHandle ([201c82a](https://github.com/AgoraIO-Community/react-native-agora/commit/201c82a66fe86eee86d24b2188b9bfd5ecaca04f)) - -## [3.1.4-rc.0](https://github.com/AgoraIO-Community/react-native-agora/compare/3.1.3...v3.1.4-rc.0) (2020-10-21) - - -### Features - -* migrating to @react-native-community/bob ([c72a527](https://github.com/AgoraIO-Community/react-native-agora/commit/c72a5278b2e990081d34e2e765e2e6a26ba792bb)) - -## 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 - -## 3.1.2-rc.1 - - make `RtcChannel.channelId` public - -## 3.1.2 - - support 3.1.2 native sdk - - fix `RejoinChannelSuccess` bug - -## 3.0.1 - - release version - -## 3.0.1-rc.5 - - fix `Xcode10` `Swift4` compile error - -## 3.0.1-rc.4 - - fix crash when rendering view without `channelId` property - - fix `RtcLocalView` freezes after rendering remote view - -## 3.0.1-rc.3 - - fix multiple channel render bug - - remove `Types` from export, you can import enum or class by `import {} from 'react-native-agora'` - - optimize ts code and doc - -## 3.0.1-rc.2 - - add `startPreview` `stopPreview` - -## 3.0.1-rc.1 - - prerelease 3.0.1-rc.1 - -## 3.0.1-beta.9 - - add `constructor` for typescript - - fix Android `mapToChannelMediaInfo` crash - - fix iOS `switchChannel` `sendMetadata` crash - -## 3.0.1-beta.8 - - fix iOS event warn - - fix ts array declare error - -## 3.0.1-beta.7 - - fix lib ignore bug - -## 3.0.1-beta.6 - - support 3.0.1.1 native sdk - - fix iOS `RtcChannelEvent` `NetworkQuality` crash - -## 3.0.1-beta.5 - - fix lib ignore bug - -## 3.0.1-beta.4 - - fix android `setCameraCapturerConfiguration` bug - -## 3.0.1-beta.3 - - fix iOS `mirrorMode` bug - -## 3.0.1-beta.2 - - fix `createWithAreaCode` bug - - fix render black screen bug - -## 3.0.1-beta.1 - - support 3.0.1 native sdk - -## 3.0.0-beta.6 - - fix iOS link bug - -## 3.0.0-beta.5 - - optimize doc - -## 3.0.0-beta.4 - - optimize code - -## 3.0.0-beta.3 - - optimize doc - -## 3.0.0-beta.2 - - optimize - -## 3.0.0-beta.1 - - support 3.0.0 native sdk - -## 2.9.1-alpha.7 - - fix `setBeautyEffectOptions` bugs - -## 2.9.1-alpha.6 - - fix bugs - -## 2.9.1-alpha.5 - - upgrade android sdk to 2.9.4 - -## 2.9.1-alpha.4 - - remove `AgoraRtcCryptoLoader` `libcrypto` - -## 2.9.1-alpha.3 - - upgrade android sdk to 2.9.4 - -## 2.9.1-alpha.2 - - upgrade 2.9.2 fro android - -## 2.9.1-alpha.1 - - support 2.9.1 native sdk - -## 2.9.0-alpha.3 - - hotfix ios compile error - -## 2.9.0-alpha.2 - - fix ios dictionary stringValue type cast - -## 2.9.0-alpha.1 - - fix typo: rename `methodisSpeakerphoneEnabled` to `isSpeakerphoneEnabled` - - events deprecated & instead: - * `microphoneEnabled` instead `localAudioStateChanged` - * `audioTransportStatsOfUid` instead `remoteAudioStats` - * `videoTransportStatsOfUid` instead `remoteVideoStats` - * `userMuteVideo`, `userEnableVideo`, `userEnableLocalVideo` & `firstRemoteVideoDecoded` instead `remoteVideoStateChanged` - - events enhancement: - * `rtcStats`, `leaveChannel` add channel stats `txAudioBytes`, `txVideoBytes`, `rxAudioBytes`, `rxVideoBytes`, `txPacketLossRate`, `rxPacketLossRate` - - new events: - * `remoteAudioStateChanged` subscribe for remote audio state - * `localAudioStateChanged` subscribe for local audio state - * `localAudioStats` subscribe for local audio stats - * `mediaRelayStateChanged`, `receivedChannelMediaRelay` - - new apis: - * `switchChannel` switch to specified channel - * `startChannelMediaRelay`, `updateChannelMediaRelay`, `stopChannelMediaRelay`, `removeChannelMediaRelay` relay media streams operation for across channels. - -## 2.8.0-alpha.1 - - add `string uid` api support - - android: deprecate `lowLatency` member of LiveTranscoding - - add methods `getUserInfoByUserAccount`, `getUserInfoByUid`, `joinChannelWithUserAccount`, `registerLocalUserAccount` - - add events `localUserRegistered`, `userInfoUpdated` - - add `totalFrozenTime`, `frozenRate` to events `remoteVideoStats` & `remoteAudioStats`. - - add `numChannels` & `receivedSampleRate` & `receivedBitrate` to `remoteAudioStats` - - android: upgrade native sdk to 2.8.2 - - ios: upgrade native sdk to 2.8.0 - -## 2.4.1-alpha.3 -- refactor setLiveTranscoding: rename ios & android native parameters. export enum for javascript/typescript api. -- fix negative number case in android platform. -- improve api doc. - -## 2.4.1-alpha.2 -- deprecated `sendMessage` & `createDataStream` & `removeAllListeners` & `off` -- refactor event system -- fix `android` enum convert failed. - -## 2.4.1-alpha -- support 2.4.1-alpha.1 agora video sdk android-2.4.1 / iOS-2.4.1 - 1. Deprecate iOS manual link operator, instead using cocoapods resolve compile dependencies. - 2. Add methods getAudioMixingPlayoutVolume, getAudioMixingPublishVolume for audio mixing troubleshooting. - 3. Add `txPacketLossRate`, `rxPacketLossRate` on `rtcStats` interface. usage: `RtcEngine.on('rtcStats', (data) => console.log(data))`. - 4. Rename `receivedFrameRate` to `rendererOutputFrameRate` this property related on `localVideoStats` and `remoteVideoStats`. - 5. Add event 'localVideoChanged' and Deprecate events `cameraReady` and `videoStopped`. You can listen `localVideoChanged` event instead `cameraReady` & `videoStopped`. - 6. Add event `rtmpStreamingStateChanged` for rtmp streaming troubleshooting - 7. Add event `audioCodecProfile` on `liveTranscoding` interface. - 8. Add event `networkTypeChanged` for network troubleshooting. - 9. Add method `registerMediaMetadataObserver` method, this method enables you to add synchronized metadata in the video stream for more diversified live broadcast interactions, such as sending shopping links, digital coupons, and online quizzes. note: Call this method before the joinChannel method. and applies to `channelProfile` with 1. - 10. Add method `sendMediaData`, this method enables you send media data under the live broadcast mode (`channelProfile` = 1) note: call this method after the `registerMediaMetadataObserver` method. - 11. Add event `audioMixingStateChanged` and Deprecate event 'localAudioMixingFinish`. - 11. Add `firstRemoteAudioDecoded` event you can get more detail [here](https://docs.agora.io/en/Interactive%20Broadcast/release_android_video?platform=Android#v241) - -## 2.4.0-alpha -- support 2.4.0-alpha.1 agora video sdk android-2.4.0 / iOS-2.4.0.1 and add sendMessage support in the same channel. Deprecate: startEchoTest and setVideoQualityParameters -- support 2.4.0-alpha.2 using 0.55.1 as peerDependency and support typescript -- support 2.4.0-alpha.3 bugfix iOS receiveStreamMessage data is null -- support 2.4.0-alpha.4 bugfix iOS videoSizeChanged field rotation typo -- support 2.4.0-alpha.5 bugfix Android & iOS side not support fit mode and hidden mode. - 1. Deprecate & Remove: setupLocalVideo & setupRemoteVideo - 2. rename iOS side constants - ``` - "AgoraVideoMirrorModeAuto" to "VideoMirrorModeAuto" - "AgoraVideoMirrorModeEnabled" to "VideoMirrorModeEnabled" - "AgoraVideoMirrorModeDisabled" to "VideoMirrorModeDisabled" - "AgoraChannelProfileCommunication" to "ChannelProfileCommunication" - "AgoraChannelProfileLiveBroadcasting" to "ChannelProfileLiveBroadcasting" - "AgoraChannelProfileGame" to "ChannelProfileGame" - "AgoraVideoMode" to "VideoMode" - "AgoraAudioMode" to "AudioMode" - ``` - -## 2.3.3-alpha -- support agora video sdk 2.3.3 -- release 2.3.3-alpha.3 -- release 2.3.3-alpha.4 (remove deprecated native api) -- release 2.3.3-alpha.5 (refactor event react api & refactor native wrapper) -- release 2.3.3-alpha.6 (refactor with typescript & fix. iOS platform binding bug) -- release 2.3.3-alpha.7 (refactor RtcEngine#init method support audio / video mode and switch dualStream) - - -## 1.1.2 -- add onVideoMute -- add onAudioMute - -## 1.1.1 - -- add createDataStream -- add sendStreamMessage -- add onStreamMessage - -## 1.0.9 - -- update to agora sdk version 2.0.2 - -- add setCameraAutoFocusFaceModeEnabled - -- add setDefaultAudioRouteToSpeakerphone - -- add setCameraTorchOn - -- fix bug: Android speaker's volume indication - -## 1.0.8 - - - update to agora sdk version 1.12 - - - init wouldn't start video preview. Should manually use startPreview. - - - init options add new boolean parameter `swapWidthAndHeight` to support swap width and height. - - - add configPublisher - - - add setLocalRenderMode - - - add setRemoteRenderMode - - - add enableAudioVolumeIndication - - - add onAudioVolumeIndication - - - add zOrderMediaOverlay for android platform, support media overlay diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 73385c182..000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,184 +0,0 @@ -# Contributing - -We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. - -## Development workflow - -To get started with the project, run `yarn bootstrap` in the root directory to install the required dependencies for each package: - -```sh -yarn bootstrap -``` - -While developing, you can run the [example app](/example/) to test your changes. - -To start the packager: - -```sh -yarn example start -``` - -To run the example app on Android: - -```sh -yarn example android -``` - -To run the example app on iOS: - -```sh -yarn example ios -``` - -Make sure your code passes TypeScript and ESLint. Run the following to verify: - -```sh -yarn typescript -yarn lint -``` - -To fix formatting errors, run the following: - -```sh -yarn lint --fix -``` - -Remember to add tests for your change if possible. Run the unit tests by: - -```sh -yarn test -``` - -To edit the Objective-C files, open `example/ios/AgoraExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-agora`. - -To edit the Kotlin files, open `example/android` in Android studio and find the source files at `react-native-agora` under `Android`. - -### Commit message convention - -We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages: - -- `fix`: bug fixes, e.g. fix crash due to deprecated method. -- `feat`: new features, e.g. add new method to the module. -- `refactor`: code refactor, e.g. migrate from class components to hooks. -- `docs`: changes into documentation, e.g. add usage example for the module.. -- `test`: adding or updating tests, eg add integration tests using detox. -- `chore`: tooling changes, e.g. change CI config. - -Our pre-commit hooks verify that your commit message matches this format when committing. - -### Linting and tests - -[ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/) - -We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing. - -Our pre-commit hooks verify that the linter and tests pass when committing. - -### Scripts - -The `package.json` file contains various scripts for common tasks: - -- `yarn bootstrap`: setup project by installing all dependencies and pods. -- `yarn typescript`: type-check files with TypeScript. -- `yarn lint`: lint files with ESLint. -- `yarn test`: run unit tests with Jest. -- `yarn example start`: start the Metro server for the example app. -- `yarn example android`: run the example app on Android. -- `yarn example ios`: run the example app on iOS. - -### Sending a pull request - -> **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github). - -When you're sending a pull request: - -- Prefer small pull requests focused on one change. -- Verify that linters and tests are passing. -- Review the documentation to make sure it looks good. -- Follow the pull request template when opening a pull request. -- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue. - -## Code of Conduct - -### Our Pledge - -We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. - -We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. - -### Our Standards - -Examples of behavior that contributes to a positive environment for our community include: - -- Demonstrating empathy and kindness toward other people -- Being respectful of differing opinions, viewpoints, and experiences -- Giving and gracefully accepting constructive feedback -- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience -- Focusing on what is best not just for us as individuals, but for the overall community - -Examples of unacceptable behavior include: - -- The use of sexualized language or imagery, and sexual attention or - advances of any kind -- Trolling, insulting or derogatory comments, and personal or political attacks -- Public or private harassment -- Publishing others' private information, such as a physical or email - address, without their explicit permission -- Other conduct which could reasonably be considered inappropriate in a - professional setting - -### Enforcement Responsibilities - -Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. - -Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. - -### Scope - -This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. - -### Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly. - -All community leaders are obligated to respect the privacy and security of the reporter of any incident. - -### Enforcement Guidelines - -Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: - -#### 1. Correction - -**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. - -**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. - -#### 2. Warning - -**Community Impact**: A violation through a single incident or series of actions. - -**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. - -#### 3. Temporary Ban - -**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. - -**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. - -#### 4. Permanent Ban - -**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. - -**Consequence**: A permanent ban from any sort of public interaction within the community. - -### Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, -available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. - -Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). - -[homepage]: https://www.contributor-covenant.org - -For answers to common questions about this code of conduct, see the FAQ at -https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. diff --git a/ios/RCTAgora/Base/Callback.swift b/Callback.swift similarity index 100% rename from ios/RCTAgora/Base/Callback.swift rename to Callback.swift diff --git a/ios/RCTAgora/Base/Extensions.swift b/Extensions.swift similarity index 100% rename from ios/RCTAgora/Base/Extensions.swift rename to Extensions.swift diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 3f51f06a8..000000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 syanbo luxuhui - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/ios/RCTAgora/Base/MediaObserver.swift b/MediaObserver.swift similarity index 100% rename from ios/RCTAgora/Base/MediaObserver.swift rename to MediaObserver.swift diff --git a/README.md b/README.md deleted file mode 100644 index fd31cf311..000000000 --- a/README.md +++ /dev/null @@ -1,160 +0,0 @@ -# react-native-agora - -[![npm](https://img.shields.io/npm/v/react-native-agora.svg)](https://www.npmjs.com/package/react-native-agora) -[![npm](https://img.shields.io/npm/dm/react-native-agora.svg)](https://www.npmjs.com/package/react-native-agora) -[![npm](https://img.shields.io/npm/dt/react-native-agora.svg)](https://www.npmjs.com/package/react-native-agora) -[![npm](https://img.shields.io/npm/l/react-native-agora.svg)](LICENSE) - -[中文](README.zh.md) - -This SDK takes advantage of React Native and Agora RTC Video SDK on Android && iOS. - -## Community Contributor - -The community developer [Syanbo](https://github.com/syanbo) developed 1.0 version React Native SDK based on the Agora Native SDK from 2016 to 2017. As the community's demand for React Native SDK keeps growing, Agora has achieved official cooperation with Syanbo, this project now is officially maintained by Agora. Thanks to Syanbo for his long-term contributions to React Native SDK. - -## Release Note -[Changelog](CHANGELOG.md) - -## Installation - -### Installing (React Native >= 0.60.0) - -Install `react-native-agora`(^3.0.0): - -```shell script -yarn add react-native-agora -``` -or -```shell script -npm i --save react-native-agora -``` - -Go to your **ios** folder and run: - -```shell script -pod install -``` - -**_ IMPORTANT _** - -[Native Modules are now Autolinked.](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md) - -[Migrating to Swift.](https://github.com/AgoraIO-Community/react-native-agora/blob/master/docs/v3/installation.ios.md#step-1-migrating-to-swift) - -### Installing (React Native == 0.59.x) - -Install `react-native-agora`(^3.0.0): - -```shell script -yarn add react-native-agora -``` -or -```shell script -npm i --save react-native-agora -``` - -**_ IMPORTANT _** - -[Android Installation](./docs/v3/installation.android.md) - -[iOS Installation](./docs/v3/installation.ios.md) - -### Installing (React Native <= 0.58.x) - -**_ IMPORTANT _** - -We no longer support, you can try the older version. - -[Install `react-native-agora`(^1.0.0)](./docs/v1/README.md) - -[Install `react-native-agora`(^2.0.0)](./docs/v2/README.md) - -## General Usage - -```javascript -import RtcEngine from 'react-native-agora'; -RtcEngine.create('YOUR APP ID'); -``` -or -```javascript -const RtcEngine = require('react-native-agora'); -RtcEngine.create('YOUR APP ID'); -``` - -## Using TypeScript - -We suggest you use TypeScript to develop, or use TypeScript eslint to lint your code. - -* [Getting Started with TypeScript](https://reactnative.dev/docs/typescript#getting-started-with-typescript) -* [Adding TypeScript to an Existing Project](https://reactnative.dev/docs/typescript#adding-typescript-to-an-existing-project) - -## Troubleshooting - -### Pod install failed (React Native >= 0.62.0) - -The error log: - -``` -[!] The 'xxx' target has libraries with conflicting names: libcrypto.a. -``` - -You should disable Flipper, you can found it in the Podfile, and comment the code about Flipper in AppDelegate. - -``` - # Enables Flipper. - # - # Note that if you have use_frameworks! enabled, Flipper will not work and - # you should disable these next few lines. - add_flipper_pods! - post_install do |installer| - flipper_post_install(installer) - end -``` - -### RCT_EXTERN_MODULE Swift modules broken in Xcode 10.2 - -The error log: - -``` -Swift class extensions and categories on Swift classes are not allowed to have +load methods -``` - -Fixed in React Native 0.59.3. - -Source: https://github.com/facebook/react-native/issues/24139 - -### XCode 11 Beta App Launch Crash - -The error log: - -``` -Exception '*** -[__NSArrayM objectAtIndexedSubscript:]: index 1 beyond bounds [0 .. 0]' was thrown while invoking getCurrentAppState on target AppState with params ( -2, -3 -) -``` - -Fixed in React Native 0.59.9. - -Source: https://github.com/facebook/react-native/issues/25154 - -## API - -* [React Native API](https://agoraio-community.github.io/react-native-agora/globals.html) -* [Android API](https://docs.agora.io/en/Video/API%20Reference/java/index.html) -* [iOS API](https://docs.agora.io/en/Video/API%20Reference/oc/docs/headers/Agora-Objective-C-API-Overview.html) - -## Resources - -* Complete [API Doc](https://docs.agora.io/en/) at the Developer Center -* [File bugs about this sample](https://github.com/AgoraIO-Community/react-native-agora/issues) -* [React Native Getting Started](https://facebook.github.io/react-native/docs/getting-started.html) - -## Contributing - -See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow. - -## License - -MIT diff --git a/README.zh.md b/README.zh.md deleted file mode 100644 index fea166f57..000000000 --- a/README.zh.md +++ /dev/null @@ -1,160 +0,0 @@ -# react-native-agora - -[![npm](https://img.shields.io/npm/v/react-native-agora.svg)](https://www.npmjs.com/package/react-native-agora) -[![npm](https://img.shields.io/npm/dm/react-native-agora.svg)](https://www.npmjs.com/package/react-native-agora) -[![npm](https://img.shields.io/npm/dt/react-native-agora.svg)](https://www.npmjs.com/package/react-native-agora) -[![npm](https://img.shields.io/npm/l/react-native-agora.svg)](LICENSE) - -[English](README.md) - -此 SDK 基于 React Native 和 Agora Android 和 iOS 的视频 SDK 实现。 - -## 社区贡献者 - -声网社区开发者 [Syanbo](https://github.com/syanbo) 于 2016 年 - 2017 年期间,基于声网 Native SDK 独自完成了最初的 1.0 版本 React Native SDK。随着社区对于 React Native SDK 的需求增长,声网官方与 Syanbo 达成正式合作关系,目前该项目由声网官方进行更新维护。感谢 Syanbo 对于该项目长期以来的贡献。 - -## 发版说明 -[变更日志](CHANGELOG.md) - -## 集成文档 - -### 安装在 (React Native >= 0.60.0) - -安装 `react-native-agora`(^3.0.0): - -```shell script -yarn add react-native-agora -``` -或者 -```shell script -npm i --save react-native-agora -``` - -前往你的 **ios** 目录并执行: - -```shell script -pod install -``` - -**_ 重要信息 _** - -[原生模块现在已经是自动链接](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md) - -[迁移至Swift](https://github.com/AgoraIO-Community/react-native-agora/blob/master/docs/v3/installation.ios.md#step-1-migrating-to-swift) - -### 安装在 (React Native == 0.59.x) - -安装 `react-native-agora`(^3.0.0): - -```shell script -yarn add react-native-agora -``` -或者 -```shell script -npm i --save react-native-agora -``` - -**_ 重要信息 _** - -[Android 集成文档](./docs/v3/installation.android.md) - -[iOS 集成文档](./docs/v3/installation.ios.md) - -### 安装在 (React Native <= 0.58.x) - -**_ 重要信息 _** - -我们已经不再支持,你可以尝试老版本。 - -[安装 `react-native-agora`(^1.0.0)](./docs/v1/README.md) - -[安装 `react-native-agora`(^2.0.0)](./docs/v2/README.md) - -## 如何使用 - -```javascript -import RtcEngine from 'react-native-agora'; -RtcEngine.create('YOUR APP ID'); -``` -或者 -```javascript -const RtcEngine = require('react-native-agora'); -RtcEngine.create('YOUR APP ID'); -``` - -## 使用 TypeScript - -我们建议你使用 TypeScript 进行开发,或者使用 TypeScript eslint 来检查你的代码。 - -* [快速开始 TypeScript](https://reactnative.dev/docs/typescript#getting-started-with-typescript) -* [将 TypeScript 添加至现有项目](https://reactnative.dev/docs/typescript#adding-typescript-to-an-existing-project) - -## 常见错误 - -### Pod install 失败 (React Native >= 0.62.0) - -错误日志: - -``` -[!] The 'xxx' target has libraries with conflicting names: libcrypto.a. -``` - -你应该禁用 Flipper, 你可以在 Podfile 中找到它, 并且注释掉 AppDelegate 中有关 Flipper 的代码。 - -``` - # Enables Flipper. - # - # Note that if you have use_frameworks! enabled, Flipper will not work and - # you should disable these next few lines. - add_flipper_pods! - post_install do |installer| - flipper_post_install(installer) - end -``` - -### RCT_EXTERN_MODULE Swift modules broken in Xcode 10.2 - -错误日志: - -``` -Swift class extensions and categories on Swift classes are not allowed to have +load methods -``` - -React Native 0.59.3 已修复。 - -参考:https://github.com/facebook/react-native/issues/24139 - -### XCode 11 Beta App Launch Crash - -错误日志: - -``` -Exception '*** -[__NSArrayM objectAtIndexedSubscript:]: index 1 beyond bounds [0 .. 0]' was thrown while invoking getCurrentAppState on target AppState with params ( -2, -3 -) -``` - -React Native 0.59.9 已修复。 - -参考:https://github.com/facebook/react-native/issues/25154 - -## API文档 - -* [React Native API](https://agoraio-community.github.io/react-native-agora/globals.html) -* [Android API](https://docs.agora.io/en/Video/API%20Reference/java/index.html) -* [iOS API](https://docs.agora.io/en/Video/API%20Reference/oc/docs/headers/Agora-Objective-C-API-Overview.html) - -## 资源 - -* 完整的 [API Doc](https://docs.agora.io/cn/) 在开发者中心 -* [反馈问题](https://github.com/AgoraIO-Community/react-native-agora/issues) -* [React Native 快速开始](https://facebook.github.io/react-native/docs/getting-started.html) - -## 参与贡献 - -请参考 [contributing guide](CONTRIBUTING.md) 学习如何参与贡献并熟悉开发流程. - -## 开源许可 - -MIT diff --git a/ios/RCTAgora/Base/RtcChannel.swift b/RtcChannel.swift similarity index 100% rename from ios/RCTAgora/Base/RtcChannel.swift rename to RtcChannel.swift diff --git a/ios/RCTAgora/Base/RtcChannelEvent.swift b/RtcChannelEvent.swift similarity index 100% rename from ios/RCTAgora/Base/RtcChannelEvent.swift rename to RtcChannelEvent.swift diff --git a/ios/RCTAgora/Base/RtcEngine.swift b/RtcEngine.swift similarity index 99% rename from ios/RCTAgora/Base/RtcEngine.swift rename to RtcEngine.swift index da45a6b1b..08a6e1d40 100644 --- a/ios/RCTAgora/Base/RtcEngine.swift +++ b/RtcEngine.swift @@ -1045,7 +1045,7 @@ class RtcEngineManager: NSObject, RtcEngineInterface { } @objc func getErrorDescription(_ params: NSDictionary, _ callback: Callback) { - callback.success(AgoraRtcEngineKit.getErrorDescription((params["code"] as! NSNumber).intValue)) + callback.success(AgoraRtcEngineKit.getErrorDescription((params["error"] as! NSNumber).intValue)) } @objc func enableDeepLearningDenoise(_ params: NSDictionary, _ callback: Callback) { diff --git a/ios/RCTAgora/Base/RtcEngineEvent.swift b/RtcEngineEvent.swift similarity index 100% rename from ios/RCTAgora/Base/RtcEngineEvent.swift rename to RtcEngineEvent.swift diff --git a/ios/RCTAgora/Base/RtcSurfaceView.swift b/RtcSurfaceView.swift similarity index 100% rename from ios/RCTAgora/Base/RtcSurfaceView.swift rename to RtcSurfaceView.swift diff --git a/android/build.gradle b/android/build.gradle deleted file mode 100644 index c824f71f7..000000000 --- a/android/build.gradle +++ /dev/null @@ -1,134 +0,0 @@ -buildscript { - // Buildscript is evaluated before everything else so we can't use getExtOrDefault - def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['Agora_kotlinVersion'] - - repositories { - google() - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' - // noinspection DifferentKotlinGradleVersion - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' - -def getExtOrDefault(name) { - return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Agora_' + name] -} - -def getExtOrIntegerDefault(name) { - return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['Agora_' + name]).toInteger() -} - -android { - compileSdkVersion getExtOrIntegerDefault('compileSdkVersion') - buildToolsVersion getExtOrDefault('buildToolsVersion') - defaultConfig { - minSdkVersion 16 - targetSdkVersion getExtOrIntegerDefault('targetSdkVersion') - versionCode 1 - versionName "1.0" - - consumerProguardFiles 'consumer-rules.pro' - } - - buildTypes { - release { - minifyEnabled false - } - } - lintOptions { - disable 'GradleCompatible' - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } -} - -repositories { - mavenCentral() - jcenter() - google() - - def found = false - def defaultDir = null - def androidSourcesName = 'React Native sources' - - if (rootProject.ext.has('reactNativeAndroidRoot')) { - defaultDir = rootProject.ext.get('reactNativeAndroidRoot') - } else { - defaultDir = new File( - projectDir, - '/../../../node_modules/react-native/android' - ) - } - - if (defaultDir.exists()) { - maven { - url defaultDir.toString() - name androidSourcesName - } - - logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}") - found = true - } else { - def parentDir = rootProject.projectDir - - 1.upto(5, { - if (found) return true - parentDir = parentDir.parentFile - - def androidSourcesDir = new File( - parentDir, - 'node_modules/react-native' - ) - - def androidPrebuiltBinaryDir = new File( - parentDir, - 'node_modules/react-native/android' - ) - - if (androidPrebuiltBinaryDir.exists()) { - maven { - url androidPrebuiltBinaryDir.toString() - name androidSourcesName - } - - logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}") - found = true - } else if (androidSourcesDir.exists()) { - maven { - url androidSourcesDir.toString() - name androidSourcesName - } - - logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}") - found = true - } - }) - } - - if (!found) { - throw new GradleException( - "${project.name}: unable to locate React Native android sources. " + - "Ensure you have you installed React Native as a dependency in your project and try again." - ) - } -} - -def kotlin_version = getExtOrDefault('kotlinVersion') - -dependencies { - // noinspection GradleDynamicVersion - api 'com.facebook.react:react-native:+' - api "io.agora.rtc:full-sdk:3.3.1" - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" -} diff --git a/android/consumer-rules.pro b/android/consumer-rules.pro deleted file mode 100644 index b5b59752e..000000000 --- a/android/consumer-rules.pro +++ /dev/null @@ -1,5 +0,0 @@ --keepattributes *Annotation* --keep class kotlin.** { *; } --keep class org.jetbrains.** { *; } - --keep class io.agora.**{*;} diff --git a/android/gradle.properties b/android/gradle.properties deleted file mode 100644 index fc4ef54a2..000000000 --- a/android/gradle.properties +++ /dev/null @@ -1,4 +0,0 @@ -Agora_kotlinVersion=1.3.50 -Agora_compileSdkVersion=28 -Agora_buildToolsVersion=28.0.3 -Agora_targetSdkVersion=28 diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml deleted file mode 100644 index 2ef550020..000000000 --- a/android/src/main/AndroidManifest.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - diff --git a/android/src/main/java/io/agora/rtc/base/.gitignore b/android/src/main/java/io/agora/rtc/base/.gitignore deleted file mode 100644 index 9f11b755a..000000000 --- a/android/src/main/java/io/agora/rtc/base/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.idea/ diff --git a/android/src/main/java/io/agora/rtc/base/Annotations.java b/android/src/main/java/io/agora/rtc/base/Annotations.java deleted file mode 100644 index 784a30968..000000000 --- a/android/src/main/java/io/agora/rtc/base/Annotations.java +++ /dev/null @@ -1,950 +0,0 @@ -package io.agora.rtc.base; - -import androidx.annotation.IntDef; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -import io.agora.rtc.Constants; -import io.agora.rtc.IRtcEngineEventHandler; -import io.agora.rtc.RtcEngineConfig; -import io.agora.rtc.video.BeautyOptions; -import io.agora.rtc.video.VideoCanvas; - -@SuppressWarnings("deprecation") -public class Annotations { - @IntDef({ - AgoraRtcAppType.NATIVE, - AgoraRtcAppType.COCOS, - AgoraRtcAppType.UNITY, - AgoraRtcAppType.ELECTRON, - AgoraRtcAppType.FLUTTER, - AgoraRtcAppType.UNREAL, - AgoraRtcAppType.XAMARIN, - AgoraRtcAppType.API_CLOUD, - AgoraRtcAppType.REACT_NATIVE, - AgoraRtcAppType.PYTHON, - AgoraRtcAppType.COCOS_CREATOR, - AgoraRtcAppType.RUST, - AgoraRtcAppType.C_SHARP, - AgoraRtcAppType.CEF, - AgoraRtcAppType.UNI_APP, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraRtcAppType { - int NATIVE = 0; - int COCOS = 1; - int UNITY = 2; - int ELECTRON = 3; - int FLUTTER = 4; - int UNREAL = 5; - int XAMARIN = 6; - int API_CLOUD = 7; - int REACT_NATIVE = 8; - int PYTHON = 9; - int COCOS_CREATOR = 10; - int RUST = 11; - int C_SHARP = 12; - int CEF = 13; - int UNI_APP = 14; - } - - @IntDef({ - AgoraAudioCodecProfileType.LC_AAC, - AgoraAudioCodecProfileType.HE_AAC, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudioCodecProfileType { - int LC_AAC = 0; - int HE_AAC = 1; - } - - @IntDef({ - Constants.AUDIO_EQUALIZATION_BAND_31, - Constants.AUDIO_EQUALIZATION_BAND_62, - Constants.AUDIO_EQUALIZATION_BAND_125, - Constants.AUDIO_EQUALIZATION_BAND_250, - Constants.AUDIO_EQUALIZATION_BAND_500, - Constants.AUDIO_EQUALIZATION_BAND_1K, - Constants.AUDIO_EQUALIZATION_BAND_2K, - Constants.AUDIO_EQUALIZATION_BAND_4K, - Constants.AUDIO_EQUALIZATION_BAND_8K, - Constants.AUDIO_EQUALIZATION_BAND_16K, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudioEqualizationBandFrequency { - } - - @IntDef({ - Constants.LOCAL_AUDIO_STREAM_ERROR_OK, - Constants.LOCAL_AUDIO_STREAM_ERROR_FAILURE, - Constants.LOCAL_AUDIO_STREAM_ERROR_DEVICE_NO_PERMISSION, - Constants.LOCAL_AUDIO_STREAM_ERROR_DEVICE_BUSY, - Constants.LOCAL_AUDIO_STREAM_ERROR_CAPTURE_FAILURE, - Constants.LOCAL_AUDIO_STREAM_ERROR_ENCODE_FAILURE, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudioLocalError { - } - - @IntDef({ - Constants.LOCAL_AUDIO_STREAM_STATE_STOPPED, - Constants.LOCAL_AUDIO_STREAM_STATE_CAPTURING, - Constants.LOCAL_AUDIO_STREAM_STATE_ENCODING, - Constants.LOCAL_AUDIO_STREAM_STATE_FAILED, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudioLocalState { - } - - @IntDef({ - Constants.MEDIA_ENGINE_AUDIO_ERROR_MIXING_OPEN, - Constants.MEDIA_ENGINE_AUDIO_ERROR_MIXING_TOO_FREQUENT, - Constants.MEDIA_ENGINE_AUDIO_EVENT_MIXING_INTERRUPTED_EOF, - AgoraAudioMixingErrorCode.MEDIA_ENGINE_AUDIO_ERROR_OK, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudioMixingErrorCode { - int MEDIA_ENGINE_AUDIO_ERROR_OK = 0; - } - - @IntDef({ - Constants.MEDIA_ENGINE_AUDIO_EVENT_MIXING_PLAY, - Constants.MEDIA_ENGINE_AUDIO_EVENT_MIXING_PAUSED, - Constants.MEDIA_ENGINE_AUDIO_EVENT_MIXING_STOPPED, - Constants.MEDIA_ENGINE_AUDIO_EVENT_MIXING_ERROR, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudioMixingStateCode { - } - - @IntDef({ - Constants.AUDIO_ROUTE_DEFAULT, - Constants.AUDIO_ROUTE_HEADSET, - Constants.AUDIO_ROUTE_EARPIECE, - Constants.AUDIO_ROUTE_HEADSETNOMIC, - Constants.AUDIO_ROUTE_SPEAKERPHONE, - Constants.AUDIO_ROUTE_LOUDSPEAKER, - Constants.AUDIO_ROUTE_HEADSETBLUETOOTH, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudioOutputRouting { - } - - @IntDef({ - Constants.AUDIO_PROFILE_DEFAULT, - Constants.AUDIO_PROFILE_SPEECH_STANDARD, - Constants.AUDIO_PROFILE_MUSIC_STANDARD, - Constants.AUDIO_PROFILE_MUSIC_STANDARD_STEREO, - Constants.AUDIO_PROFILE_MUSIC_HIGH_QUALITY, - Constants.AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudioProfile { - } - - @IntDef({ - Constants.AUDIO_RECORDING_QUALITY_LOW, - Constants.AUDIO_RECORDING_QUALITY_MEDIUM, - Constants.AUDIO_RECORDING_QUALITY_HIGH, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudioRecordingQuality { - } - - @IntDef({ - Constants.REMOTE_AUDIO_STATE_STOPPED, - Constants.REMOTE_AUDIO_STATE_STARTING, - Constants.REMOTE_AUDIO_STATE_DECODING, - Constants.REMOTE_AUDIO_STATE_FROZEN, - Constants.REMOTE_AUDIO_STATE_FAILED, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudioRemoteState { - } - - @IntDef({ - Constants.REMOTE_AUDIO_REASON_INTERNAL, - Constants.REMOTE_AUDIO_REASON_NETWORK_CONGESTION, - Constants.REMOTE_AUDIO_REASON_NETWORK_RECOVERY, - Constants.REMOTE_AUDIO_REASON_LOCAL_MUTED, - Constants.REMOTE_AUDIO_REASON_LOCAL_UNMUTED, - Constants.REMOTE_AUDIO_REASON_REMOTE_MUTED, - Constants.REMOTE_AUDIO_REASON_REMOTE_UNMUTED, - Constants.REMOTE_AUDIO_REASON_REMOTE_OFFLINE, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudioRemoteStateReason { - } - - @IntDef({ - Constants.AUDIO_REVERB_OFF, - Constants.AUDIO_REVERB_POPULAR, - Constants.AUDIO_REVERB_RNB, - Constants.AUDIO_REVERB_ROCK, - Constants.AUDIO_REVERB_HIPHOP, - Constants.AUDIO_REVERB_VOCAL_CONCERT, - Constants.AUDIO_REVERB_KTV, - Constants.AUDIO_REVERB_STUDIO, - Constants.AUDIO_REVERB_FX_KTV, - Constants.AUDIO_REVERB_FX_VOCAL_CONCERT, - Constants.AUDIO_REVERB_FX_UNCLE, - Constants.AUDIO_REVERB_FX_SISTER, - Constants.AUDIO_REVERB_FX_STUDIO, - Constants.AUDIO_REVERB_FX_POPULAR, - Constants.AUDIO_REVERB_FX_RNB, - Constants.AUDIO_REVERB_FX_PHONOGRAPH, - Constants.AUDIO_VIRTUAL_STEREO, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudioReverbPreset { - } - - @IntDef({ - Constants.AUDIO_REVERB_DRY_LEVEL, - Constants.AUDIO_REVERB_WET_LEVEL, - Constants.AUDIO_REVERB_ROOM_SIZE, - Constants.AUDIO_REVERB_WET_DELAY, - Constants.AUDIO_REVERB_STRENGTH, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudioReverbType { - } - - @IntDef({ - AgoraAudioSampleRateType.TYPE_32000, - AgoraAudioSampleRateType.TYPE_44100, - AgoraAudioSampleRateType.TYPE_48000, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudioSampleRateType { - int TYPE_32000 = 32000; - int TYPE_44100 = 44100; - int TYPE_48000 = 48000; - } - - @IntDef({ - Constants.AUDIO_SCENARIO_DEFAULT, - Constants.AUDIO_SCENARIO_CHATROOM_ENTERTAINMENT, - Constants.AUDIO_SCENARIO_EDUCATION, - Constants.AUDIO_SCENARIO_GAME_STREAMING, - Constants.AUDIO_SCENARIO_SHOWROOM, - Constants.AUDIO_SCENARIO_CHATROOM_GAMING, - Constants.AUDIO_SCENARIO_IOT, - Constants.AUDIO_SCENARIO_MEETING, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudioScenario { - } - - @IntDef({ - Constants.VOICE_CHANGER_OFF, - Constants.VOICE_CHANGER_OLDMAN, - Constants.VOICE_CHANGER_BABYBOY, - Constants.VOICE_CHANGER_BABYGIRL, - Constants.VOICE_CHANGER_ZHUBAJIE, - Constants.VOICE_CHANGER_ETHEREAL, - Constants.VOICE_CHANGER_HULK, - Constants.VOICE_BEAUTY_VIGOROUS, - Constants.VOICE_BEAUTY_DEEP, - Constants.VOICE_BEAUTY_MELLOW, - Constants.VOICE_BEAUTY_FALSETTO, - Constants.VOICE_BEAUTY_FULL, - Constants.VOICE_BEAUTY_CLEAR, - Constants.VOICE_BEAUTY_RESOUNDING, - Constants.VOICE_BEAUTY_RINGING, - Constants.VOICE_BEAUTY_SPACIAL, - Constants.GENERAL_BEAUTY_VOICE_MALE_MAGNETIC, - Constants.GENERAL_BEAUTY_VOICE_FEMALE_FRESH, - Constants.GENERAL_BEAUTY_VOICE_FEMALE_VITALITY, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudioVoiceChanger { - } - - @IntDef({ - AgoraCameraCaptureOutputPreference.CAPTURER_OUTPUT_PREFERENCE_AUTO, - AgoraCameraCaptureOutputPreference.CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE, - AgoraCameraCaptureOutputPreference.CAPTURER_OUTPUT_PREFERENCE_PREVIEW, - AgoraCameraCaptureOutputPreference.CAPTURER_OUTPUT_PREFERENCE_MANUAL, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraCameraCaptureOutputPreference { - int CAPTURER_OUTPUT_PREFERENCE_AUTO = 0; - int CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE = 1; - int CAPTURER_OUTPUT_PREFERENCE_PREVIEW = 2; - int CAPTURER_OUTPUT_PREFERENCE_MANUAL = 3; - } - - @IntDef({ - AgoraCameraDirection.CAMERA_REAR, - AgoraCameraDirection.CAMERA_FRONT, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraCameraDirection { - int CAMERA_REAR = 0; - int CAMERA_FRONT = 1; - } - - @IntDef({ - Constants.RELAY_OK, - Constants.RELAY_ERROR_SERVER_ERROR_RESPONSE, - Constants.RELAY_ERROR_SERVER_NO_RESPONSE, - Constants.RELAY_ERROR_NO_RESOURCE_AVAILABLE, - Constants.RELAY_ERROR_FAILED_JOIN_SRC, - Constants.RELAY_ERROR_FAILED_JOIN_DEST, - Constants.RELAY_ERROR_FAILED_PACKET_RECEIVED_FROM_SRC, - Constants.RELAY_ERROR_FAILED_PACKET_SENT_TO_DEST, - Constants.RELAY_ERROR_SERVER_CONNECTION_LOST, - Constants.RELAY_ERROR_INTERNAL_ERROR, - Constants.RELAY_ERROR_SRC_TOKEN_EXPIRED, - Constants.RELAY_ERROR_DEST_TOKEN_EXPIRED, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraChannelMediaRelayError { - } - - @IntDef({ - Constants.RELAY_EVENT_NETWORK_DISCONNECTED, - Constants.RELAY_EVENT_NETWORK_CONNECTED, - Constants.RELAY_EVENT_PACKET_JOINED_SRC_CHANNEL, - Constants.RELAY_EVENT_PACKET_JOINED_DEST_CHANNEL, - Constants.RELAY_EVENT_PACKET_SENT_TO_DEST_CHANNEL, - Constants.RELAY_EVENT_PACKET_RECEIVED_VIDEO_FROM_SRC, - Constants.RELAY_EVENT_PACKET_RECEIVED_AUDIO_FROM_SRC, - Constants.RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL, - Constants.RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_REFUSED, - Constants.RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE, - Constants.RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_IS_NULL, - Constants.RELAY_EVENT_VIDEO_PROFILE_UPDATE, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraChannelMediaRelayEvent { - } - - @IntDef({ - Constants.RELAY_STATE_IDLE, - Constants.RELAY_STATE_CONNECTING, - Constants.RELAY_STATE_RUNNING, - Constants.RELAY_STATE_FAILURE, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraChannelMediaRelayState { - } - - @IntDef({ - Constants.CHANNEL_PROFILE_COMMUNICATION, - Constants.CHANNEL_PROFILE_LIVE_BROADCASTING, - Constants.CHANNEL_PROFILE_GAME, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraChannelProfile { - } - - @IntDef({ - Constants.CLIENT_ROLE_BROADCASTER, - Constants.CLIENT_ROLE_AUDIENCE, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraClientRole { - } - - @IntDef({ - Constants.CONNECTION_CHANGED_CONNECTING, - Constants.CONNECTION_CHANGED_JOIN_SUCCESS, - Constants.CONNECTION_CHANGED_INTERRUPTED, - Constants.CONNECTION_CHANGED_BANNED_BY_SERVER, - Constants.CONNECTION_CHANGED_JOIN_FAILED, - Constants.CONNECTION_CHANGED_LEAVE_CHANNEL, - Constants.CONNECTION_CHANGED_INVALID_APP_ID, - Constants.CONNECTION_CHANGED_INVALID_CHANNEL_NAME, - Constants.CONNECTION_CHANGED_INVALID_TOKEN, - Constants.CONNECTION_CHANGED_TOKEN_EXPIRED, - Constants.CONNECTION_CHANGED_REJECTED_BY_SERVER, - Constants.CONNECTION_CHANGED_SETTING_PROXY_SERVER, - Constants.CONNECTION_CHANGED_RENEW_TOKEN, - Constants.CONNECTION_CHANGED_CLIENT_IP_ADDRESS_CHANGED, - Constants.CONNECTION_CHANGED_KEEP_ALIVE_TIMEOUT, - Constants.CONNECTION_CHANGED_PROXY_SERVER_INTERRUPTED, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraConnectionChangedReason { - } - - @IntDef({ - Constants.CONNECTION_STATE_DISCONNECTED, - Constants.CONNECTION_STATE_CONNECTING, - Constants.CONNECTION_STATE_CONNECTED, - Constants.CONNECTION_STATE_RECONNECTING, - Constants.CONNECTION_STATE_FAILED, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraConnectionStateType { - } - - @IntDef({ - AgoraDegradationPreference.MAINTAIN_QUALITY, - AgoraDegradationPreference.MAINTAIN_FRAMERATE, - AgoraDegradationPreference.MAINTAIN_BALANCED, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraDegradationPreference { - int MAINTAIN_QUALITY = 0; - int MAINTAIN_FRAMERATE = 1; - int MAINTAIN_BALANCED = 2; - } - - @IntDef({ - AgoraEncryptionMode.NONE, - AgoraEncryptionMode.AES128XTS, - AgoraEncryptionMode.AES128ECB, - AgoraEncryptionMode.AES256XTS, - AgoraEncryptionMode.SM4128ECB, - AgoraEncryptionMode.AES128GCM, - AgoraEncryptionMode.AES256GCM, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraEncryptionMode { - int NONE = 0; - int AES128XTS = 1; - int AES128ECB = 2; - int AES256XTS = 3; - int SM4128ECB = 4; - int AES128GCM = 5; - int AES256GCM = 6; - } - - @IntDef({ - Constants.ERR_OK, - Constants.ERR_FAILED, - Constants.ERR_INVALID_ARGUMENT, - Constants.ERR_NOT_READY, - Constants.ERR_NOT_SUPPORTED, - Constants.ERR_REFUSED, - Constants.ERR_BUFFER_TOO_SMALL, - Constants.ERR_NOT_INITIALIZED, - Constants.ERR_NO_PERMISSION, - Constants.ERR_TIMEDOUT, - Constants.ERR_CANCELED, - Constants.ERR_TOO_OFTEN, - Constants.ERR_BIND_SOCKET, - Constants.ERR_NET_DOWN, - Constants.ERR_NET_NOBUFS, - Constants.ERR_JOIN_CHANNEL_REJECTED, - Constants.ERR_LEAVE_CHANNEL_REJECTED, - Constants.ERR_ALREADY_IN_USE, - Constants.ERR_INVALID_APP_ID, - Constants.ERR_INVALID_CHANNEL_NAME, - Constants.ERR_NO_SERVER_RESOURCES, - Constants.ERR_TOKEN_EXPIRED, - Constants.ERR_INVALID_TOKEN, - Constants.ERR_CONNECTION_INTERRUPTED, - Constants.ERR_CONNECTION_LOST, - Constants.ERR_NOT_IN_CHANNEL, - Constants.ERR_SIZE_TOO_LARGE, - Constants.ERR_BITRATE_LIMIT, - Constants.ERR_TOO_MANY_DATA_STREAMS, - Constants.ERR_DECRYPTION_FAILED, - Constants.ERR_CLIENT_IS_BANNED_BY_SERVER, - Constants.ERR_WATERMARK_PARAM, - Constants.ERR_WATERMARK_PATH, - Constants.ERR_WATERMARK_PNG, - Constants.ERR_WATERMARKR_INFO, - Constants.ERR_WATERMARK_ARGB, - Constants.ERR_WATERMARK_READ, - Constants.ERR_ENCRYPTED_STREAM_NOT_ALLOWED_PUBLISHED, - Constants.ERR_INVALID_USER_ACCOUNT, - Constants.ERR_PUBLISH_STREAM_CDN_ERROR, - Constants.ERR_PUBLISH_STREAM_NUM_REACH_LIMIT, - Constants.ERR_PUBLISH_STREAM_NOT_AUTHORIZED, - Constants.ERR_PUBLISH_STREAM_INTERNAL_SERVER_ERROR, - Constants.ERR_PUBLISH_STREAM_NOT_FOUND, - Constants.ERR_PUBLISH_STREAM_FORMAT_NOT_SUPPORTED, - Constants.ERR_MODULE_NOT_FOUND, - Constants.ERR_LOAD_MEDIA_ENGINE, - Constants.ERR_START_CALL, - Constants.ERR_START_CAMERA, - Constants.ERR_START_VIDEO_RENDER, - Constants.ERR_ADM_GENERAL_ERROR, - Constants.ERR_ADM_JAVA_RESOURCE, - Constants.ERR_ADM_SAMPLE_RATE, - Constants.ERR_ADM_INIT_PLAYOUT, - Constants.ERR_ADM_START_PLAYOUT, - Constants.ERR_ADM_STOP_PLAYOUT, - Constants.ERR_ADM_INIT_RECORDING, - Constants.ERR_ADM_START_RECORDING, - Constants.ERR_ADM_STOP_RECORDING, - Constants.ERR_ADM_RUNTIME_PLAYOUT_ERROR, - Constants.ERR_ADM_RUNTIME_RECORDING_ERROR, - Constants.ERR_ADM_RECORD_AUDIO_FAILED, - Constants.ERR_ADM_INIT_LOOPBACK, - Constants.ERR_ADM_START_LOOPBACK, - Constants.ERR_AUDIO_BT_SCO_FAILED, - Constants.ERR_ADM_NO_RECORDING_DEVICE, - Constants.ERR_ADM_NO_PLAYOUT_DEVICE, - Constants.ERR_VDM_CAMERA_NOT_AUTHORIZED, - Constants.ERR_VCM_UNKNOWN_ERROR, - Constants.ERR_VCM_ENCODER_INIT_ERROR, - Constants.ERR_VCM_ENCODER_ENCODE_ERROR, - Constants.ERR_VCM_ENCODER_SET_ERROR, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraErrorCode { - } - - @IntDef({ - Constants.INJECT_STREAM_STATUS_START_SUCCESS, - Constants.INJECT_STREAM_STATUS_START_ALREADY_EXISTS, - Constants.INJECT_STREAM_STATUS_START_UNAUTHORIZED, - Constants.INJECT_STREAM_STATUS_START_TIMEDOUT, - Constants.INJECT_STREAM_STATUS_START_FAILED, - Constants.INJECT_STREAM_STATUS_STOP_SUCCESS, - Constants.INJECT_STREAM_STATUS_STOP_NOT_FOUND, - Constants.INJECT_STREAM_STATUS_STOP_UNAUTHORIZED, - Constants.INJECT_STREAM_STATUS_STOP_TIMEDOUT, - Constants.INJECT_STREAM_STATUS_STOP_FAILED, - Constants.INJECT_STREAM_STATUS_BROKEN, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraInjectStreamStatus { - } - - @IntDef({ - Constants.LASTMILE_PROBE_RESULT_COMPLETE, - Constants.LASTMILE_PROBE_RESULT_INCOMPLETE_NO_BWE, - Constants.LASTMILE_PROBE_RESULT_UNAVAILABLE, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraLastmileProbeResultState { - } - - @IntDef({ - BeautyOptions.LIGHTENING_CONTRAST_LOW, - BeautyOptions.LIGHTENING_CONTRAST_NORMAL, - BeautyOptions.LIGHTENING_CONTRAST_HIGH, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraLighteningContrastLevel { - } - - @IntDef({ - Constants.LOCAL_VIDEO_STREAM_ERROR_OK, - Constants.LOCAL_VIDEO_STREAM_ERROR_FAILURE, - Constants.LOCAL_VIDEO_STREAM_ERROR_DEVICE_NO_PERMISSION, - Constants.LOCAL_VIDEO_STREAM_ERROR_DEVICE_BUSY, - Constants.LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE, - Constants.LOCAL_VIDEO_STREAM_ERROR_ENCODE_FAILURE, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraLocalVideoStreamError { - } - - @IntDef({ - Constants.LOCAL_VIDEO_STREAM_STATE_STOPPED, - Constants.LOCAL_VIDEO_STREAM_STATE_CAPTURING, - Constants.LOCAL_VIDEO_STREAM_STATE_ENCODING, - Constants.LOCAL_VIDEO_STREAM_STATE_FAILED, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraLocalVideoStreamState { - } - - @IntDef({ - Constants.LOG_FILTER_OFF, - Constants.LOG_FILTER_DEBUG, - Constants.LOG_FILTER_INFO, - Constants.LOG_FILTER_WARNING, - Constants.LOG_FILTER_ERROR, - Constants.LOG_FILTER_CRITICAL, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraLogFilter { - } - - @IntDef({ - Constants.QUALITY_UNKNOWN, - Constants.QUALITY_EXCELLENT, - Constants.QUALITY_GOOD, - Constants.QUALITY_POOR, - Constants.QUALITY_BAD, - Constants.QUALITY_VBAD, - Constants.QUALITY_DOWN, - Constants.QUALITY_UNSUPPORTED, - Constants.QUALITY_DETECTING, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraNetworkQuality { - } - - @IntDef({ - Constants.NETWORK_TYPE_UNKNOWN, - Constants.NETWORK_TYPE_DISCONNECTED, - Constants.NETWORK_TYPE_LAN, - Constants.NETWORK_TYPE_WIFI, - Constants.NETWORK_TYPE_MOBILE_2G, - Constants.NETWORK_TYPE_MOBILE_3G, - Constants.NETWORK_TYPE_MOBILE_4G, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraNetworkType { - } - - @IntDef({ - Constants.RTMP_STREAM_PUBLISH_ERROR_OK, - Constants.RTMP_STREAM_PUBLISH_ERROR_INVALID_ARGUMENT, - Constants.RTMP_STREAM_PUBLISH_ERROR_ENCRYPTED_STREAM_NOT_ALLOWED, - Constants.RTMP_STREAM_PUBLISH_ERROR_CONNECTION_TIMEOUT, - Constants.RTMP_STREAM_PUBLISH_ERROR_INTERNAL_SERVER_ERROR, - Constants.RTMP_STREAM_PUBLISH_ERROR_RTMP_SERVER_ERROR, - Constants.RTMP_STREAM_PUBLISH_ERROR_TOO_OFTEN, - Constants.RTMP_STREAM_PUBLISH_ERROR_REACH_LIMIT, - Constants.RTMP_STREAM_PUBLISH_ERROR_NOT_AUTHORIZED, - Constants.RTMP_STREAM_PUBLISH_ERROR_STREAM_NOT_FOUND, - Constants.RTMP_STREAM_PUBLISH_ERROR_FORMAT_NOT_SUPPORTED, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraRtmpStreamingErrorCode { - } - - @IntDef({ - Constants.RTMP_STREAM_PUBLISH_STATE_IDLE, - Constants.RTMP_STREAM_PUBLISH_STATE_CONNECTING, - Constants.RTMP_STREAM_PUBLISH_STATE_RUNNING, - Constants.RTMP_STREAM_PUBLISH_STATE_RECOVERING, - Constants.RTMP_STREAM_PUBLISH_STATE_FAILURE, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraRtmpStreamingState { - } - - @IntDef({ - Constants.STREAM_FALLBACK_OPTION_DISABLED, - Constants.STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW, - Constants.STREAM_FALLBACK_OPTION_AUDIO_ONLY, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraStreamFallbackOptions { - } - - @IntDef({ - Constants.USER_OFFLINE_QUIT, - Constants.USER_OFFLINE_DROPPED, - Constants.USER_OFFLINE_BECOME_AUDIENCE, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraUserOfflineReason { - } - - @IntDef({ - Constants.USER_PRIORITY_HIGH, - Constants.USER_PRIORITY_NORMAL, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraUserPriority { - } - - @IntDef({ - AgoraVideoCodecProfileType.BASELINE, - AgoraVideoCodecProfileType.MAIN, - AgoraVideoCodecProfileType.HIGH, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraVideoCodecProfileType { - int BASELINE = 66; - int MAIN = 77; - int HIGH = 100; - } - - @IntDef({ - AgoraVideoFrameRate.FRAME_RATE_FPS_1, - AgoraVideoFrameRate.FRAME_RATE_FPS_7, - AgoraVideoFrameRate.FRAME_RATE_FPS_10, - AgoraVideoFrameRate.FRAME_RATE_FPS_15, - AgoraVideoFrameRate.FRAME_RATE_FPS_24, - AgoraVideoFrameRate.FRAME_RATE_FPS_30, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraVideoFrameRate { - int FRAME_RATE_FPS_1 = 1; - int FRAME_RATE_FPS_7 = 7; - int FRAME_RATE_FPS_10 = 10; - int FRAME_RATE_FPS_15 = 15; - int FRAME_RATE_FPS_24 = 24; - int FRAME_RATE_FPS_30 = 30; - } - - @IntDef({ - Constants.VIDEO_MIRROR_MODE_AUTO, - Constants.VIDEO_MIRROR_MODE_ENABLED, - Constants.VIDEO_MIRROR_MODE_DISABLED, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraVideoMirrorMode { - } - - @IntDef({ - AgoraVideoOutputOrientationMode.ORIENTATION_MODE_ADAPTIVE, - AgoraVideoOutputOrientationMode.ORIENTATION_MODE_FIXED_LANDSCAPE, - AgoraVideoOutputOrientationMode.ORIENTATION_MODE_FIXED_PORTRAIT, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraVideoOutputOrientationMode { - int ORIENTATION_MODE_ADAPTIVE = 0; - int ORIENTATION_MODE_FIXED_LANDSCAPE = 1; - int ORIENTATION_MODE_FIXED_PORTRAIT = 2; - } - - @IntDef({ - Constants.ADAPT_NONE, - Constants.ADAPT_UP_BANDWIDTH, - Constants.ADAPT_DOWN_BANDWIDTH, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraVideoQualityAdaptIndication { - } - - @IntDef({ - Constants.REMOTE_VIDEO_STATE_STOPPED, - Constants.REMOTE_VIDEO_STATE_STARTING, - Constants.REMOTE_VIDEO_STATE_DECODING, - Constants.REMOTE_VIDEO_STATE_FROZEN, - Constants.REMOTE_VIDEO_STATE_FAILED, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraVideoRemoteState { - } - - @IntDef({ - Constants.REMOTE_VIDEO_STATE_REASON_INTERNAL, - Constants.REMOTE_VIDEO_STATE_REASON_NETWORK_CONGESTION, - Constants.REMOTE_VIDEO_STATE_REASON_NETWORK_RECOVERY, - Constants.REMOTE_VIDEO_STATE_REASON_LOCAL_MUTED, - Constants.REMOTE_VIDEO_STATE_REASON_LOCAL_UNMUTED, - Constants.REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED, - Constants.REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED, - Constants.REMOTE_VIDEO_STATE_REASON_REMOTE_OFFLINE, - Constants.REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK, - Constants.REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK_RECOVERY, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraVideoRemoteStateReason { - } - - @IntDef({ - VideoCanvas.RENDER_MODE_HIDDEN, - VideoCanvas.RENDER_MODE_FIT, - VideoCanvas.RENDER_MODE_ADAPTIVE, - VideoCanvas.RENDER_MODE_FILL, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraVideoRenderMode { - } - - @IntDef({ - Constants.VIDEO_STREAM_HIGH, - Constants.VIDEO_STREAM_LOW, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraVideoStreamType { - } - - @IntDef({ - Constants.WARN_INVALID_VIEW, - Constants.WARN_INIT_VIDEO, - Constants.WARN_PENDING, - Constants.WARN_NO_AVAILABLE_CHANNEL, - Constants.WARN_LOOKUP_CHANNEL_TIMEOUT, - Constants.WARN_LOOKUP_CHANNEL_REJECTED, - Constants.WARN_OPEN_CHANNEL_TIMEOUT, - Constants.WARN_OPEN_CHANNEL_REJECTED, - Constants.WARN_SWITCH_LIVE_VIDEO_TIMEOUT, - Constants.WARN_SET_CLIENT_ROLE_TIMEOUT, - Constants.WARN_SET_CLIENT_ROLE_NOT_AUTHORIZED, - Constants.WARN_OPEN_CHANNEL_INVALID_TICKET, - Constants.WARN_OPEN_CHANNEL_TRY_NEXT_VOS, - Constants.WARN_AUDIO_MIXING_OPEN_ERROR, - Constants.WARN_ADM_RUNTIME_PLAYOUT_WARNING, - Constants.WARN_ADM_RUNTIME_RECORDING_WARNING, - Constants.WARN_ADM_RECORD_AUDIO_SILENCE, - Constants.WARN_ADM_PLAYOUT_ABNORMAL_FREQUENCY, - Constants.WARN_ADM_RECORD_ABNORMAL_FREQUENCY, - Constants.WARN_ADM_CALL_INTERRUPTION, - Constants.WARN_ADM_RECORD_AUDIO_LOWLEVEL, - Constants.WARN_ADM_PLAYOUT_AUDIO_LOWLEVEL, - Constants.WARN_ADM_RECORD_IS_OCCUPIED, - Constants.WARN_APM_HOWLING, - Constants.WARN_ADM_GLITCH_STATE, - Constants.WARN_APM_RESIDUAL_ECHO, - Constants.WARN_SUPER_RESOLUTION_STREAM_OVER_LIMITATION, - Constants.WARN_SUPER_RESOLUTION_USER_COUNT_OVER_LIMITATION, - Constants.WARN_SUPER_RESOLUTION_DEVICE_NOT_SUPPORTED, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraWarningCode { - } - - @IntDef({ - RtcEngineConfig.AreaCode.AREA_CODE_CN, - RtcEngineConfig.AreaCode.AREA_CODE_NA, - RtcEngineConfig.AreaCode.AREA_CODE_EU, - RtcEngineConfig.AreaCode.AREA_CODE_AS, - RtcEngineConfig.AreaCode.AREA_CODE_JP, - RtcEngineConfig.AreaCode.AREA_CODE_IN, - RtcEngineConfig.AreaCode.AREA_CODE_GLOB, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAreaCode { - } - - @IntDef({ - Constants.SUB_STATE_IDLE, - Constants.SUB_STATE_NO_SUBSCRIBED, - Constants.SUB_STATE_SUBSCRIBING, - Constants.SUB_STATE_SUBSCRIBED, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraStreamSubscribeState { - } - - @IntDef({ - Constants.PUB_STATE_IDLE, - Constants.PUB_STATE_NO_PUBLISHED, - Constants.PUB_STATE_PUBLISHING, - Constants.PUB_STATE_PUBLISHED, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraStreamPublishState { - } - - @IntDef({ - Constants.RTMP_STREAMING_EVENT_FAILED_LOAD_IMAGE, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraRtmpStreamingEvent { - } - - @IntDef({ - Constants.AUDIO_EFFECT_OFF, - Constants.ROOM_ACOUSTICS_KTV, - Constants.ROOM_ACOUSTICS_VOCAL_CONCERT, - Constants.ROOM_ACOUSTICS_STUDIO, - Constants.ROOM_ACOUSTICS_PHONOGRAPH, - Constants.ROOM_ACOUSTICS_VIRTUAL_STEREO, - Constants.ROOM_ACOUSTICS_SPACIAL, - Constants.ROOM_ACOUSTICS_ETHEREAL, - Constants.ROOM_ACOUSTICS_3D_VOICE, - Constants.VOICE_CHANGER_EFFECT_UNCLE, - Constants.VOICE_CHANGER_EFFECT_OLDMAN, - Constants.VOICE_CHANGER_EFFECT_BOY, - Constants.VOICE_CHANGER_EFFECT_SISTER, - Constants.VOICE_CHANGER_EFFECT_GIRL, - Constants.VOICE_CHANGER_EFFECT_PIGKING, - Constants.VOICE_CHANGER_EFFECT_HULK, - Constants.STYLE_TRANSFORMATION_RNB, - Constants.STYLE_TRANSFORMATION_POPULAR, - Constants.PITCH_CORRECTION, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudioEffectPreset { - } - - @IntDef({ - Constants.VOICE_BEAUTIFIER_OFF, - Constants.CHAT_BEAUTIFIER_MAGNETIC, - Constants.CHAT_BEAUTIFIER_FRESH, - Constants.CHAT_BEAUTIFIER_VITALITY, - Constants.SINGING_BEAUTIFIER, - Constants.TIMBRE_TRANSFORMATION_VIGOROUS, - Constants.TIMBRE_TRANSFORMATION_DEEP, - Constants.TIMBRE_TRANSFORMATION_MELLOW, - Constants.TIMBRE_TRANSFORMATION_FALSETTO, - Constants.TIMBRE_TRANSFORMATION_FULL, - Constants.TIMBRE_TRANSFORMATION_CLEAR, - Constants.TIMBRE_TRANSFORMATION_RESOUNDING, - Constants.TIMBRE_TRANSFORMATION_RINGING, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraVoiceBeautifierPreset { - } - - @IntDef({ - Constants.AUDIENCE_LATENCY_LEVEL_LOW_LATENCY, - Constants.AUDIENCE_LATENCY_LEVEL_ULTRA_LOW_LATENCY, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraAudienceLatencyLevelType { - } - - @IntDef({ - Constants.TRANSPORT_TYPE_NONE_PROXY, - Constants.TRANSPORT_TYPE_UDP_PROXY, - Constants.TRANSPORT_TYPE_TCP_PROXY, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraCloudProxyType { - } - - @IntDef({ - AgoraLogLevel.LOG_LEVEL_NONE, - AgoraLogLevel.LOG_LEVEL_INFO, - AgoraLogLevel.LOG_LEVEL_WARN, - AgoraLogLevel.LOG_LEVEL_ERROR, - AgoraLogLevel.LOG_LEVEL_FATAL, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraLogLevel { - int LOG_LEVEL_NONE = 0; - int LOG_LEVEL_INFO = 1; - int LOG_LEVEL_WARN = 2; - int LOG_LEVEL_ERROR = 4; - int LOG_LEVEL_FATAL = 8; - } - - @IntDef({ - Constants.CAPTURE_BRIGHTNESS_LEVEL_INVALID, - Constants.CAPTURE_BRIGHTNESS_LEVEL_NORMAL, - Constants.CAPTURE_BRIGHTNESS_LEVEL_BRIGHT, - Constants.CAPTURE_BRIGHTNESS_LEVEL_DARK, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraCaptureBrightnessLevelType { - } - - @IntDef({ - IRtcEngineEventHandler.UploadErrorReason.UPLOAD_SUCCESS, - IRtcEngineEventHandler.UploadErrorReason.UPLOAD_NET_ERROR, - IRtcEngineEventHandler.UploadErrorReason.UPLOAD_SERVER_ERROR, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraUploadErrorReason { - } - - @IntDef({ - IRtcEngineEventHandler.ExperienceQuality.EXPERIENCE_GOOD, - IRtcEngineEventHandler.ExperienceQuality.EXPERIENCE_BAD, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraExperienceQualityType { - } - - @IntDef({ - IRtcEngineEventHandler.ExperiencePoorReason.EXPERIENCE_REASON_NONE, - IRtcEngineEventHandler.ExperiencePoorReason.REMOTE_NETWORK_QUALITY_POOR, - IRtcEngineEventHandler.ExperiencePoorReason.LOCAL_NETWORK_QUALITY_POOR, - IRtcEngineEventHandler.ExperiencePoorReason.WIRELESS_SIGNAL_POOR, - IRtcEngineEventHandler.ExperiencePoorReason.WIFI_BLUETOOTH_COEXIST, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraExperiencePoorReason { - } - - @IntDef({ - Constants.SR_STATE_REASON_SUCCESS, - Constants.SR_STATE_REASON_STREAM_OVER_LIMITATION, - Constants.SR_STATE_REASON_USER_COUNT_OVER_LIMITATION, - Constants.SR_STATE_REASON_DEVICE_NOT_SUPPORTED, - }) - @Retention(RetentionPolicy.SOURCE) - public @interface AgoraSuperResolutionStateReason { - } -} diff --git a/android/src/main/java/io/agora/rtc/base/BeanCovertor.kt b/android/src/main/java/io/agora/rtc/base/BeanCovertor.kt deleted file mode 100644 index 3ae90efde..000000000 --- a/android/src/main/java/io/agora/rtc/base/BeanCovertor.kt +++ /dev/null @@ -1,215 +0,0 @@ -package io.agora.rtc.base - -import android.graphics.Color -import io.agora.rtc.RtcEngineConfig -import io.agora.rtc.internal.EncryptionConfig -import io.agora.rtc.internal.LastmileProbeConfig -import io.agora.rtc.live.LiveInjectStreamConfig -import io.agora.rtc.live.LiveTranscoding -import io.agora.rtc.live.LiveTranscoding.TranscodingUser -import io.agora.rtc.models.ChannelMediaOptions -import io.agora.rtc.models.ClientRoleOptions -import io.agora.rtc.models.DataStreamConfig -import io.agora.rtc.video.* - -fun mapToVideoDimensions(map: Map<*, *>): VideoEncoderConfiguration.VideoDimensions { - return VideoEncoderConfiguration.VideoDimensions().apply { - (map["width"] as? Number)?.let { width = it.toInt() } - (map["height"] as? Number)?.let { height = it.toInt() } - } -} - -fun mapToVideoEncoderConfiguration(map: Map<*, *>): VideoEncoderConfiguration { - return VideoEncoderConfiguration().apply { - (map["dimensions"] as? Map<*, *>)?.let { dimensions = mapToVideoDimensions(it) } - (map["frameRate"] as? Number)?.let { frameRate = it.toInt() } - (map["minFrameRate"] as? Number)?.let { minFrameRate = it.toInt() } - (map["bitrate"] as? Number)?.let { bitrate = it.toInt() } - (map["minBitrate"] as? Number)?.let { minBitrate = it.toInt() } - (map["orientationMode"] as? Number)?.let { orientationMode = intToOrientationMode(it.toInt()) } - (map["degradationPrefer"] as? Number)?.let { degradationPrefer = intToDegradationPreference(it.toInt()) } - (map["mirrorMode"] as? Number)?.let { mirrorMode = it.toInt() } - } -} - -fun mapToBeautyOptions(map: Map<*, *>): BeautyOptions { - return BeautyOptions().apply { - (map["lighteningContrastLevel"] as? Number)?.let { lighteningContrastLevel = it.toInt() } - (map["lighteningLevel"] as? Number)?.let { lighteningLevel = it.toFloat() } - (map["smoothnessLevel"] as? Number)?.let { smoothnessLevel = it.toFloat() } - (map["rednessLevel"] as? Number)?.let { rednessLevel = it.toFloat() } - } -} - -fun mapToAgoraImage(map: Map<*, *>): AgoraImage { - return AgoraImage().apply { - (map["url"] as? String)?.let { url = it } - (map["x"] as? Number)?.let { x = it.toInt() } - (map["y"] as? Number)?.let { y = it.toInt() } - (map["width"] as? Number)?.let { width = it.toInt() } - (map["height"] as? Number)?.let { height = it.toInt() } - } -} - -fun mapToTranscodingUser(map: Map<*, *>): TranscodingUser { - return TranscodingUser().apply { - (map["uid"] as? Number)?.let { uid = it.toInt() } - (map["x"] as? Number)?.let { x = it.toInt() } - (map["y"] as? Number)?.let { y = it.toInt() } - (map["width"] as? Number)?.let { width = it.toInt() } - (map["height"] as? Number)?.let { height = it.toInt() } - (map["zOrder"] as? Number)?.let { zOrder = it.toInt() } - (map["alpha"] as? Number)?.let { alpha = it.toFloat() } - (map["audioChannel"] as? Number)?.let { audioChannel = it.toInt() } - } -} - -fun mapToColor(map: Map<*, *>): Int { - return Color.rgb( - (map["red"] as Number).toInt(), - (map["green"] as Number).toInt(), - (map["blue"] as Number).toInt() - ) -} - -fun mapToLiveTranscoding(map: Map<*, *>): LiveTranscoding { - return LiveTranscoding().apply { - (map["width"] as? Number)?.let { width = it.toInt() } - (map["height"] as? Number)?.let { height = it.toInt() } - (map["videoBitrate"] as? Number)?.let { videoBitrate = it.toInt() } - (map["videoFramerate"] as? Number)?.let { videoFramerate = it.toInt() } - (map["lowLatency"] as? Boolean)?.let { lowLatency = it } - (map["videoGop"] as? Number)?.let { videoGop = it.toInt() } - (map["watermark"] as? Map<*, *>)?.let { watermark = mapToAgoraImage(it) } - (map["backgroundImage"] as? Map<*, *>)?.let { backgroundImage = mapToAgoraImage(it) } - (map["audioSampleRate"] as? Number)?.let { audioSampleRate = intToLiveTranscodingAudioSampleRate(it.toInt()) } - (map["audioBitrate"] as? Number)?.let { audioBitrate = it.toInt() } - (map["audioChannels"] as? Number)?.let { audioChannels = it.toInt() } - (map["audioCodecProfile"] as? Number)?.let { audioCodecProfile = intToAudioCodecProfile(it.toInt()) } - (map["videoCodecProfile"] as? Number)?.let { videoCodecProfile = intToVideoCodecProfile(it.toInt()) } - (map["backgroundColor"] as? Map<*, *>)?.let { backgroundColor = mapToColor(it) } - (map["userConfigExtraInfo"] as? String)?.let { userConfigExtraInfo = it } - (map["transcodingUsers"] as? List<*>)?.let { list -> - list.forEach { item -> - (item as? Map<*, *>)?.let { - addUser(mapToTranscodingUser(it)) - } - } - } - } -} - -fun mapToChannelMediaInfo(map: Map<*, *>): ChannelMediaInfo { - return ChannelMediaInfo( - map["channelName"] as? String, - map["token"] as? String, - (map["uid"] as Number).toInt() - ) -} - -fun mapToChannelMediaRelayConfiguration(map: Map<*, *>): ChannelMediaRelayConfiguration { - return ChannelMediaRelayConfiguration().apply { - (map["srcInfo"] as? Map<*, *>)?.let { setSrcChannelInfo(mapToChannelMediaInfo(it)) } - (map["destInfos"] as? List<*>)?.let { list -> - list.forEach { item -> - (item as? Map<*, *>)?.let { - val info = mapToChannelMediaInfo(it) - setDestChannelInfo(info.channelName, info) - } - } - } - } -} - -fun mapToLastmileProbeConfig(map: Map<*, *>): LastmileProbeConfig { - return LastmileProbeConfig().apply { - (map["probeUplink"] as? Boolean)?.let { probeUplink = it } - (map["probeDownlink"] as? Boolean)?.let { probeDownlink = it } - (map["expectedUplinkBitrate"] as? Number)?.let { expectedUplinkBitrate = it.toInt() } - (map["expectedDownlinkBitrate"] as? Number)?.let { expectedUplinkBitrate = it.toInt() } - } -} - -fun mapToRectangle(map: Map<*, *>): WatermarkOptions.Rectangle { - return WatermarkOptions.Rectangle().apply { - (map["x"] as? Number)?.let { x = it.toInt() } - (map["y"] as? Number)?.let { y = it.toInt() } - (map["width"] as? Number)?.let { width = it.toInt() } - (map["height"] as? Number)?.let { height = it.toInt() } - } -} - -fun mapToWatermarkOptions(map: Map<*, *>): WatermarkOptions { - return WatermarkOptions().apply { - (map["visibleInPreview"] as? Boolean)?.let { visibleInPreview = it } - (map["positionInLandscapeMode"] as? Map<*, *>)?.let { positionInLandscapeMode = mapToRectangle(it) } - (map["positionInPortraitMode"] as? Map<*, *>)?.let { positionInPortraitMode = mapToRectangle(it) } - } -} - -fun mapToLiveInjectStreamConfig(map: Map<*, *>): LiveInjectStreamConfig { - return LiveInjectStreamConfig().apply { - (map["width"] as? Number)?.let { width = it.toInt() } - (map["height"] as? Number)?.let { height = it.toInt() } - (map["videoGop"] as? Number)?.let { videoGop = it.toInt() } - (map["videoFramerate"] as? Number)?.let { videoFramerate = it.toInt() } - (map["videoBitrate"] as? Number)?.let { videoBitrate = it.toInt() } - (map["audioSampleRate"] as? Number)?.let { audioSampleRate = intToLiveInjectStreamConfigAudioSampleRate(it.toInt()) } - (map["audioBitrate"] as? Number)?.let { audioBitrate = it.toInt() } - (map["audioChannels"] as? Number)?.let { audioChannels = it.toInt() } - } -} - -fun mapToCameraCapturerConfiguration(map: Map<*, *>): CameraCapturerConfiguration { - return CameraCapturerConfiguration( - intToCapturerOutputPreference((map["preference"] as Number).toInt()), - intToCameraDirection((map["cameraDirection"] as Number).toInt()) - ).apply { - dimensions = CameraCapturerConfiguration.CaptureDimensions() - (map["captureWidth"] as? Number)?.toInt()?.let { dimensions.width = it } - (map["captureHeight"] as? Number)?.toInt()?.let { dimensions.height = it } - } -} - -fun mapToChannelMediaOptions(map: Map<*, *>): ChannelMediaOptions { - return ChannelMediaOptions().apply { - (map["autoSubscribeAudio"] as? Boolean)?.let { autoSubscribeAudio = it } - (map["autoSubscribeVideo"] as? Boolean)?.let { autoSubscribeVideo = it } - } -} - -fun mapToRtcEngineConfig(map: Map<*, *>): RtcEngineConfig { - return RtcEngineConfig().apply { - mAppId = map["appId"] as String - (map["areaCode"] as? Number)?.toInt()?.let { mAreaCode = it } - (map["logConfig"] as? Map<*, *>)?.let { mLogConfig = mapToLogConfig(it) } - } -} - -fun mapToEncryptionConfig(map: Map<*, *>): EncryptionConfig { - return EncryptionConfig().apply { - (map["encryptionMode"] as? Number)?.let { encryptionMode = intToEncryptionMode(it.toInt()) } - (map["encryptionKey"] as? String)?.let { encryptionKey = it } - } -} - -fun mapToClientRoleOptions(map: Map<*, *>): ClientRoleOptions { - return ClientRoleOptions().apply { - (map["audienceLatencyLevel"] as? Number)?.let { audienceLatencyLevel = it.toInt() } - } -} - -fun mapToLogConfig(map: Map<*, *>): RtcEngineConfig.LogConfig { - return RtcEngineConfig.LogConfig().apply { - (map["filePath"] as? String)?.let { filePath = it } - (map["fileSize"] as? Number)?.let { fileSize = it.toInt() } - (map["level"] as? Number)?.let { level = it.toInt() } - } -} - -fun mapToDataStreamConfig(map: Map<*, *>): DataStreamConfig { - return DataStreamConfig().apply { - (map["syncWithAudio"] as? Boolean)?.let { syncWithAudio = it } - (map["ordered"] as? Boolean)?.let { ordered = it } - } -} diff --git a/android/src/main/java/io/agora/rtc/base/Callback.kt b/android/src/main/java/io/agora/rtc/base/Callback.kt deleted file mode 100644 index 0d9b69378..000000000 --- a/android/src/main/java/io/agora/rtc/base/Callback.kt +++ /dev/null @@ -1,41 +0,0 @@ -package io.agora.rtc.base - -import io.agora.rtc.Constants -import io.agora.rtc.RtcEngine -import kotlin.math.abs - -abstract class Callback { - fun code(code: Int?, runnable: ((Int?) -> Any?)? = null) { - if (code == null || code < 0) { - val newCode = abs(code ?: Constants.ERR_NOT_INITIALIZED) - failure(newCode.toString(), RtcEngine.getErrorDescription(newCode)) - return - } - - val res = if (runnable != null) runnable(code) else Unit - if (res is Unit) { - success(null) - } else { - success(res) - } - } - - fun resolve(source: T?, runnable: (T) -> Any?) { - if (source == null) { - val code = Constants.ERR_NOT_INITIALIZED - failure(code.toString(), RtcEngine.getErrorDescription(code)) - return - } - - val res = runnable(source) - if (res is Unit) { - success(null) - } else { - success(res) - } - } - - abstract fun success(data: Any?) - - abstract fun failure(code: String, message: String) -} diff --git a/android/src/main/java/io/agora/rtc/base/EnumCovertor.kt b/android/src/main/java/io/agora/rtc/base/EnumCovertor.kt deleted file mode 100644 index ea423ce69..000000000 --- a/android/src/main/java/io/agora/rtc/base/EnumCovertor.kt +++ /dev/null @@ -1,97 +0,0 @@ -package io.agora.rtc.base - -import io.agora.rtc.internal.EncryptionConfig -import io.agora.rtc.live.LiveInjectStreamConfig -import io.agora.rtc.live.LiveTranscoding -import io.agora.rtc.video.CameraCapturerConfiguration -import io.agora.rtc.video.VideoEncoderConfiguration - -fun intToFrameRate(@Annotations.AgoraVideoFrameRate intValue: Int): VideoEncoderConfiguration.FRAME_RATE { - for (value in VideoEncoderConfiguration.FRAME_RATE.values()) { - if (value.value == intValue) { - return value - } - } - throw RuntimeException("VideoEncoderConfiguration.FRAME_RATE not contains $intValue") -} - -fun intToOrientationMode(@Annotations.AgoraVideoOutputOrientationMode intValue: Int): VideoEncoderConfiguration.ORIENTATION_MODE { - for (value in VideoEncoderConfiguration.ORIENTATION_MODE.values()) { - if (value.value == intValue) { - return value - } - } - throw RuntimeException("VideoEncoderConfiguration.ORIENTATION_MODE not contains $intValue") -} - -fun intToDegradationPreference(@Annotations.AgoraDegradationPreference intValue: Int): VideoEncoderConfiguration.DEGRADATION_PREFERENCE { - for (value in VideoEncoderConfiguration.DEGRADATION_PREFERENCE.values()) { - if (value.value == intValue) { - return value - } - } - throw RuntimeException("VideoEncoderConfiguration.DEGRADATION_PREFERENCE not contains $intValue") -} - -fun intToLiveTranscodingAudioSampleRate(@Annotations.AgoraAudioSampleRateType intValue: Int): LiveTranscoding.AudioSampleRateType { - for (value in LiveTranscoding.AudioSampleRateType.values()) { - if (LiveTranscoding.AudioSampleRateType.getValue(value) == intValue) { - return value - } - } - throw RuntimeException("LiveTranscoding.AudioSampleRateType not contains $intValue") -} - -fun intToLiveInjectStreamConfigAudioSampleRate(@Annotations.AgoraAudioSampleRateType intValue: Int): LiveInjectStreamConfig.AudioSampleRateType { - for (value in LiveInjectStreamConfig.AudioSampleRateType.values()) { - if (LiveInjectStreamConfig.AudioSampleRateType.getValue(value) == intValue) { - return value - } - } - throw RuntimeException("LiveInjectStreamConfig.AudioSampleRateType not contains $intValue") -} - -fun intToAudioCodecProfile(@Annotations.AgoraAudioCodecProfileType intValue: Int): LiveTranscoding.AudioCodecProfileType { - for (value in LiveTranscoding.AudioCodecProfileType.values()) { - if (LiveTranscoding.AudioCodecProfileType.getValue(value) == intValue) { - return value - } - } - throw RuntimeException("LiveTranscoding.AudioCodecProfileType not contains $intValue") -} - -fun intToVideoCodecProfile(@Annotations.AgoraVideoCodecProfileType intValue: Int): LiveTranscoding.VideoCodecProfileType { - for (value in LiveTranscoding.VideoCodecProfileType.values()) { - if (LiveTranscoding.VideoCodecProfileType.getValue(value) == intValue) { - return value - } - } - throw RuntimeException("LiveTranscoding.VideoCodecProfileType not contains $intValue") -} - -fun intToCapturerOutputPreference(@Annotations.AgoraCameraCaptureOutputPreference intValue: Int): CameraCapturerConfiguration.CAPTURER_OUTPUT_PREFERENCE { - for (value in CameraCapturerConfiguration.CAPTURER_OUTPUT_PREFERENCE.values()) { - if (value.value == intValue) { - return value - } - } - throw RuntimeException("CameraCapturerConfiguration.CAPTURER_OUTPUT_PREFERENCE not contains $intValue") -} - -fun intToCameraDirection(@Annotations.AgoraCameraDirection intValue: Int): CameraCapturerConfiguration.CAMERA_DIRECTION { - for (value in CameraCapturerConfiguration.CAMERA_DIRECTION.values()) { - if (value.value == intValue) { - return value - } - } - throw RuntimeException("CameraCapturerConfiguration.CAMERA_DIRECTION not contains $intValue") -} - -fun intToEncryptionMode(@Annotations.AgoraEncryptionMode intValue: Int): EncryptionConfig.EncryptionMode { - for (value in EncryptionConfig.EncryptionMode.values()) { - if (value.value == intValue) { - return value - } - } - throw RuntimeException("EncryptionConfig.EncryptionMode not contains $intValue") -} diff --git a/android/src/main/java/io/agora/rtc/base/Extensions.kt b/android/src/main/java/io/agora/rtc/base/Extensions.kt deleted file mode 100644 index 147593fc0..000000000 --- a/android/src/main/java/io/agora/rtc/base/Extensions.kt +++ /dev/null @@ -1,160 +0,0 @@ -package io.agora.rtc.base - -import android.graphics.Rect -import io.agora.rtc.IRtcEngineEventHandler.* -import io.agora.rtc.models.UserInfo - -fun UserInfo.toMap(): Map { - return hashMapOf( - "uid" to uid, - "userAccount" to userAccount - ) -} - -fun LocalAudioStats.toMap(): Map { - return hashMapOf( - "numChannels" to numChannels, - "sentSampleRate" to sentSampleRate, - "sentBitrate" to sentBitrate, - "txPacketLossRate" to txPacketLossRate - ) -} - -fun RtcStats.toMap(): Map { - return hashMapOf( - "totalDuration" to totalDuration, - "txBytes" to txBytes, - "rxBytes" to rxBytes, - "txAudioBytes" to txAudioBytes, - "txVideoBytes" to txVideoBytes, - "rxAudioBytes" to rxAudioBytes, - "rxVideoBytes" to rxVideoBytes, - "txKBitRate" to txKBitRate, - "rxKBitRate" to rxKBitRate, - "txAudioKBitRate" to txAudioKBitRate, - "rxAudioKBitRate" to rxAudioKBitRate, - "txVideoKBitRate" to txVideoKBitRate, - "rxVideoKBitRate" to rxVideoKBitRate, - "users" to users, - "lastmileDelay" to lastmileDelay, - "txPacketLossRate" to txPacketLossRate, - "rxPacketLossRate" to rxPacketLossRate, - "cpuTotalUsage" to cpuTotalUsage, - "cpuAppUsage" to cpuAppUsage, - "gatewayRtt" to gatewayRtt, - "memoryAppUsageRatio" to memoryAppUsageRatio, - "memoryTotalUsageRatio" to memoryTotalUsageRatio, - "memoryAppUsageInKbytes" to memoryAppUsageInKbytes - ) -} - -fun Rect.toMap(): Map { - return hashMapOf( - "left" to left, - "top" to top, - "right" to right, - "bottom" to bottom - ) -} - -fun RemoteAudioStats.toMap(): Map { - return hashMapOf( - "uid" to uid, - "quality" to quality, - "networkTransportDelay" to networkTransportDelay, - "jitterBufferDelay" to jitterBufferDelay, - "audioLossRate" to audioLossRate, - "numChannels" to numChannels, - "receivedSampleRate" to receivedSampleRate, - "receivedBitrate" to receivedBitrate, - "totalFrozenTime" to totalFrozenTime, - "frozenRate" to frozenRate, - "totalActiveTime" to totalActiveTime, - "publishDuration" to publishDuration, - "qoeQuality" to qoeQuality, - "qualityChangedReason" to qualityChangedReason, - "mosValue" to mosValue - ) -} - -fun LocalVideoStats.toMap(): Map { - return hashMapOf( - "sentBitrate" to sentBitrate, - "sentFrameRate" to sentFrameRate, - "encoderOutputFrameRate" to encoderOutputFrameRate, - "rendererOutputFrameRate" to rendererOutputFrameRate, - "targetBitrate" to targetBitrate, - "targetFrameRate" to targetFrameRate, - "qualityAdaptIndication" to qualityAdaptIndication, - "encodedBitrate" to encodedBitrate, - "encodedFrameWidth" to encodedFrameWidth, - "encodedFrameHeight" to encodedFrameHeight, - "encodedFrameCount" to encodedFrameCount, - "codecType" to codecType, - "txPacketLossRate" to txPacketLossRate, - "captureFrameRate" to captureFrameRate, - "captureBrightnessLevel" to captureBrightnessLevel - ) -} - -fun RemoteVideoStats.toMap(): Map { - return hashMapOf( - "uid" to uid, - "delay" to delay, - "width" to width, - "height" to height, - "receivedBitrate" to receivedBitrate, - "decoderOutputFrameRate" to decoderOutputFrameRate, - "rendererOutputFrameRate" to rendererOutputFrameRate, - "packetLossRate" to packetLossRate, - "rxStreamType" to rxStreamType, - "totalFrozenTime" to totalFrozenTime, - "frozenRate" to frozenRate, - "totalActiveTime" to totalActiveTime, - "publishDuration" to publishDuration - ) -} - -fun AudioVolumeInfo.toMap(): Map { - return hashMapOf( - "uid" to uid, - "volume" to volume, - "vad" to vad, - "channelId" to channelId - ) -} - -fun Array.toMapList(): List> { - return List(size) { this[it].toMap() } -} - -fun LastmileProbeResult.LastmileProbeOneWayResult.toMap(): Map { - return hashMapOf( - "packetLossRate" to packetLossRate, - "jitter" to jitter, - "availableBandwidth" to availableBandwidth - ) -} - -fun LastmileProbeResult.toMap(): Map { - return hashMapOf( - "state" to state, - "rtt" to rtt, - "uplinkReport" to uplinkReport.toMap(), - "downlinkReport" to downlinkReport.toMap() - ) -} - -fun AgoraFacePositionInfo.toMap(): Map { - return hashMapOf( - "x" to x, - "y" to y, - "width" to width, - "height" to height, - "distance" to distance - ) -} - -fun Array.toMapList(): List> { - return List(size) { this[it].toMap() } -} diff --git a/android/src/main/java/io/agora/rtc/base/MediaObserver.kt b/android/src/main/java/io/agora/rtc/base/MediaObserver.kt deleted file mode 100644 index 21f3b20c3..000000000 --- a/android/src/main/java/io/agora/rtc/base/MediaObserver.kt +++ /dev/null @@ -1,38 +0,0 @@ -package io.agora.rtc.base - -import androidx.annotation.IntRange -import io.agora.rtc.IMetadataObserver -import java.util.* -import java.util.concurrent.atomic.AtomicInteger - -class MediaObserver( - private val emit: (data: Map?) -> Unit -) : IMetadataObserver { - private var maxMetadataSize = AtomicInteger(1024) - private var metadataList = Collections.synchronizedList(mutableListOf()) - - fun addMetadata(metadata: String) { - metadataList.add(metadata) - } - - fun setMaxMetadataSize(@IntRange(from = 0, to = 1024) size: Int) { - maxMetadataSize.set(size) - } - - override fun onReadyToSendMetadata(timeStampMs: Long): ByteArray? { - if (metadataList.size > 0) { - return metadataList.removeAt(0).toByteArray() - } - return null - } - - override fun getMaxMetadataSize(): Int { - return maxMetadataSize.get() - } - - override fun onMetadataReceived(buffer: ByteArray, uid: Int, timeStampMs: Long) { - emit(hashMapOf( - "data" to arrayListOf(String(buffer), uid, timeStampMs) - )) - } -} diff --git a/android/src/main/java/io/agora/rtc/base/RtcChannel.kt b/android/src/main/java/io/agora/rtc/base/RtcChannel.kt deleted file mode 100644 index 461a9bda7..000000000 --- a/android/src/main/java/io/agora/rtc/base/RtcChannel.kt +++ /dev/null @@ -1,335 +0,0 @@ -package io.agora.rtc.base - -import io.agora.rtc.IMetadataObserver -import io.agora.rtc.RtcChannel -import io.agora.rtc.RtcEngine -import io.agora.rtc.internal.EncryptionConfig -import java.util.* - -class IRtcChannel { - interface RtcChannelInterface : RtcAudioInterface, RtcVideoInterface, RtcVoicePositionInterface, - RtcPublishStreamInterface, RtcMediaRelayInterface, RtcDualStreamInterface, - RtcFallbackInterface, RtcMediaMetadataInterface, RtcEncryptionInterface, - RtcInjectStreamInterface, RtcStreamMessageInterface { - fun create(params: Map, callback: Callback) - - fun destroy(params: Map, callback: Callback) - - fun setClientRole(params: Map, callback: Callback) - - fun joinChannel(params: Map, callback: Callback) - - fun joinChannelWithUserAccount(params: Map, callback: Callback) - - fun leaveChannel(params: Map, callback: Callback) - - fun renewToken(params: Map, callback: Callback) - - fun getConnectionState(params: Map, callback: Callback) - - fun publish(params: Map, callback: Callback) - - fun unpublish(params: Map, callback: Callback) - - fun getCallId(params: Map, callback: Callback) - } - - interface RtcAudioInterface { - fun adjustUserPlaybackSignalVolume(params: Map, callback: Callback) - - fun muteRemoteAudioStream(params: Map, callback: Callback) - - fun muteAllRemoteAudioStreams(params: Map, callback: Callback) - - @Deprecated("") - fun setDefaultMuteAllRemoteAudioStreams(params: Map, callback: Callback) - } - - interface RtcVideoInterface { - fun muteRemoteVideoStream(params: Map, callback: Callback) - - fun muteAllRemoteVideoStreams(params: Map, callback: Callback) - - @Deprecated("") - fun setDefaultMuteAllRemoteVideoStreams(params: Map, callback: Callback) - - fun enableRemoteSuperResolution(params: Map, callback: Callback) - } - - interface RtcVoicePositionInterface { - fun setRemoteVoicePosition(params: Map, callback: Callback) - } - - interface RtcPublishStreamInterface { - fun setLiveTranscoding(params: Map, callback: Callback) - - fun addPublishStreamUrl(params: Map, callback: Callback) - - fun removePublishStreamUrl(params: Map, callback: Callback) - } - - interface RtcMediaRelayInterface { - fun startChannelMediaRelay(params: Map, callback: Callback) - - fun updateChannelMediaRelay(params: Map, callback: Callback) - - fun stopChannelMediaRelay(params: Map, callback: Callback) - } - - interface RtcDualStreamInterface { - fun setRemoteVideoStreamType(params: Map, callback: Callback) - - fun setRemoteDefaultVideoStreamType(params: Map, callback: Callback) - } - - interface RtcFallbackInterface { - fun setRemoteUserPriority(params: Map, callback: Callback) - } - - interface RtcMediaMetadataInterface { - fun registerMediaMetadataObserver(params: Map, callback: Callback) - - fun unregisterMediaMetadataObserver(params: Map, callback: Callback) - - fun setMaxMetadataSize(params: Map, callback: Callback) - - fun sendMetadata(params: Map, callback: Callback) - } - - interface RtcEncryptionInterface { - @Deprecated("") - fun setEncryptionSecret(params: Map, callback: Callback) - - @Deprecated("") - fun setEncryptionMode(params: Map, callback: Callback) - - fun enableEncryption(params: Map, callback: Callback) - } - - interface RtcInjectStreamInterface { - fun addInjectStreamUrl(params: Map, callback: Callback) - - fun removeInjectStreamUrl(params: Map, callback: Callback) - } - - interface RtcStreamMessageInterface { - fun createDataStream(params: Map, callback: Callback) - - fun sendStreamMessage(params: Map, callback: Callback) - } -} - -class RtcChannelManager( - private val emit: (methodName: String, data: Map?) -> Unit -) : IRtcChannel.RtcChannelInterface { - private val rtcChannelMap = Collections.synchronizedMap(mutableMapOf()) - private val mediaObserverMap = Collections.synchronizedMap(mutableMapOf()) - - fun release() { - rtcChannelMap.forEach { it.value.destroy() } - rtcChannelMap.clear() - mediaObserverMap.clear() - } - - operator fun get(channelId: String): RtcChannel? { - return rtcChannelMap[channelId] - } - - override fun create(params: Map, callback: Callback) { - callback.resolve(params["engine"] as RtcEngine) { e -> - e.createRtcChannel(params["channelId"] as String)?.let { - it.setRtcChannelEventHandler(RtcChannelEventHandler { methodName, data -> emit(methodName, data) }) - rtcChannelMap[it.channelId()] = it - } - Unit - } - } - - override fun destroy(params: Map, callback: Callback) { - callback.code(rtcChannelMap.remove(params["channelId"] as String)?.destroy()) - } - - override fun setClientRole(params: Map, callback: Callback) { - val role = (params["role"] as Number).toInt() - (params["options"] as? Map<*, *>)?.let { - callback.code(this[params["channelId"] as String]?.setClientRole(role, mapToClientRoleOptions(it))) - return@setClientRole - } - callback.code(this[params["channelId"] as String]?.setClientRole(role)) - } - - override fun joinChannel(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.joinChannel(params["token"] as? String, params["optionalInfo"] as? String, (params["optionalUid"] as Number).toInt(), mapToChannelMediaOptions(params["options"] as Map<*, *>))) - } - - override fun joinChannelWithUserAccount(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.joinChannelWithUserAccount(params["token"] as? String, params["userAccount"] as String, mapToChannelMediaOptions(params["options"] as Map<*, *>))) - } - - override fun leaveChannel(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.leaveChannel()) - } - - override fun renewToken(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.renewToken(params["token"] as String)) - } - - override fun getConnectionState(params: Map, callback: Callback) { - callback.resolve(this[params["channelId"] as String]) { it.connectionState } - } - - override fun publish(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.publish()) - } - - override fun unpublish(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.unpublish()) - } - - override fun getCallId(params: Map, callback: Callback) { - callback.resolve(this[params["channelId"] as String]) { it.callId } - } - - override fun adjustUserPlaybackSignalVolume(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.adjustUserPlaybackSignalVolume((params["uid"] as Number).toInt(), (params["volume"] as Number).toInt())) - } - - override fun muteRemoteAudioStream(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.muteRemoteAudioStream((params["uid"] as Number).toInt(), params["muted"] as Boolean)) - } - - override fun muteAllRemoteAudioStreams(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.muteAllRemoteAudioStreams(params["muted"] as Boolean)) - } - - override fun setDefaultMuteAllRemoteAudioStreams(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.setDefaultMuteAllRemoteAudioStreams(params["muted"] as Boolean)) - } - - override fun muteRemoteVideoStream(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.muteRemoteVideoStream((params["uid"] as Number).toInt(), params["muted"] as Boolean)) - } - - override fun muteAllRemoteVideoStreams(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.muteAllRemoteVideoStreams(params["muted"] as Boolean)) - } - - override fun setDefaultMuteAllRemoteVideoStreams(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.setDefaultMuteAllRemoteVideoStreams(params["muted"] as Boolean)) - } - - override fun enableRemoteSuperResolution(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.enableRemoteSuperResolution((params["uid"] as Number).toInt(), params["enable"] as Boolean)) - } - - override fun setRemoteVoicePosition(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.setRemoteVoicePosition((params["uid"] as Number).toInt(), (params["pan"] as Number).toDouble(), (params["gain"] as Number).toDouble())) - } - - override fun setLiveTranscoding(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.setLiveTranscoding(mapToLiveTranscoding(params["transcoding"] as Map<*, *>))) - } - - override fun addPublishStreamUrl(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.addPublishStreamUrl(params["url"] as String, params["transcodingEnabled"] as Boolean)) - } - - override fun removePublishStreamUrl(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.removePublishStreamUrl(params["url"] as String)) - } - - override fun startChannelMediaRelay(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.startChannelMediaRelay(mapToChannelMediaRelayConfiguration(params["channelMediaRelayConfiguration"] as Map<*, *>))) - } - - override fun updateChannelMediaRelay(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.updateChannelMediaRelay(mapToChannelMediaRelayConfiguration(params["channelMediaRelayConfiguration"] as Map<*, *>))) - } - - override fun stopChannelMediaRelay(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.stopChannelMediaRelay()) - } - - override fun setRemoteVideoStreamType(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.setRemoteVideoStreamType((params["uid"] as Number).toInt(), (params["streamType"] as Number).toInt())) - } - - override fun setRemoteDefaultVideoStreamType(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.setRemoteDefaultVideoStreamType((params["streamType"] as Number).toInt())) - } - - override fun setRemoteUserPriority(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.setRemoteUserPriority((params["uid"] as Number).toInt(), (params["userPriority"] as Number).toInt())) - } - - override fun registerMediaMetadataObserver(params: Map, callback: Callback) { - val channelId = params["channelId"] as String - val mediaObserver = MediaObserver { data -> - emit(RtcChannelEvents.MetadataReceived, data?.toMutableMap()?.apply { put("channelId", channelId) }) - } - callback.code(this[channelId]?.registerMediaMetadataObserver(mediaObserver, IMetadataObserver.VIDEO_METADATA)) { - mediaObserverMap[channelId] = mediaObserver - Unit - } - } - - override fun unregisterMediaMetadataObserver(params: Map, callback: Callback) { - val channelId = params["channelId"] as String - callback.code(this[channelId]?.registerMediaMetadataObserver(null, IMetadataObserver.VIDEO_METADATA)) { - mediaObserverMap.remove(channelId) - Unit - } - } - - override fun setMaxMetadataSize(params: Map, callback: Callback) { - callback.resolve(mediaObserverMap[params["channelId"] as String]) { - it.maxMetadataSize = (params["size"] as Number).toInt() - Unit - } - } - - override fun sendMetadata(params: Map, callback: Callback) { - callback.resolve(mediaObserverMap[params["channelId"] as String]) { - it.addMetadata(params["metadata"] as String) - Unit - } - } - - override fun setEncryptionSecret(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.setEncryptionSecret(params["secret"] as String)) - } - - override fun setEncryptionMode(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.setEncryptionMode(when ((params["encryptionMode"] as Number).toInt()) { - EncryptionConfig.EncryptionMode.AES_128_XTS.value -> "aes-128-xts" - EncryptionConfig.EncryptionMode.AES_128_ECB.value -> "aes-128-ecb" - EncryptionConfig.EncryptionMode.AES_256_XTS.value -> "aes-256-xts" - else -> "" - })) - } - - override fun enableEncryption(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.enableEncryption(params["enabled"] as Boolean, mapToEncryptionConfig(params["config"] as Map<*, *>))) - } - - override fun addInjectStreamUrl(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.addInjectStreamUrl(params["url"] as String, mapToLiveInjectStreamConfig(params["config"] as Map<*, *>))) - } - - override fun removeInjectStreamUrl(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.removeInjectStreamUrl(params["url"] as String)) - } - - override fun createDataStream(params: Map, callback: Callback) { - val channel = this[params["channelId"] as String] - (params["config"] as? Map<*, *>)?.let { config -> - callback.code(channel?.createDataStream(mapToDataStreamConfig(config))) { it } - return@createDataStream - } - callback.code(channel?.createDataStream(params["reliable"] as Boolean, params["ordered"] as Boolean)) { it } - } - - override fun sendStreamMessage(params: Map, callback: Callback) { - callback.code(this[params["channelId"] as String]?.sendStreamMessage((params["streamId"] as Number).toInt(), (params["message"] as String).toByteArray())) - } -} diff --git a/android/src/main/java/io/agora/rtc/base/RtcChannelEvent.kt b/android/src/main/java/io/agora/rtc/base/RtcChannelEvent.kt deleted file mode 100644 index 71ff02ae9..000000000 --- a/android/src/main/java/io/agora/rtc/base/RtcChannelEvent.kt +++ /dev/null @@ -1,245 +0,0 @@ -package io.agora.rtc.base - -import androidx.annotation.IntRange -import io.agora.rtc.IRtcChannelEventHandler -import io.agora.rtc.IRtcEngineEventHandler -import io.agora.rtc.RtcChannel - -class RtcChannelEvents { - companion object { - const val Warning = "Warning" - const val Error = "Error" - const val JoinChannelSuccess = "JoinChannelSuccess" - const val RejoinChannelSuccess = "RejoinChannelSuccess" - const val LeaveChannel = "LeaveChannel" - const val ClientRoleChanged = "ClientRoleChanged" - const val UserJoined = "UserJoined" - const val UserOffline = "UserOffline" - const val ConnectionStateChanged = "ConnectionStateChanged" - const val ConnectionLost = "ConnectionLost" - const val TokenPrivilegeWillExpire = "TokenPrivilegeWillExpire" - const val RequestToken = "RequestToken" - const val ActiveSpeaker = "ActiveSpeaker" - const val VideoSizeChanged = "VideoSizeChanged" - const val RemoteVideoStateChanged = "RemoteVideoStateChanged" - const val RemoteAudioStateChanged = "RemoteAudioStateChanged" - const val LocalPublishFallbackToAudioOnly = "LocalPublishFallbackToAudioOnly" - const val RemoteSubscribeFallbackToAudioOnly = "RemoteSubscribeFallbackToAudioOnly" - const val RtcStats = "RtcStats" - const val NetworkQuality = "NetworkQuality" - const val RemoteVideoStats = "RemoteVideoStats" - const val RemoteAudioStats = "RemoteAudioStats" - const val RtmpStreamingStateChanged = "RtmpStreamingStateChanged" - const val TranscodingUpdated = "TranscodingUpdated" - const val StreamInjectedStatus = "StreamInjectedStatus" - const val StreamMessage = "StreamMessage" - const val StreamMessageError = "StreamMessageError" - const val ChannelMediaRelayStateChanged = "ChannelMediaRelayStateChanged" - const val ChannelMediaRelayEvent = "ChannelMediaRelayEvent" - const val MetadataReceived = "MetadataReceived" - const val AudioPublishStateChanged = "AudioPublishStateChanged" - const val VideoPublishStateChanged = "VideoPublishStateChanged" - const val AudioSubscribeStateChanged = "AudioSubscribeStateChanged" - const val VideoSubscribeStateChanged = "VideoSubscribeStateChanged" - const val RtmpStreamingEvent = "RtmpStreamingEvent" - const val UserSuperResolutionEnabled = "UserSuperResolutionEnabled" - - fun toMap(): Map { - return hashMapOf( - "Warning" to Warning, - "Error" to Error, - "JoinChannelSuccess" to JoinChannelSuccess, - "RejoinChannelSuccess" to RejoinChannelSuccess, - "LeaveChannel" to LeaveChannel, - "ClientRoleChanged" to ClientRoleChanged, - "UserJoined" to UserJoined, - "UserOffline" to UserOffline, - "ConnectionStateChanged" to ConnectionStateChanged, - "ConnectionLost" to ConnectionLost, - "TokenPrivilegeWillExpire" to TokenPrivilegeWillExpire, - "RequestToken" to RequestToken, - "ActiveSpeaker" to ActiveSpeaker, - "VideoSizeChanged" to VideoSizeChanged, - "RemoteVideoStateChanged" to RemoteVideoStateChanged, - "RemoteAudioStateChanged" to RemoteAudioStateChanged, - "LocalPublishFallbackToAudioOnly" to LocalPublishFallbackToAudioOnly, - "RemoteSubscribeFallbackToAudioOnly" to RemoteSubscribeFallbackToAudioOnly, - "RtcStats" to RtcStats, - "NetworkQuality" to NetworkQuality, - "RemoteVideoStats" to RemoteVideoStats, - "RemoteAudioStats" to RemoteAudioStats, - "RtmpStreamingStateChanged" to RtmpStreamingStateChanged, - "TranscodingUpdated" to TranscodingUpdated, - "StreamInjectedStatus" to StreamInjectedStatus, - "StreamMessage" to StreamMessage, - "StreamMessageError" to StreamMessageError, - "ChannelMediaRelayStateChanged" to ChannelMediaRelayStateChanged, - "ChannelMediaRelayEvent" to ChannelMediaRelayEvent, - "MetadataReceived" to MetadataReceived, - "AudioPublishStateChanged" to AudioPublishStateChanged, - "VideoPublishStateChanged" to VideoPublishStateChanged, - "AudioSubscribeStateChanged" to AudioSubscribeStateChanged, - "VideoSubscribeStateChanged" to VideoSubscribeStateChanged, - "RtmpStreamingEvent" to RtmpStreamingEvent, - "UserSuperResolutionEnabled" to UserSuperResolutionEnabled - ) - } - } -} - -class RtcChannelEventHandler( - private val emitter: (methodName: String, data: Map?) -> Unit -) : IRtcChannelEventHandler() { - companion object { - const val PREFIX = "io.agora.rtc." - } - - private fun callback(methodName: String, channel: RtcChannel?, vararg data: Any?) { - channel?.let { - emitter(methodName, hashMapOf( - "channelId" to it.channelId(), - "data" to data.toList() - )) - } - } - - override fun onChannelWarning(rtcChannel: RtcChannel?, @Annotations.AgoraWarningCode warn: Int) { - callback(RtcChannelEvents.Warning, rtcChannel, warn) - } - - override fun onChannelError(rtcChannel: RtcChannel?, @Annotations.AgoraErrorCode err: Int) { - callback(RtcChannelEvents.Error, rtcChannel, err) - } - - override fun onJoinChannelSuccess(rtcChannel: RtcChannel?, uid: Int, elapsed: Int) { - callback(RtcChannelEvents.JoinChannelSuccess, rtcChannel, rtcChannel?.channelId(), uid, elapsed) - } - - override fun onRejoinChannelSuccess(rtcChannel: RtcChannel?, uid: Int, elapsed: Int) { - callback(RtcChannelEvents.RejoinChannelSuccess, rtcChannel, rtcChannel?.channelId(), uid, elapsed) - } - - override fun onLeaveChannel(rtcChannel: RtcChannel?, stats: IRtcEngineEventHandler.RtcStats?) { - callback(RtcChannelEvents.LeaveChannel, rtcChannel, stats?.toMap()) - } - - override fun onClientRoleChanged(rtcChannel: RtcChannel?, @Annotations.AgoraClientRole oldRole: Int, @Annotations.AgoraClientRole newRole: Int) { - callback(RtcChannelEvents.ClientRoleChanged, rtcChannel, oldRole, newRole) - } - - override fun onUserJoined(rtcChannel: RtcChannel?, uid: Int, elapsed: Int) { - callback(RtcChannelEvents.UserJoined, rtcChannel, uid, elapsed) - } - - override fun onUserOffline(rtcChannel: RtcChannel?, uid: Int, @Annotations.AgoraUserOfflineReason reason: Int) { - callback(RtcChannelEvents.UserOffline, rtcChannel, uid, reason) - } - - override fun onConnectionStateChanged(rtcChannel: RtcChannel?, @Annotations.AgoraConnectionStateType state: Int, @Annotations.AgoraConnectionChangedReason reason: Int) { - callback(RtcChannelEvents.ConnectionStateChanged, rtcChannel, state, reason) - } - - override fun onConnectionLost(rtcChannel: RtcChannel?) { - callback(RtcChannelEvents.ConnectionLost, rtcChannel) - } - - override fun onTokenPrivilegeWillExpire(rtcChannel: RtcChannel?, token: String?) { - callback(RtcChannelEvents.TokenPrivilegeWillExpire, rtcChannel, token) - } - - override fun onRequestToken(rtcChannel: RtcChannel?) { - callback(RtcChannelEvents.RequestToken, rtcChannel) - } - - override fun onActiveSpeaker(rtcChannel: RtcChannel?, uid: Int) { - callback(RtcChannelEvents.ActiveSpeaker, rtcChannel, uid) - } - - override fun onVideoSizeChanged(rtcChannel: RtcChannel?, uid: Int, width: Int, height: Int, @IntRange(from = 0, to = 360) rotation: Int) { - callback(RtcChannelEvents.VideoSizeChanged, rtcChannel, uid, width, height, rotation) - } - - override fun onRemoteVideoStateChanged(rtcChannel: RtcChannel?, uid: Int, @Annotations.AgoraVideoRemoteState state: Int, @Annotations.AgoraVideoRemoteStateReason reason: Int, elapsed: Int) { - callback(RtcChannelEvents.RemoteVideoStateChanged, rtcChannel, uid, state, reason, elapsed) - } - - override fun onRemoteAudioStateChanged(rtcChannel: RtcChannel?, uid: Int, @Annotations.AgoraAudioRemoteState state: Int, @Annotations.AgoraAudioRemoteStateReason reason: Int, elapsed: Int) { - callback(RtcChannelEvents.RemoteAudioStateChanged, rtcChannel, uid, state, reason, elapsed) - } - - override fun onLocalPublishFallbackToAudioOnly(rtcChannel: RtcChannel?, isFallbackOrRecover: Boolean) { - callback(RtcChannelEvents.LocalPublishFallbackToAudioOnly, rtcChannel, isFallbackOrRecover) - } - - override fun onRemoteSubscribeFallbackToAudioOnly(rtcChannel: RtcChannel?, uid: Int, isFallbackOrRecover: Boolean) { - callback(RtcChannelEvents.RemoteSubscribeFallbackToAudioOnly, rtcChannel, uid, isFallbackOrRecover) - } - - override fun onRtcStats(rtcChannel: RtcChannel?, stats: IRtcEngineEventHandler.RtcStats?) { - callback(RtcChannelEvents.RtcStats, rtcChannel, stats?.toMap()) - } - - override fun onNetworkQuality(rtcChannel: RtcChannel?, uid: Int, @Annotations.AgoraNetworkQuality txQuality: Int, @Annotations.AgoraNetworkQuality rxQuality: Int) { - callback(RtcChannelEvents.NetworkQuality, rtcChannel, uid, txQuality, rxQuality) - } - - override fun onRemoteVideoStats(rtcChannel: RtcChannel?, stats: IRtcEngineEventHandler.RemoteVideoStats?) { - callback(RtcChannelEvents.RemoteVideoStats, rtcChannel, stats?.toMap()) - } - - override fun onRemoteAudioStats(rtcChannel: RtcChannel?, stats: IRtcEngineEventHandler.RemoteAudioStats?) { - callback(RtcChannelEvents.RemoteAudioStats, rtcChannel, stats?.toMap()) - } - - override fun onRtmpStreamingStateChanged(rtcChannel: RtcChannel?, url: String?, @Annotations.AgoraRtmpStreamingState state: Int, @Annotations.AgoraRtmpStreamingErrorCode errCode: Int) { - callback(RtcChannelEvents.RtmpStreamingStateChanged, rtcChannel, url, state, errCode) - } - - override fun onTranscodingUpdated(rtcChannel: RtcChannel?) { - callback(RtcChannelEvents.TranscodingUpdated, rtcChannel) - } - - override fun onStreamInjectedStatus(rtcChannel: RtcChannel?, url: String?, uid: Int, @Annotations.AgoraInjectStreamStatus status: Int) { - callback(RtcChannelEvents.StreamInjectedStatus, rtcChannel, url, uid, status) - } - - override fun onStreamMessage(rtcChannel: RtcChannel?, uid: Int, streamId: Int, data: ByteArray?) { - callback(RtcChannelEvents.StreamMessage, rtcChannel, uid, streamId, data?.let { String(it, Charsets.UTF_8) }) - } - - override fun onStreamMessageError(rtcChannel: RtcChannel?, uid: Int, streamId: Int, @Annotations.AgoraErrorCode error: Int, missed: Int, cached: Int) { - callback(RtcChannelEvents.StreamMessageError, rtcChannel, uid, streamId, error, missed, cached) - } - - override fun onChannelMediaRelayStateChanged(rtcChannel: RtcChannel?, @Annotations.AgoraChannelMediaRelayState state: Int, @Annotations.AgoraChannelMediaRelayError code: Int) { - callback(RtcChannelEvents.ChannelMediaRelayStateChanged, rtcChannel, state, code) - } - - override fun onChannelMediaRelayEvent(rtcChannel: RtcChannel?, @Annotations.AgoraChannelMediaRelayEvent code: Int) { - callback(RtcChannelEvents.ChannelMediaRelayEvent, rtcChannel, code) - } - - override fun onAudioPublishStateChanged(rtcChannel: RtcChannel?, @Annotations.AgoraStreamPublishState oldState: Int, @Annotations.AgoraStreamPublishState newState: Int, elapseSinceLastState: Int) { - callback(RtcChannelEvents.AudioPublishStateChanged, rtcChannel, rtcChannel?.channelId(), oldState, newState, elapseSinceLastState) - } - - override fun onVideoPublishStateChanged(rtcChannel: RtcChannel?, @Annotations.AgoraStreamPublishState oldState: Int, @Annotations.AgoraStreamPublishState newState: Int, elapseSinceLastState: Int) { - callback(RtcChannelEvents.VideoPublishStateChanged, rtcChannel, rtcChannel?.channelId(), oldState, newState, elapseSinceLastState) - } - - override fun onAudioSubscribeStateChanged(rtcChannel: RtcChannel?, uid: Int, @Annotations.AgoraStreamSubscribeState oldState: Int, @Annotations.AgoraStreamSubscribeState newState: Int, elapseSinceLastState: Int) { - callback(RtcChannelEvents.AudioSubscribeStateChanged, rtcChannel, rtcChannel?.channelId(), uid, oldState, newState, elapseSinceLastState) - } - - override fun onVideoSubscribeStateChanged(rtcChannel: RtcChannel?, uid: Int, @Annotations.AgoraStreamSubscribeState oldState: Int, @Annotations.AgoraStreamSubscribeState newState: Int, elapseSinceLastState: Int) { - callback(RtcChannelEvents.VideoSubscribeStateChanged, rtcChannel, rtcChannel?.channelId(), uid, oldState, newState, elapseSinceLastState) - } - - override fun onRtmpStreamingEvent(rtcChannel: RtcChannel?, url: String?, @Annotations.AgoraRtmpStreamingEvent errCode: Int) { - callback(RtcChannelEvents.RtmpStreamingEvent, rtcChannel, url, errCode) - } - - override fun onUserSuperResolutionEnabled(rtcChannel: RtcChannel?, uid: Int, enabled: Boolean, @Annotations.AgoraSuperResolutionStateReason reason: Int) { - callback(RtcChannelEvents.UserSuperResolutionEnabled, rtcChannel, uid, enabled, reason) - } -} diff --git a/android/src/main/java/io/agora/rtc/base/RtcEngine.kt b/android/src/main/java/io/agora/rtc/base/RtcEngine.kt deleted file mode 100644 index c245fd2bb..000000000 --- a/android/src/main/java/io/agora/rtc/base/RtcEngine.kt +++ /dev/null @@ -1,997 +0,0 @@ -package io.agora.rtc.base - -import android.content.Context -import io.agora.rtc.* -import io.agora.rtc.internal.EncryptionConfig -import io.agora.rtc.models.UserInfo - -class IRtcEngine { - interface RtcEngineInterface : RtcUserInfoInterface, RtcAudioInterface, RtcVideoInterface, - RtcAudioMixingInterface, RtcAudioEffectInterface, RtcVoiceChangerInterface, - RtcVoicePositionInterface, RtcPublishStreamInterface, RtcMediaRelayInterface, - RtcAudioRouteInterface, RtcEarMonitoringInterface, RtcDualStreamInterface, - RtcFallbackInterface, RtcTestInterface, RtcMediaMetadataInterface, - RtcWatermarkInterface, RtcEncryptionInterface, RtcAudioRecorderInterface, - RtcInjectStreamInterface, RtcCameraInterface, RtcStreamMessageInterface { - fun create(params: Map, callback: Callback) - - fun destroy(callback: Callback) - - fun setChannelProfile(params: Map, callback: Callback) - - fun setClientRole(params: Map, callback: Callback) - - fun joinChannel(params: Map, callback: Callback) - - fun switchChannel(params: Map, callback: Callback) - - fun leaveChannel(callback: Callback) - - fun renewToken(params: Map, callback: Callback) - - @Deprecated("") - fun enableWebSdkInteroperability(params: Map, callback: Callback) - - fun getConnectionState(callback: Callback) - - fun sendCustomReportMessage(params: Map, callback: Callback) - - fun getCallId(callback: Callback) - - fun rate(params: Map, callback: Callback) - - fun complain(params: Map, callback: Callback) - - @Deprecated("") - fun setLogFile(params: Map, callback: Callback) - - @Deprecated("") - fun setLogFilter(params: Map, callback: Callback) - - @Deprecated("") - fun setLogFileSize(params: Map, callback: Callback) - - fun setParameters(params: Map, callback: Callback) - - fun getSdkVersion(callback: Callback) - - fun getErrorDescription(params: Map, callback: Callback) - - fun getNativeHandle(callback: Callback) - - fun enableDeepLearningDenoise(params: Map, callback: Callback) - - fun setCloudProxy(params: Map, callback: Callback) - - fun uploadLogFile(callback: Callback) - } - - interface RtcUserInfoInterface { - fun registerLocalUserAccount(params: Map, callback: Callback) - - fun joinChannelWithUserAccount(params: Map, callback: Callback) - - fun getUserInfoByUserAccount(params: Map, callback: Callback) - - fun getUserInfoByUid(params: Map, callback: Callback) - } - - interface RtcAudioInterface { - fun enableAudio(callback: Callback) - - fun disableAudio(callback: Callback) - - fun setAudioProfile(params: Map, callback: Callback) - - fun adjustRecordingSignalVolume(params: Map, callback: Callback) - - fun adjustUserPlaybackSignalVolume(params: Map, callback: Callback) - - fun adjustPlaybackSignalVolume(params: Map, callback: Callback) - - fun enableLocalAudio(params: Map, callback: Callback) - - fun muteLocalAudioStream(params: Map, callback: Callback) - - fun muteRemoteAudioStream(params: Map, callback: Callback) - - fun muteAllRemoteAudioStreams(params: Map, callback: Callback) - - @Deprecated("") - fun setDefaultMuteAllRemoteAudioStreams(params: Map, callback: Callback) - - fun enableAudioVolumeIndication(params: Map, callback: Callback) - } - - interface RtcVideoInterface { - fun enableVideo(callback: Callback) - - fun disableVideo(callback: Callback) - - fun setVideoEncoderConfiguration(params: Map, callback: Callback) - - fun startPreview(callback: Callback) - - fun stopPreview(callback: Callback) - - fun enableLocalVideo(params: Map, callback: Callback) - - fun muteLocalVideoStream(params: Map, callback: Callback) - - fun muteRemoteVideoStream(params: Map, callback: Callback) - - fun muteAllRemoteVideoStreams(params: Map, callback: Callback) - - @Deprecated("") - fun setDefaultMuteAllRemoteVideoStreams(params: Map, callback: Callback) - - fun setBeautyEffectOptions(params: Map, callback: Callback) - - fun enableRemoteSuperResolution(params: Map, callback: Callback) - } - - interface RtcAudioMixingInterface { - fun startAudioMixing(params: Map, callback: Callback) - - fun stopAudioMixing(callback: Callback) - - fun pauseAudioMixing(callback: Callback) - - fun resumeAudioMixing(callback: Callback) - - fun adjustAudioMixingVolume(params: Map, callback: Callback) - - fun adjustAudioMixingPlayoutVolume(params: Map, callback: Callback) - - fun adjustAudioMixingPublishVolume(params: Map, callback: Callback) - - fun getAudioMixingPlayoutVolume(callback: Callback) - - fun getAudioMixingPublishVolume(callback: Callback) - - fun getAudioMixingDuration(callback: Callback) - - fun getAudioMixingCurrentPosition(callback: Callback) - - fun setAudioMixingPosition(params: Map, callback: Callback) - - fun setAudioMixingPitch(params: Map, callback: Callback) - } - - interface RtcAudioEffectInterface { - fun getEffectsVolume(callback: Callback) - - fun setEffectsVolume(params: Map, callback: Callback) - - fun setVolumeOfEffect(params: Map, callback: Callback) - - fun playEffect(params: Map, callback: Callback) - - fun stopEffect(params: Map, callback: Callback) - - fun stopAllEffects(callback: Callback) - - fun preloadEffect(params: Map, callback: Callback) - - fun unloadEffect(params: Map, callback: Callback) - - fun pauseEffect(params: Map, callback: Callback) - - fun pauseAllEffects(callback: Callback) - - fun resumeEffect(params: Map, callback: Callback) - - fun resumeAllEffects(callback: Callback) - - fun setAudioSessionOperationRestriction(params: Map, callback: Callback) - } - - interface RtcVoiceChangerInterface { - @Deprecated("") - fun setLocalVoiceChanger(params: Map, callback: Callback) - - @Deprecated("") - fun setLocalVoiceReverbPreset(params: Map, callback: Callback) - - fun setLocalVoicePitch(params: Map, callback: Callback) - - fun setLocalVoiceEqualization(params: Map, callback: Callback) - - fun setLocalVoiceReverb(params: Map, callback: Callback) - - fun setAudioEffectPreset(params: Map, callback: Callback) - - fun setVoiceBeautifierPreset(params: Map, callback: Callback) - - fun setVoiceConversionPreset(params: Map, callback: Callback) - - fun setAudioEffectParameters(params: Map, callback: Callback) - - fun setVoiceBeautifierParameters(params: Map, callback: Callback) - } - - interface RtcVoicePositionInterface { - fun enableSoundPositionIndication(params: Map, callback: Callback) - - fun setRemoteVoicePosition(params: Map, callback: Callback) - } - - interface RtcPublishStreamInterface { - fun setLiveTranscoding(params: Map, callback: Callback) - - fun addPublishStreamUrl(params: Map, callback: Callback) - - fun removePublishStreamUrl(params: Map, callback: Callback) - } - - interface RtcMediaRelayInterface { - fun startChannelMediaRelay(params: Map, callback: Callback) - - fun updateChannelMediaRelay(params: Map, callback: Callback) - - fun stopChannelMediaRelay(callback: Callback) - } - - interface RtcAudioRouteInterface { - fun setDefaultAudioRoutetoSpeakerphone(params: Map, callback: Callback) - - fun setEnableSpeakerphone(params: Map, callback: Callback) - - fun isSpeakerphoneEnabled(callback: Callback) - } - - interface RtcEarMonitoringInterface { - fun enableInEarMonitoring(params: Map, callback: Callback) - - fun setInEarMonitoringVolume(params: Map, callback: Callback) - } - - interface RtcDualStreamInterface { - fun enableDualStreamMode(params: Map, callback: Callback) - - fun setRemoteVideoStreamType(params: Map, callback: Callback) - - fun setRemoteDefaultVideoStreamType(params: Map, callback: Callback) - } - - interface RtcFallbackInterface { - fun setLocalPublishFallbackOption(params: Map, callback: Callback) - - fun setRemoteSubscribeFallbackOption(params: Map, callback: Callback) - - fun setRemoteUserPriority(params: Map, callback: Callback) - } - - interface RtcTestInterface { - fun startEchoTest(params: Map, callback: Callback) - - fun stopEchoTest(callback: Callback) - - fun enableLastmileTest(callback: Callback) - - fun disableLastmileTest(callback: Callback) - - fun startLastmileProbeTest(params: Map, callback: Callback) - - fun stopLastmileProbeTest(callback: Callback) - } - - interface RtcMediaMetadataInterface { - fun registerMediaMetadataObserver(callback: Callback) - - fun unregisterMediaMetadataObserver(callback: Callback) - - fun setMaxMetadataSize(params: Map, callback: Callback) - - fun sendMetadata(params: Map, callback: Callback) - } - - interface RtcWatermarkInterface { - fun addVideoWatermark(params: Map, callback: Callback) - - fun clearVideoWatermarks(callback: Callback) - } - - interface RtcEncryptionInterface { - @Deprecated("") - fun setEncryptionSecret(params: Map, callback: Callback) - - @Deprecated("") - fun setEncryptionMode(params: Map, callback: Callback) - - fun enableEncryption(params: Map, callback: Callback) - } - - interface RtcAudioRecorderInterface { - fun startAudioRecording(params: Map, callback: Callback) - - fun stopAudioRecording(callback: Callback) - } - - interface RtcInjectStreamInterface { - fun addInjectStreamUrl(params: Map, callback: Callback) - - fun removeInjectStreamUrl(params: Map, callback: Callback) - } - - interface RtcCameraInterface { - fun switchCamera(callback: Callback) - - fun isCameraZoomSupported(callback: Callback) - - fun isCameraTorchSupported(callback: Callback) - - fun isCameraFocusSupported(callback: Callback) - - fun isCameraExposurePositionSupported(callback: Callback) - - fun isCameraAutoFocusFaceModeSupported(callback: Callback) - - fun setCameraZoomFactor(params: Map, callback: Callback) - - fun getCameraMaxZoomFactor(callback: Callback) - - fun setCameraFocusPositionInPreview(params: Map, callback: Callback) - - fun setCameraExposurePosition(params: Map, callback: Callback) - - fun enableFaceDetection(params: Map, callback: Callback) - - fun setCameraTorchOn(params: Map, callback: Callback) - - fun setCameraAutoFocusFaceModeEnabled(params: Map, callback: Callback) - - fun setCameraCapturerConfiguration(params: Map, callback: Callback) - } - - interface RtcStreamMessageInterface { - fun createDataStream(params: Map, callback: Callback) - - fun sendStreamMessage(params: Map, callback: Callback) - } -} - -class RtcEngineManager( - private val emit: (methodName: String, data: Map?) -> Unit -) : IRtcEngine.RtcEngineInterface { - var engine: RtcEngine? = null - private set - private var mediaObserver: MediaObserver? = null - - fun release() { - RtcEngine.destroy() - engine = null - mediaObserver = null - } - - override fun create(params: Map, callback: Callback) { - engine = RtcEngineEx.create(mapToRtcEngineConfig(params["config"] as Map<*, *>).apply { - mContext = params["context"] as Context - mEventHandler = RtcEngineEventHandler { methodName, data -> - emit(methodName, data) - } - }) - callback.code((engine as RtcEngineEx).setAppType((params["appType"] as Number).toInt())) - } - - override fun destroy(callback: Callback) { - callback.resolve(engine) { release() } - } - - override fun setChannelProfile(params: Map, callback: Callback) { - callback.code(engine?.setChannelProfile((params["profile"] as Number).toInt())) - } - - override fun setClientRole(params: Map, callback: Callback) { - val role = (params["role"] as Number).toInt() - (params["options"] as? Map<*, *>)?.let { - callback.code(engine?.setClientRole(role, mapToClientRoleOptions(it))) - return@setClientRole - } - callback.code(engine?.setClientRole(role)) - } - - override fun joinChannel(params: Map, callback: Callback) { - val token = params["token"] as? String - val channelName = params["channelName"] as String - val optionalInfo = params["optionalInfo"] as? String - val optionalUid = (params["optionalUid"] as Number).toInt() - (params["options"] as? Map<*, *>)?.let { - callback.code(engine?.joinChannel(token, channelName, optionalInfo, optionalUid, mapToChannelMediaOptions(it))) - return@joinChannel - } - callback.code(engine?.joinChannel(token, channelName, optionalInfo, optionalUid)) - } - - override fun switchChannel(params: Map, callback: Callback) { - val token = params["token"] as? String - val channelName = params["channelName"] as String - (params["options"] as? Map<*, *>)?.let { - callback.code(engine?.switchChannel(token, channelName, mapToChannelMediaOptions(it))) - return@switchChannel - } - callback.code(engine?.switchChannel(token, channelName)) - } - - override fun leaveChannel(callback: Callback) { - callback.code(engine?.leaveChannel()) - } - - override fun renewToken(params: Map, callback: Callback) { - callback.code(engine?.renewToken(params["token"] as String)) - } - - override fun enableWebSdkInteroperability(params: Map, callback: Callback) { - callback.code(engine?.enableWebSdkInteroperability(params["enabled"] as Boolean)) - } - - override fun getConnectionState(callback: Callback) { - callback.resolve(engine) { it.connectionState } - } - - override fun sendCustomReportMessage(params: Map, callback: Callback) { - callback.code(engine?.sendCustomReportMessage(params["id"] as String, params["category"] as String, params["event"] as String, params["label"] as String, (params["value"] as Number).toInt())) - } - - override fun getCallId(callback: Callback) { - callback.resolve(engine) { it.callId } - } - - override fun rate(params: Map, callback: Callback) { - callback.code(engine?.rate(params["callId"] as String, (params["rating"] as Number).toInt(), params["description"] as? String)) - } - - override fun complain(params: Map, callback: Callback) { - callback.code(engine?.complain(params["callId"] as String, params["description"] as String)) - } - - override fun setLogFile(params: Map, callback: Callback) { - callback.code(engine?.setLogFile(params["filePath"] as String)) - } - - override fun setLogFilter(params: Map, callback: Callback) { - callback.code(engine?.setLogFilter((params["filter"] as Number).toInt())) - } - - override fun setLogFileSize(params: Map, callback: Callback) { - callback.code(engine?.setLogFileSize((params["fileSizeInKBytes"] as Number).toInt())) - } - - override fun setParameters(params: Map, callback: Callback) { - callback.code(engine?.setParameters(params["parameters"] as String)) - } - - override fun getSdkVersion(callback: Callback) { - callback.success(RtcEngine.getSdkVersion()) - } - - override fun getErrorDescription(params: Map, callback: Callback) { - callback.success(RtcEngine.getErrorDescription((params["error"] as Number).toInt())) - } - - override fun getNativeHandle(callback: Callback) { - callback.resolve(engine) { it.nativeHandle } - } - - override fun enableDeepLearningDenoise(params: Map, callback: Callback) { - callback.code(engine?.enableDeepLearningDenoise(params["enabled"] as Boolean)) - } - - override fun setCloudProxy(params: Map, callback: Callback) { - callback.code(engine?.setCloudProxy((params["proxyType"] as Number).toInt())) - } - - override fun uploadLogFile(callback: Callback) { - callback.resolve(engine) { it.uploadLogFile() } - } - - override fun registerLocalUserAccount(params: Map, callback: Callback) { - callback.code(engine?.registerLocalUserAccount(params["appId"] as String, params["userAccount"] as String)) - } - - override fun joinChannelWithUserAccount(params: Map, callback: Callback) { - val token = params["token"] as? String - val channelName = params["channelName"] as String - val userAccount = params["userAccount"] as String - (params["options"] as? Map<*, *>)?.let { - callback.code(engine?.joinChannelWithUserAccount(token, channelName, userAccount, mapToChannelMediaOptions(it))) - return@joinChannelWithUserAccount - } - callback.code(engine?.joinChannelWithUserAccount(token, channelName, userAccount)) - } - - override fun getUserInfoByUserAccount(params: Map, callback: Callback) { - callback.resolve(engine) { - val userInfo = UserInfo() - it.getUserInfoByUserAccount(params["userAccount"] as String, userInfo) - userInfo.toMap() - } - } - - override fun getUserInfoByUid(params: Map, callback: Callback) { - callback.resolve(engine) { - val userInfo = UserInfo() - it.getUserInfoByUid((params["uid"] as Number).toInt(), userInfo) - userInfo.toMap() - } - } - - override fun enableAudio(callback: Callback) { - callback.code(engine?.enableAudio()) - } - - override fun disableAudio(callback: Callback) { - callback.code(engine?.disableAudio()) - } - - override fun setAudioProfile(params: Map, callback: Callback) { - callback.code(engine?.setAudioProfile((params["profile"] as Number).toInt(), (params["scenario"] as Number).toInt())) - } - - override fun adjustRecordingSignalVolume(params: Map, callback: Callback) { - callback.code(engine?.adjustRecordingSignalVolume((params["volume"] as Number).toInt())) - } - - override fun adjustUserPlaybackSignalVolume(params: Map, callback: Callback) { - callback.code(engine?.adjustUserPlaybackSignalVolume((params["uid"] as Number).toInt(), (params["volume"] as Number).toInt())) - } - - override fun adjustPlaybackSignalVolume(params: Map, callback: Callback) { - callback.code(engine?.adjustPlaybackSignalVolume((params["volume"] as Number).toInt())) - } - - override fun enableLocalAudio(params: Map, callback: Callback) { - callback.code(engine?.enableLocalAudio(params["enabled"] as Boolean)) - } - - override fun muteLocalAudioStream(params: Map, callback: Callback) { - callback.code(engine?.muteLocalAudioStream(params["muted"] as Boolean)) - } - - override fun muteRemoteAudioStream(params: Map, callback: Callback) { - callback.code(engine?.muteRemoteAudioStream((params["uid"] as Number).toInt(), params["muted"] as Boolean)) - } - - override fun muteAllRemoteAudioStreams(params: Map, callback: Callback) { - callback.code(engine?.muteAllRemoteAudioStreams(params["muted"] as Boolean)) - } - - override fun setDefaultMuteAllRemoteAudioStreams(params: Map, callback: Callback) { - callback.code(engine?.setDefaultMuteAllRemoteAudioStreams(params["muted"] as Boolean)) - } - - override fun enableAudioVolumeIndication(params: Map, callback: Callback) { - callback.code(engine?.enableAudioVolumeIndication((params["interval"] as Number).toInt(), (params["smooth"] as Number).toInt(), params["report_vad"] as Boolean)) - } - - override fun enableVideo(callback: Callback) { - callback.code(engine?.enableVideo()) - } - - override fun disableVideo(callback: Callback) { - callback.code(engine?.disableVideo()) - } - - override fun setVideoEncoderConfiguration(params: Map, callback: Callback) { - callback.code(engine?.setVideoEncoderConfiguration(mapToVideoEncoderConfiguration(params["config"] as Map<*, *>))) - } - - override fun startPreview(callback: Callback) { - callback.code(engine?.startPreview()) - } - - override fun stopPreview(callback: Callback) { - callback.code(engine?.stopPreview()) - } - - override fun enableLocalVideo(params: Map, callback: Callback) { - callback.code(engine?.enableLocalVideo(params["enabled"] as Boolean)) - } - - override fun muteLocalVideoStream(params: Map, callback: Callback) { - callback.code(engine?.muteLocalVideoStream(params["muted"] as Boolean)) - } - - override fun muteRemoteVideoStream(params: Map, callback: Callback) { - callback.code(engine?.muteRemoteVideoStream((params["uid"] as Number).toInt(), params["muted"] as Boolean)) - } - - override fun muteAllRemoteVideoStreams(params: Map, callback: Callback) { - callback.code(engine?.muteAllRemoteVideoStreams(params["muted"] as Boolean)) - } - - override fun setDefaultMuteAllRemoteVideoStreams(params: Map, callback: Callback) { - callback.code(engine?.setDefaultMuteAllRemoteVideoStreams(params["muted"] as Boolean)) - } - - override fun setBeautyEffectOptions(params: Map, callback: Callback) { - callback.code(engine?.setBeautyEffectOptions(params["enabled"] as Boolean, mapToBeautyOptions(params["options"] as Map<*, *>))) - } - - override fun enableRemoteSuperResolution(params: Map, callback: Callback) { - callback.code(engine?.enableRemoteSuperResolution((params["uid"] as Number).toInt(), params["enable"] as Boolean)) - } - - override fun startAudioMixing(params: Map, callback: Callback) { - callback.code(engine?.startAudioMixing(params["filePath"] as String, params["loopback"] as Boolean, params["replace"] as Boolean, (params["cycle"] as Number).toInt())) - } - - override fun stopAudioMixing(callback: Callback) { - callback.code(engine?.stopAudioMixing()) - } - - override fun pauseAudioMixing(callback: Callback) { - callback.code(engine?.pauseAudioMixing()) - } - - override fun resumeAudioMixing(callback: Callback) { - callback.code(engine?.resumeAudioMixing()) - } - - override fun adjustAudioMixingVolume(params: Map, callback: Callback) { - callback.code(engine?.adjustAudioMixingVolume((params["volume"] as Number).toInt())) - } - - override fun adjustAudioMixingPlayoutVolume(params: Map, callback: Callback) { - callback.code(engine?.adjustAudioMixingPlayoutVolume((params["volume"] as Number).toInt())) - } - - override fun adjustAudioMixingPublishVolume(params: Map, callback: Callback) { - callback.code(engine?.adjustAudioMixingPublishVolume((params["volume"] as Number).toInt())) - } - - override fun getAudioMixingPlayoutVolume(callback: Callback) { - callback.code(engine?.audioMixingPlayoutVolume) { it } - } - - override fun getAudioMixingPublishVolume(callback: Callback) { - callback.code(engine?.audioMixingPublishVolume) { it } - } - - override fun getAudioMixingDuration(callback: Callback) { - callback.code(engine?.audioMixingDuration) { it } - } - - override fun getAudioMixingCurrentPosition(callback: Callback) { - callback.code(engine?.audioMixingCurrentPosition) { it } - } - - override fun setAudioMixingPosition(params: Map, callback: Callback) { - callback.code(engine?.setAudioMixingPosition((params["pos"] as Number).toInt())) - } - - override fun setAudioMixingPitch(params: Map, callback: Callback) { - callback.code(engine?.setAudioMixingPitch((params["pitch"] as Number).toInt())) - } - - override fun getEffectsVolume(callback: Callback) { - callback.resolve(engine) { it.audioEffectManager.effectsVolume } - } - - override fun setEffectsVolume(params: Map, callback: Callback) { - callback.code(engine?.audioEffectManager?.setEffectsVolume((params["volume"] as Number).toDouble())) - } - - override fun setVolumeOfEffect(params: Map, callback: Callback) { - callback.code(engine?.audioEffectManager?.setVolumeOfEffect((params["soundId"] as Number).toInt(), (params["volume"] as Number).toDouble())) - } - - override fun playEffect(params: Map, callback: Callback) { - callback.code(engine?.audioEffectManager?.playEffect((params["soundId"] as Number).toInt(), params["filePath"] as String, (params["loopCount"] as Number).toInt(), (params["pitch"] as Number).toDouble(), (params["pan"] as Number).toDouble(), (params["gain"] as Number).toDouble(), params["publish"] as Boolean)) - } - - override fun stopEffect(params: Map, callback: Callback) { - callback.code(engine?.audioEffectManager?.stopEffect((params["soundId"] as Number).toInt())) - } - - override fun stopAllEffects(callback: Callback) { - callback.code(engine?.audioEffectManager?.stopAllEffects()) - } - - override fun preloadEffect(params: Map, callback: Callback) { - callback.code(engine?.audioEffectManager?.preloadEffect((params["soundId"] as Number).toInt(), params["filePath"] as String)) - } - - override fun unloadEffect(params: Map, callback: Callback) { - callback.code(engine?.audioEffectManager?.unloadEffect((params["soundId"] as Number).toInt())) - } - - override fun pauseEffect(params: Map, callback: Callback) { - callback.code(engine?.audioEffectManager?.pauseEffect((params["soundId"] as Number).toInt())) - } - - override fun pauseAllEffects(callback: Callback) { - callback.code(engine?.audioEffectManager?.pauseAllEffects()) - } - - override fun resumeEffect(params: Map, callback: Callback) { - callback.code(engine?.audioEffectManager?.resumeEffect((params["soundId"] as Number).toInt())) - } - - override fun resumeAllEffects(callback: Callback) { - callback.code(engine?.audioEffectManager?.resumeAllEffects()) - } - - override fun setAudioSessionOperationRestriction(params: Map, callback: Callback) { - callback.code(-Constants.ERR_NOT_SUPPORTED) - } - - override fun setLocalVoiceChanger(params: Map, callback: Callback) { - callback.code(engine?.setLocalVoiceChanger((params["voiceChanger"] as Number).toInt())) - } - - override fun setLocalVoiceReverbPreset(params: Map, callback: Callback) { - callback.code(engine?.setLocalVoiceReverbPreset((params["preset"] as Number).toInt())) - } - - override fun setLocalVoicePitch(params: Map, callback: Callback) { - callback.code(engine?.setLocalVoicePitch((params["pitch"] as Number).toDouble())) - } - - override fun setLocalVoiceEqualization(params: Map, callback: Callback) { - callback.code(engine?.setLocalVoiceEqualization((params["bandFrequency"] as Number).toInt(), (params["bandGain"] as Number).toInt())) - } - - override fun setLocalVoiceReverb(params: Map, callback: Callback) { - callback.code(engine?.setLocalVoiceReverb((params["reverbKey"] as Number).toInt(), (params["value"] as Number).toInt())) - } - - override fun setAudioEffectPreset(params: Map, callback: Callback) { - callback.code(engine?.setAudioEffectPreset((params["preset"] as Number).toInt())) - } - - override fun setVoiceBeautifierPreset(params: Map, callback: Callback) { - callback.code(engine?.setVoiceBeautifierPreset((params["preset"] as Number).toInt())) - } - - override fun setVoiceConversionPreset(params: Map, callback: Callback) { - callback.code(engine?.setVoiceConversionPreset((params["preset"] as Number).toInt())) - } - - override fun setAudioEffectParameters(params: Map, callback: Callback) { - callback.code(engine?.setAudioEffectParameters((params["preset"] as Number).toInt(), (params["param1"] as Number).toInt(), (params["param2"] as Number).toInt())) - } - - override fun setVoiceBeautifierParameters(params: Map, callback: Callback) { - callback.code(engine?.setVoiceBeautifierParameters((params["preset"] as Number).toInt(), (params["param1"] as Number).toInt(), (params["param2"] as Number).toInt())) - } - - override fun enableSoundPositionIndication(params: Map, callback: Callback) { - callback.code(engine?.enableSoundPositionIndication(params["enabled"] as Boolean)) - } - - override fun setRemoteVoicePosition(params: Map, callback: Callback) { - callback.code(engine?.setRemoteVoicePosition((params["uid"] as Number).toInt(), (params["pan"] as Number).toDouble(), (params["gain"] as Number).toDouble())) - } - - override fun setLiveTranscoding(params: Map, callback: Callback) { - callback.code(engine?.setLiveTranscoding(mapToLiveTranscoding(params["transcoding"] as Map<*, *>))) - } - - override fun addPublishStreamUrl(params: Map, callback: Callback) { - callback.code(engine?.addPublishStreamUrl(params["url"] as String, params["transcodingEnabled"] as Boolean)) - } - - override fun removePublishStreamUrl(params: Map, callback: Callback) { - callback.code(engine?.removePublishStreamUrl(params["url"] as String)) - } - - override fun startChannelMediaRelay(params: Map, callback: Callback) { - callback.code(engine?.startChannelMediaRelay(mapToChannelMediaRelayConfiguration(params["channelMediaRelayConfiguration"] as Map<*, *>))) - } - - override fun updateChannelMediaRelay(params: Map, callback: Callback) { - callback.code(engine?.updateChannelMediaRelay(mapToChannelMediaRelayConfiguration(params["channelMediaRelayConfiguration"] as Map<*, *>))) - } - - override fun stopChannelMediaRelay(callback: Callback) { - callback.code(engine?.stopChannelMediaRelay()) - } - - override fun setDefaultAudioRoutetoSpeakerphone(params: Map, callback: Callback) { - callback.code(engine?.setDefaultAudioRoutetoSpeakerphone(params["defaultToSpeaker"] as Boolean)) - } - - override fun setEnableSpeakerphone(params: Map, callback: Callback) { - callback.code(engine?.setEnableSpeakerphone(params["enabled"] as Boolean)) - } - - override fun isSpeakerphoneEnabled(callback: Callback) { - callback.resolve(engine) { it.isSpeakerphoneEnabled } - } - - override fun enableInEarMonitoring(params: Map, callback: Callback) { - callback.code(engine?.enableInEarMonitoring(params["enabled"] as Boolean)) - } - - override fun setInEarMonitoringVolume(params: Map, callback: Callback) { - callback.code(engine?.setInEarMonitoringVolume((params["volume"] as Number).toInt())) - } - - override fun enableDualStreamMode(params: Map, callback: Callback) { - callback.code(engine?.enableDualStreamMode(params["enabled"] as Boolean)) - } - - override fun setRemoteVideoStreamType(params: Map, callback: Callback) { - callback.code(engine?.setRemoteVideoStreamType((params["uid"] as Number).toInt(), (params["streamType"] as Number).toInt())) - } - - override fun setRemoteDefaultVideoStreamType(params: Map, callback: Callback) { - callback.code(engine?.setRemoteDefaultVideoStreamType((params["streamType"] as Number).toInt())) - } - - override fun setLocalPublishFallbackOption(params: Map, callback: Callback) { - callback.code(engine?.setLocalPublishFallbackOption((params["option"] as Number).toInt())) - } - - override fun setRemoteSubscribeFallbackOption(params: Map, callback: Callback) { - callback.code(engine?.setRemoteSubscribeFallbackOption((params["option"] as Number).toInt())) - } - - override fun setRemoteUserPriority(params: Map, callback: Callback) { - callback.code(engine?.setRemoteUserPriority((params["uid"] as Number).toInt(), (params["userPriority"] as Number).toInt())) - } - - override fun startEchoTest(params: Map, callback: Callback) { - callback.code(engine?.startEchoTest((params["intervalInSeconds"] as Number).toInt())) - } - - override fun stopEchoTest(callback: Callback) { - callback.code(engine?.stopEchoTest()) - } - - override fun enableLastmileTest(callback: Callback) { - callback.code(engine?.enableLastmileTest()) - } - - override fun disableLastmileTest(callback: Callback) { - callback.code(engine?.disableLastmileTest()) - } - - override fun startLastmileProbeTest(params: Map, callback: Callback) { - callback.code(engine?.startLastmileProbeTest(mapToLastmileProbeConfig(params["config"] as Map<*, *>))) - } - - override fun stopLastmileProbeTest(callback: Callback) { - callback.code(engine?.stopLastmileProbeTest()) - } - - override fun registerMediaMetadataObserver(callback: Callback) { - val mediaObserver = MediaObserver { data -> - emit(RtcEngineEvents.MetadataReceived, data) - } - callback.code(engine?.registerMediaMetadataObserver(mediaObserver, IMetadataObserver.VIDEO_METADATA)) { - this.mediaObserver = mediaObserver - Unit - } - } - - override fun unregisterMediaMetadataObserver(callback: Callback) { - callback.code(engine?.registerMediaMetadataObserver(null, IMetadataObserver.VIDEO_METADATA)) { - mediaObserver = null - Unit - } - } - - override fun setMaxMetadataSize(params: Map, callback: Callback) { - callback.resolve(mediaObserver) { - it.maxMetadataSize = (params["size"] as Number).toInt() - Unit - } - } - - override fun sendMetadata(params: Map, callback: Callback) { - callback.resolve(mediaObserver) { - it.addMetadata(params["metadata"] as String) - } - } - - override fun addVideoWatermark(params: Map, callback: Callback) { - callback.code(engine?.addVideoWatermark(params["watermarkUrl"] as String, mapToWatermarkOptions(params["options"] as Map<*, *>))) - } - - override fun clearVideoWatermarks(callback: Callback) { - callback.code(engine?.clearVideoWatermarks()) - } - - override fun setEncryptionSecret(params: Map, callback: Callback) { - callback.code(engine?.setEncryptionSecret(params["secret"] as String)) - } - - override fun setEncryptionMode(params: Map, callback: Callback) { - callback.code(engine?.setEncryptionMode(when ((params["encryptionMode"] as Number).toInt()) { - EncryptionConfig.EncryptionMode.AES_128_XTS.value -> "aes-128-xts" - EncryptionConfig.EncryptionMode.AES_128_ECB.value -> "aes-128-ecb" - EncryptionConfig.EncryptionMode.AES_256_XTS.value -> "aes-256-xts" - else -> "" - })) - } - - override fun enableEncryption(params: Map, callback: Callback) { - callback.code(engine?.enableEncryption(params["enabled"] as Boolean, mapToEncryptionConfig(params["config"] as Map<*, *>))) - } - - override fun startAudioRecording(params: Map, callback: Callback) { - callback.code(engine?.startAudioRecording(params["filePath"] as String, (params["sampleRate"] as Number).toInt(), (params["quality"] as Number).toInt())) - } - - override fun stopAudioRecording(callback: Callback) { - callback.code(engine?.stopAudioRecording()) - } - - override fun addInjectStreamUrl(params: Map, callback: Callback) { - callback.code(engine?.addInjectStreamUrl(params["url"] as String, mapToLiveInjectStreamConfig(params["config"] as Map<*, *>))) - } - - override fun removeInjectStreamUrl(params: Map, callback: Callback) { - callback.code(engine?.removeInjectStreamUrl(params["url"] as String)) - } - - override fun switchCamera(callback: Callback) { - callback.code(engine?.switchCamera()) - } - - override fun isCameraZoomSupported(callback: Callback) { - callback.resolve(engine) { it.isCameraZoomSupported } - } - - override fun isCameraTorchSupported(callback: Callback) { - callback.resolve(engine) { it.isCameraTorchSupported } - } - - override fun isCameraFocusSupported(callback: Callback) { - callback.resolve(engine) { it.isCameraFocusSupported } - } - - override fun isCameraExposurePositionSupported(callback: Callback) { - callback.resolve(engine) { it.isCameraExposurePositionSupported } - } - - override fun isCameraAutoFocusFaceModeSupported(callback: Callback) { - callback.resolve(engine) { it.isCameraAutoFocusFaceModeSupported } - } - - override fun setCameraZoomFactor(params: Map, callback: Callback) { - callback.code(engine?.setCameraZoomFactor((params["factor"] as Number).toFloat())) - } - - override fun getCameraMaxZoomFactor(callback: Callback) { - callback.resolve(engine) { it.cameraMaxZoomFactor } - } - - override fun setCameraFocusPositionInPreview(params: Map, callback: Callback) { - callback.code(engine?.setCameraFocusPositionInPreview((params["positionX"] as Number).toFloat(), (params["positionY"] as Number).toFloat())) - } - - override fun setCameraExposurePosition(params: Map, callback: Callback) { - callback.code(engine?.setCameraExposurePosition((params["positionXinView"] as Number).toFloat(), (params["positionYinView"] as Number).toFloat())) - } - - override fun enableFaceDetection(params: Map, callback: Callback) { - callback.code(engine?.enableFaceDetection(params["enable"] as Boolean)) - } - - override fun setCameraTorchOn(params: Map, callback: Callback) { - callback.code(engine?.setCameraTorchOn(params["isOn"] as Boolean)) - } - - override fun setCameraAutoFocusFaceModeEnabled(params: Map, callback: Callback) { - callback.code(engine?.setCameraAutoFocusFaceModeEnabled(params["enabled"] as Boolean)) - } - - override fun setCameraCapturerConfiguration(params: Map, callback: Callback) { - callback.code(engine?.setCameraCapturerConfiguration(mapToCameraCapturerConfiguration(params["config"] as Map<*, *>))) - } - - override fun createDataStream(params: Map, callback: Callback) { - (params["config"] as? Map<*, *>)?.let { config -> - callback.code(engine?.createDataStream(mapToDataStreamConfig(config))) { it } - return@createDataStream - } - callback.code(engine?.createDataStream(params["reliable"] as Boolean, params["ordered"] as Boolean)) { it } - } - - override fun sendStreamMessage(params: Map, callback: Callback) { - callback.code(engine?.sendStreamMessage((params["streamId"] as Number).toInt(), (params["message"] as String).toByteArray())) - } -} diff --git a/android/src/main/java/io/agora/rtc/base/RtcEngineEvent.kt b/android/src/main/java/io/agora/rtc/base/RtcEngineEvent.kt deleted file mode 100644 index 8a003e383..000000000 --- a/android/src/main/java/io/agora/rtc/base/RtcEngineEvent.kt +++ /dev/null @@ -1,527 +0,0 @@ -package io.agora.rtc.base - -import android.graphics.Rect -import androidx.annotation.IntRange -import io.agora.rtc.IRtcEngineEventHandler -import io.agora.rtc.models.UserInfo - -class RtcEngineEvents { - companion object { - const val Warning = "Warning" - const val Error = "Error" - const val ApiCallExecuted = "ApiCallExecuted" - const val JoinChannelSuccess = "JoinChannelSuccess" - const val RejoinChannelSuccess = "RejoinChannelSuccess" - const val LeaveChannel = "LeaveChannel" - const val LocalUserRegistered = "LocalUserRegistered" - const val UserInfoUpdated = "UserInfoUpdated" - const val ClientRoleChanged = "ClientRoleChanged" - const val UserJoined = "UserJoined" - const val UserOffline = "UserOffline" - const val ConnectionStateChanged = "ConnectionStateChanged" - const val NetworkTypeChanged = "NetworkTypeChanged" - const val ConnectionLost = "ConnectionLost" - const val TokenPrivilegeWillExpire = "TokenPrivilegeWillExpire" - const val RequestToken = "RequestToken" - const val AudioVolumeIndication = "AudioVolumeIndication" - const val ActiveSpeaker = "ActiveSpeaker" - const val FirstLocalAudioFrame = "FirstLocalAudioFrame" - const val FirstLocalVideoFrame = "FirstLocalVideoFrame" - const val UserMuteVideo = "UserMuteVideo" - const val VideoSizeChanged = "VideoSizeChanged" - const val RemoteVideoStateChanged = "RemoteVideoStateChanged" - const val LocalVideoStateChanged = "LocalVideoStateChanged" - const val RemoteAudioStateChanged = "RemoteAudioStateChanged" - const val LocalAudioStateChanged = "LocalAudioStateChanged" - const val LocalPublishFallbackToAudioOnly = "LocalPublishFallbackToAudioOnly" - const val RemoteSubscribeFallbackToAudioOnly = "RemoteSubscribeFallbackToAudioOnly" - const val AudioRouteChanged = "AudioRouteChanged" - const val CameraFocusAreaChanged = "CameraFocusAreaChanged" - const val CameraExposureAreaChanged = "CameraExposureAreaChanged" - const val FacePositionChanged = "FacePositionChanged" - const val RtcStats = "RtcStats" - const val LastmileQuality = "LastmileQuality" - const val NetworkQuality = "NetworkQuality" - const val LastmileProbeResult = "LastmileProbeResult" - const val LocalVideoStats = "LocalVideoStats" - const val LocalAudioStats = "LocalAudioStats" - const val RemoteVideoStats = "RemoteVideoStats" - const val RemoteAudioStats = "RemoteAudioStats" - const val AudioMixingFinished = "AudioMixingFinished" - const val AudioMixingStateChanged = "AudioMixingStateChanged" - const val AudioEffectFinished = "AudioEffectFinished" - const val RtmpStreamingStateChanged = "RtmpStreamingStateChanged" - const val TranscodingUpdated = "TranscodingUpdated" - const val StreamInjectedStatus = "StreamInjectedStatus" - const val StreamMessage = "StreamMessage" - const val StreamMessageError = "StreamMessageError" - const val MediaEngineLoadSuccess = "MediaEngineLoadSuccess" - const val MediaEngineStartCallSuccess = "MediaEngineStartCallSuccess" - const val ChannelMediaRelayStateChanged = "ChannelMediaRelayStateChanged" - const val ChannelMediaRelayEvent = "ChannelMediaRelayEvent" - const val FirstRemoteVideoFrame = "FirstRemoteVideoFrame" - const val FirstRemoteAudioFrame = "FirstRemoteAudioFrame" - const val FirstRemoteAudioDecoded = "FirstRemoteAudioDecoded" - const val UserMuteAudio = "UserMuteAudio" - const val StreamPublished = "StreamPublished" - const val StreamUnpublished = "StreamUnpublished" - const val RemoteAudioTransportStats = "RemoteAudioTransportStats" - const val RemoteVideoTransportStats = "RemoteVideoTransportStats" - const val UserEnableVideo = "UserEnableVideo" - const val UserEnableLocalVideo = "UserEnableLocalVideo" - const val FirstRemoteVideoDecoded = "FirstRemoteVideoDecoded" - const val MicrophoneEnabled = "MicrophoneEnabled" - const val ConnectionInterrupted = "ConnectionInterrupted" - const val ConnectionBanned = "ConnectionBanned" - const val AudioQuality = "AudioQuality" - const val CameraReady = "CameraReady" - const val VideoStopped = "VideoStopped" - const val MetadataReceived = "MetadataReceived" - const val FirstLocalAudioFramePublished = "FirstLocalAudioFramePublished" - const val FirstLocalVideoFramePublished = "FirstLocalVideoFramePublished" - const val AudioPublishStateChanged = "AudioPublishStateChanged" - const val VideoPublishStateChanged = "VideoPublishStateChanged" - const val AudioSubscribeStateChanged = "AudioSubscribeStateChanged" - const val VideoSubscribeStateChanged = "VideoSubscribeStateChanged" - const val RtmpStreamingEvent = "RtmpStreamingEvent" - const val UserSuperResolutionEnabled = "UserSuperResolutionEnabled" - const val UploadLogResult = "UploadLogResult" - - fun toMap(): Map { - return hashMapOf( - "Warning" to Warning, - "Error" to Error, - "ApiCallExecuted" to ApiCallExecuted, - "JoinChannelSuccess" to JoinChannelSuccess, - "RejoinChannelSuccess" to RejoinChannelSuccess, - "LeaveChannel" to LeaveChannel, - "LocalUserRegistered" to LocalUserRegistered, - "UserInfoUpdated" to UserInfoUpdated, - "ClientRoleChanged" to ClientRoleChanged, - "UserJoined" to UserJoined, - "UserOffline" to UserOffline, - "ConnectionStateChanged" to ConnectionStateChanged, - "NetworkTypeChanged" to NetworkTypeChanged, - "ConnectionLost" to ConnectionLost, - "TokenPrivilegeWillExpire" to TokenPrivilegeWillExpire, - "RequestToken" to RequestToken, - "AudioVolumeIndication" to AudioVolumeIndication, - "ActiveSpeaker" to ActiveSpeaker, - "FirstLocalAudioFrame" to FirstLocalAudioFrame, - "FirstLocalVideoFrame" to FirstLocalVideoFrame, - "UserMuteVideo" to UserMuteVideo, - "VideoSizeChanged" to VideoSizeChanged, - "RemoteVideoStateChanged" to RemoteVideoStateChanged, - "LocalVideoStateChanged" to LocalVideoStateChanged, - "RemoteAudioStateChanged" to RemoteAudioStateChanged, - "LocalAudioStateChanged" to LocalAudioStateChanged, - "LocalPublishFallbackToAudioOnly" to LocalPublishFallbackToAudioOnly, - "RemoteSubscribeFallbackToAudioOnly" to RemoteSubscribeFallbackToAudioOnly, - "AudioRouteChanged" to AudioRouteChanged, - "CameraFocusAreaChanged" to CameraFocusAreaChanged, - "CameraExposureAreaChanged" to CameraExposureAreaChanged, - "FacePositionChanged" to FacePositionChanged, - "RtcStats" to RtcStats, - "LastmileQuality" to LastmileQuality, - "NetworkQuality" to NetworkQuality, - "LastmileProbeResult" to LastmileProbeResult, - "LocalVideoStats" to LocalVideoStats, - "LocalAudioStats" to LocalAudioStats, - "RemoteVideoStats" to RemoteVideoStats, - "RemoteAudioStats" to RemoteAudioStats, - "AudioMixingFinished" to AudioMixingFinished, - "AudioMixingStateChanged" to AudioMixingStateChanged, - "AudioEffectFinished" to AudioEffectFinished, - "RtmpStreamingStateChanged" to RtmpStreamingStateChanged, - "TranscodingUpdated" to TranscodingUpdated, - "StreamInjectedStatus" to StreamInjectedStatus, - "StreamMessage" to StreamMessage, - "StreamMessageError" to StreamMessageError, - "MediaEngineLoadSuccess" to MediaEngineLoadSuccess, - "MediaEngineStartCallSuccess" to MediaEngineStartCallSuccess, - "ChannelMediaRelayStateChanged" to ChannelMediaRelayStateChanged, - "ChannelMediaRelayEvent" to ChannelMediaRelayEvent, - "FirstRemoteVideoFrame" to FirstRemoteVideoFrame, - "FirstRemoteAudioFrame" to FirstRemoteAudioFrame, - "FirstRemoteAudioDecoded" to FirstRemoteAudioDecoded, - "UserMuteAudio" to UserMuteAudio, - "StreamPublished" to StreamPublished, - "StreamUnpublished" to StreamUnpublished, - "RemoteAudioTransportStats" to RemoteAudioTransportStats, - "RemoteVideoTransportStats" to RemoteVideoTransportStats, - "UserEnableVideo" to UserEnableVideo, - "UserEnableLocalVideo" to UserEnableLocalVideo, - "FirstRemoteVideoDecoded" to FirstRemoteVideoDecoded, - "MicrophoneEnabled" to MicrophoneEnabled, - "ConnectionInterrupted" to ConnectionInterrupted, - "ConnectionBanned" to ConnectionBanned, - "AudioQuality" to AudioQuality, - "CameraReady" to CameraReady, - "VideoStopped" to VideoStopped, - "MetadataReceived" to MetadataReceived, - "FirstLocalAudioFramePublished" to FirstLocalAudioFramePublished, - "FirstLocalVideoFramePublished" to FirstLocalVideoFramePublished, - "AudioPublishStateChanged" to AudioPublishStateChanged, - "VideoPublishStateChanged" to VideoPublishStateChanged, - "AudioSubscribeStateChanged" to AudioSubscribeStateChanged, - "VideoSubscribeStateChanged" to VideoSubscribeStateChanged, - "RtmpStreamingEvent" to RtmpStreamingEvent, - "UserSuperResolutionEnabled" to UserSuperResolutionEnabled, - "UploadLogResult" to UploadLogResult - ) - } - } -} - -class RtcEngineEventHandler( - private val emitter: (methodName: String, data: Map?) -> Unit -) : IRtcEngineEventHandler() { - companion object { - const val PREFIX = "io.agora.rtc." - } - - private fun callback(methodName: String, vararg data: Any?) { - emitter(methodName, hashMapOf("data" to data.toList())) - } - - override fun onWarning(@Annotations.AgoraWarningCode warn: Int) { - callback(RtcEngineEvents.Warning, warn) - } - - override fun onError(@Annotations.AgoraErrorCode err: Int) { - callback(RtcEngineEvents.Error, err) - } - - override fun onApiCallExecuted(@Annotations.AgoraErrorCode error: Int, api: String?, result: String?) { - callback(RtcEngineEvents.ApiCallExecuted, error, api, result) - } - - override fun onJoinChannelSuccess(channel: String?, uid: Int, elapsed: Int) { - callback(RtcEngineEvents.JoinChannelSuccess, channel, uid, elapsed) - } - - override fun onRejoinChannelSuccess(channel: String?, uid: Int, elapsed: Int) { - callback(RtcEngineEvents.RejoinChannelSuccess, channel, uid, elapsed) - } - - override fun onLeaveChannel(stats: RtcStats?) { - callback(RtcEngineEvents.LeaveChannel, stats?.toMap()) - } - - override fun onLocalUserRegistered(uid: Int, userAccount: String?) { - callback(RtcEngineEvents.LocalUserRegistered, uid, userAccount) - } - - override fun onUserInfoUpdated(uid: Int, userInfo: UserInfo?) { - callback(RtcEngineEvents.UserInfoUpdated, uid, userInfo?.toMap()) - } - - override fun onClientRoleChanged(@Annotations.AgoraClientRole oldRole: Int, @Annotations.AgoraClientRole newRole: Int) { - callback(RtcEngineEvents.ClientRoleChanged, oldRole, newRole) - } - - override fun onUserJoined(uid: Int, elapsed: Int) { - callback(RtcEngineEvents.UserJoined, uid, elapsed) - } - - override fun onUserOffline(uid: Int, @Annotations.AgoraUserOfflineReason reason: Int) { - callback(RtcEngineEvents.UserOffline, uid, reason) - } - - override fun onConnectionStateChanged(@Annotations.AgoraConnectionStateType state: Int, @Annotations.AgoraConnectionChangedReason reason: Int) { - callback(RtcEngineEvents.ConnectionStateChanged, state, reason) - } - - override fun onNetworkTypeChanged(@Annotations.AgoraNetworkType type: Int) { - callback(RtcEngineEvents.NetworkTypeChanged, type) - } - - override fun onConnectionLost() { - callback(RtcEngineEvents.ConnectionLost) - } - - override fun onTokenPrivilegeWillExpire(token: String?) { - callback(RtcEngineEvents.TokenPrivilegeWillExpire, token) - } - - override fun onRequestToken() { - callback(RtcEngineEvents.RequestToken) - } - - override fun onAudioVolumeIndication(speakers: Array?, @IntRange(from = 0, to = 255) totalVolume: Int) { - callback(RtcEngineEvents.AudioVolumeIndication, speakers?.toMapList(), totalVolume) - } - - override fun onActiveSpeaker(uid: Int) { - callback(RtcEngineEvents.ActiveSpeaker, uid) - } - - override fun onFirstLocalAudioFrame(elapsed: Int) { - callback(RtcEngineEvents.FirstLocalAudioFrame, elapsed) - } - - override fun onFirstLocalVideoFrame(width: Int, height: Int, elapsed: Int) { - callback(RtcEngineEvents.FirstLocalVideoFrame, width, height, elapsed) - } - - @Deprecated("", ReplaceWith("onRemoteVideoStateChanged")) - override fun onUserMuteVideo(uid: Int, muted: Boolean) { - callback(RtcEngineEvents.UserMuteVideo, uid, muted) - } - - override fun onVideoSizeChanged(uid: Int, width: Int, height: Int, @IntRange(from = 0, to = 360) rotation: Int) { - callback(RtcEngineEvents.VideoSizeChanged, uid, width, height, rotation) - } - - override fun onRemoteVideoStateChanged(uid: Int, @Annotations.AgoraVideoRemoteState state: Int, @Annotations.AgoraVideoRemoteStateReason reason: Int, elapsed: Int) { - callback(RtcEngineEvents.RemoteVideoStateChanged, uid, state, reason, elapsed) - } - - override fun onLocalVideoStateChanged(@Annotations.AgoraLocalVideoStreamState localVideoState: Int, @Annotations.AgoraLocalVideoStreamError error: Int) { - callback(RtcEngineEvents.LocalVideoStateChanged, localVideoState, error) - } - - override fun onRemoteAudioStateChanged(uid: Int, @Annotations.AgoraAudioRemoteState state: Int, @Annotations.AgoraAudioRemoteStateReason reason: Int, elapsed: Int) { - callback(RtcEngineEvents.RemoteAudioStateChanged, uid, state, reason, elapsed) - } - - override fun onLocalAudioStateChanged(@Annotations.AgoraAudioLocalState state: Int, @Annotations.AgoraAudioLocalError error: Int) { - callback(RtcEngineEvents.LocalAudioStateChanged, state, error) - } - - override fun onLocalPublishFallbackToAudioOnly(isFallbackOrRecover: Boolean) { - callback(RtcEngineEvents.LocalPublishFallbackToAudioOnly, isFallbackOrRecover) - } - - override fun onRemoteSubscribeFallbackToAudioOnly(uid: Int, isFallbackOrRecover: Boolean) { - callback(RtcEngineEvents.RemoteSubscribeFallbackToAudioOnly, uid, isFallbackOrRecover) - } - - override fun onAudioRouteChanged(@Annotations.AgoraAudioOutputRouting routing: Int) { - callback(RtcEngineEvents.AudioRouteChanged, routing) - } - - override fun onCameraFocusAreaChanged(rect: Rect?) { - callback(RtcEngineEvents.CameraFocusAreaChanged, rect?.toMap()) - } - - override fun onCameraExposureAreaChanged(rect: Rect?) { - callback(RtcEngineEvents.CameraExposureAreaChanged, rect?.toMap()) - } - - override fun onFacePositionChanged(imageWidth: Int, imageHeight: Int, faces: Array?) { - callback(RtcEngineEvents.FacePositionChanged, imageWidth, imageHeight, faces?.toMapList()) - } - - override fun onRtcStats(stats: RtcStats?) { - callback(RtcEngineEvents.RtcStats, stats?.toMap()) - } - - override fun onLastmileQuality(@Annotations.AgoraNetworkQuality quality: Int) { - callback(RtcEngineEvents.LastmileQuality, quality) - } - - override fun onNetworkQuality(uid: Int, @Annotations.AgoraNetworkQuality txQuality: Int, @Annotations.AgoraNetworkQuality rxQuality: Int) { - callback(RtcEngineEvents.NetworkQuality, uid, txQuality, rxQuality) - } - - override fun onLastmileProbeResult(result: LastmileProbeResult?) { - callback(RtcEngineEvents.LastmileProbeResult, result?.toMap()) - } - - @Deprecated("", ReplaceWith("onLocalVideoStats")) - override fun onLocalVideoStat(sentBitrate: Int, sentFrameRate: Int) { - // TODO Not in iOS - } - - override fun onLocalVideoStats(stats: LocalVideoStats?) { - callback(RtcEngineEvents.LocalVideoStats, stats?.toMap()) - } - - override fun onLocalAudioStats(stats: LocalAudioStats?) { - callback(RtcEngineEvents.LocalAudioStats, stats?.toMap()) - } - - @Deprecated("", ReplaceWith("onRemoteVideoStats")) - override fun onRemoteVideoStat(uid: Int, delay: Int, receivedBitrate: Int, receivedFrameRate: Int) { - // TODO Not in iOS - } - - override fun onRemoteVideoStats(stats: RemoteVideoStats?) { - callback(RtcEngineEvents.RemoteVideoStats, stats?.toMap()) - } - - override fun onRemoteAudioStats(stats: RemoteAudioStats?) { - callback(RtcEngineEvents.RemoteAudioStats, stats?.toMap()) - } - - @Deprecated("", ReplaceWith("onAudioMixingStateChanged")) - override fun onAudioMixingFinished() { - callback(RtcEngineEvents.AudioMixingFinished) - } - - override fun onAudioMixingStateChanged(@Annotations.AgoraAudioMixingStateCode state: Int, @Annotations.AgoraAudioMixingErrorCode errorCode: Int) { - callback(RtcEngineEvents.AudioMixingStateChanged, state, errorCode) - } - - override fun onAudioEffectFinished(soundId: Int) { - callback(RtcEngineEvents.AudioEffectFinished, soundId) - } - - override fun onRtmpStreamingStateChanged(url: String?, @Annotations.AgoraRtmpStreamingState state: Int, @Annotations.AgoraRtmpStreamingErrorCode errCode: Int) { - callback(RtcEngineEvents.RtmpStreamingStateChanged, url, state, errCode) - } - - override fun onTranscodingUpdated() { - callback(RtcEngineEvents.TranscodingUpdated) - } - - override fun onStreamInjectedStatus(url: String?, uid: Int, @Annotations.AgoraInjectStreamStatus status: Int) { - callback(RtcEngineEvents.StreamInjectedStatus, url, uid, status) - } - - override fun onStreamMessage(uid: Int, streamId: Int, data: ByteArray?) { - callback(RtcEngineEvents.StreamMessage, uid, streamId, data?.let { String(it, Charsets.UTF_8) }) - } - - override fun onStreamMessageError(uid: Int, streamId: Int, @Annotations.AgoraErrorCode error: Int, missed: Int, cached: Int) { - callback(RtcEngineEvents.StreamMessageError, uid, streamId, error, missed, cached) - } - - override fun onMediaEngineLoadSuccess() { - callback(RtcEngineEvents.MediaEngineLoadSuccess) - } - - override fun onMediaEngineStartCallSuccess() { - callback(RtcEngineEvents.MediaEngineStartCallSuccess) - } - - override fun onChannelMediaRelayStateChanged(@Annotations.AgoraChannelMediaRelayState state: Int, @Annotations.AgoraChannelMediaRelayError code: Int) { - callback(RtcEngineEvents.ChannelMediaRelayStateChanged, state, code) - } - - override fun onChannelMediaRelayEvent(@Annotations.AgoraChannelMediaRelayEvent code: Int) { - callback(RtcEngineEvents.ChannelMediaRelayEvent, code) - } - - @Deprecated("", ReplaceWith("onRemoteVideoStateChanged")) - override fun onFirstRemoteVideoFrame(uid: Int, width: Int, height: Int, elapsed: Int) { - callback(RtcEngineEvents.FirstRemoteVideoFrame, uid, width, height, elapsed) - } - - @Deprecated("", ReplaceWith("onRemoteAudioStateChanged")) - override fun onFirstRemoteAudioFrame(uid: Int, elapsed: Int) { - callback(RtcEngineEvents.FirstRemoteAudioFrame, uid, elapsed) - } - - @Deprecated("", ReplaceWith("onRemoteAudioStateChanged")) - override fun onFirstRemoteAudioDecoded(uid: Int, elapsed: Int) { - callback(RtcEngineEvents.FirstRemoteAudioDecoded, uid, elapsed) - } - - @Deprecated("", ReplaceWith("onRemoteAudioStateChanged")) - override fun onUserMuteAudio(uid: Int, muted: Boolean) { - callback(RtcEngineEvents.UserMuteAudio, uid, muted) - } - - @Deprecated("", ReplaceWith("onRtmpStreamingStateChanged")) - override fun onStreamPublished(url: String?, @Annotations.AgoraErrorCode error: Int) { - callback(RtcEngineEvents.StreamPublished, url, error) - } - - @Deprecated("", ReplaceWith("onRtmpStreamingStateChanged")) - override fun onStreamUnpublished(url: String?) { - callback(RtcEngineEvents.StreamUnpublished, url) - } - - @Deprecated("", ReplaceWith("onRemoteAudioStats")) - override fun onRemoteAudioTransportStats(uid: Int, delay: Int, lost: Int, rxKBitRate: Int) { - callback(RtcEngineEvents.RemoteAudioTransportStats, uid, delay, lost, rxKBitRate) - } - - @Deprecated("", ReplaceWith("onRemoteVideoStats")) - override fun onRemoteVideoTransportStats(uid: Int, delay: Int, lost: Int, rxKBitRate: Int) { - callback(RtcEngineEvents.RemoteVideoTransportStats, uid, delay, lost, rxKBitRate) - } - - @Deprecated("", ReplaceWith("onRemoteVideoStateChanged")) - override fun onUserEnableVideo(uid: Int, enabled: Boolean) { - callback(RtcEngineEvents.UserEnableVideo, uid, enabled) - } - - @Deprecated("", ReplaceWith("onRemoteVideoStateChanged")) - override fun onUserEnableLocalVideo(uid: Int, enabled: Boolean) { - callback(RtcEngineEvents.UserEnableLocalVideo, uid, enabled) - } - - @Deprecated("", ReplaceWith("onRemoteVideoStateChanged")) - override fun onFirstRemoteVideoDecoded(uid: Int, width: Int, height: Int, elapsed: Int) { - callback(RtcEngineEvents.FirstRemoteVideoDecoded, uid, width, height, elapsed) - } - - @Deprecated("", ReplaceWith("onLocalAudioStateChanged")) - override fun onMicrophoneEnabled(enabled: Boolean) { - callback(RtcEngineEvents.MicrophoneEnabled, enabled) - } - - @Deprecated("", ReplaceWith("onConnectionStateChanged")) - override fun onConnectionInterrupted() { - callback(RtcEngineEvents.ConnectionInterrupted) - } - - @Deprecated("", ReplaceWith("onConnectionStateChanged")) - override fun onConnectionBanned() { - callback(RtcEngineEvents.ConnectionBanned) - } - - @Deprecated("", ReplaceWith("onRemoteAudioStats")) - override fun onAudioQuality(uid: Int, @Annotations.AgoraNetworkQuality quality: Int, delay: Short, lost: Short) { - callback(RtcEngineEvents.AudioQuality, uid, quality, delay, lost) - } - - @Deprecated("", ReplaceWith("onLocalVideoStateChanged")) - override fun onCameraReady() { - callback(RtcEngineEvents.CameraReady) - } - - @Deprecated("", ReplaceWith("onLocalVideoStateChanged")) - override fun onVideoStopped() { - callback(RtcEngineEvents.VideoStopped) - } - - override fun onFirstLocalAudioFramePublished(elapsed: Int) { - callback(RtcEngineEvents.FirstLocalAudioFramePublished, elapsed) - } - - override fun onFirstLocalVideoFramePublished(elapsed: Int) { - callback(RtcEngineEvents.FirstLocalVideoFramePublished, elapsed) - } - - override fun onAudioPublishStateChanged(channel: String?, @Annotations.AgoraStreamPublishState oldState: Int, @Annotations.AgoraStreamPublishState newState: Int, elapseSinceLastState: Int) { - callback(RtcEngineEvents.AudioPublishStateChanged, channel, oldState, newState, elapseSinceLastState) - } - - override fun onVideoPublishStateChanged(channel: String?, @Annotations.AgoraStreamPublishState oldState: Int, @Annotations.AgoraStreamPublishState newState: Int, elapseSinceLastState: Int) { - callback(RtcEngineEvents.VideoPublishStateChanged, channel, oldState, newState, elapseSinceLastState) - } - - override fun onAudioSubscribeStateChanged(channel: String?, uid: Int, @Annotations.AgoraStreamSubscribeState oldState: Int, @Annotations.AgoraStreamSubscribeState newState: Int, elapseSinceLastState: Int) { - callback(RtcEngineEvents.AudioSubscribeStateChanged, channel, uid, oldState, newState, elapseSinceLastState) - } - - override fun onVideoSubscribeStateChanged(channel: String?, uid: Int, @Annotations.AgoraStreamSubscribeState oldState: Int, @Annotations.AgoraStreamSubscribeState newState: Int, elapseSinceLastState: Int) { - callback(RtcEngineEvents.VideoSubscribeStateChanged, channel, uid, oldState, newState, elapseSinceLastState) - } - - override fun onRtmpStreamingEvent(url: String?, @Annotations.AgoraRtmpStreamingEvent error: Int) { - callback(RtcEngineEvents.RtmpStreamingEvent, url, error) - } - - override fun onUserSuperResolutionEnabled(uid: Int, enabled: Boolean, @Annotations.AgoraSuperResolutionStateReason reason: Int) { - callback(RtcEngineEvents.UserSuperResolutionEnabled, uid, enabled, reason) - } - - override fun onUploadLogResult(requestId: String?, success: Boolean, @Annotations.AgoraUploadErrorReason reason: Int) { - callback(RtcEngineEvents.UploadLogResult, requestId, success, reason) - } -} diff --git a/android/src/main/java/io/agora/rtc/base/RtcSurfaceView.kt b/android/src/main/java/io/agora/rtc/base/RtcSurfaceView.kt deleted file mode 100644 index 536f7ddaf..000000000 --- a/android/src/main/java/io/agora/rtc/base/RtcSurfaceView.kt +++ /dev/null @@ -1,111 +0,0 @@ -package io.agora.rtc.base - -import android.content.Context -import android.view.SurfaceView -import android.widget.FrameLayout -import io.agora.rtc.RtcChannel -import io.agora.rtc.RtcEngine -import io.agora.rtc.video.VideoCanvas -import java.lang.ref.WeakReference - -class RtcSurfaceView( - context: Context -) : FrameLayout(context) { - private var surface: SurfaceView - private var canvas: VideoCanvas - private var isMediaOverlay = false - private var onTop = false - private var channel: WeakReference? = null - - init { - try { - surface = RtcEngine.CreateRendererView(context) - } catch (e: UnsatisfiedLinkError) { - throw RuntimeException("Please init RtcEngine first!") - } - canvas = VideoCanvas(surface) - addView(surface) - } - - fun setZOrderMediaOverlay(isMediaOverlay: Boolean) { - this.isMediaOverlay = isMediaOverlay - try { - removeView(surface) - surface.setZOrderMediaOverlay(isMediaOverlay) - addView(surface) - } catch (e: Exception) { - e.printStackTrace() - } - } - - fun setZOrderOnTop(onTop: Boolean) { - this.onTop = onTop - try { - removeView(surface) - surface.setZOrderOnTop(onTop) - addView(surface) - } catch (e: Exception) { - e.printStackTrace() - } - } - - fun setData(engine: RtcEngine, channel: RtcChannel?, uid: Int) { - this.channel = if (channel != null) WeakReference(channel) else null - canvas.channelId = this.channel?.get()?.channelId() - canvas.uid = uid - setupVideoCanvas(engine) - } - - fun resetVideoCanvas(engine: RtcEngine) { - val canvas = VideoCanvas(null, canvas.renderMode, canvas.channelId, canvas.uid, canvas.mirrorMode) - if (canvas.uid == 0) { - engine.setupLocalVideo(canvas) - } else { - engine.setupRemoteVideo(canvas) - } - } - - private fun setupVideoCanvas(engine: RtcEngine) { - removeAllViews() - surface = RtcEngine.CreateRendererView(context.applicationContext) - surface.setZOrderMediaOverlay(isMediaOverlay) - surface.setZOrderOnTop(onTop) - addView(surface) - surface.layout(0, 0, width, height) - canvas.view = surface - if (canvas.uid == 0) { - engine.setupLocalVideo(canvas) - } else { - engine.setupRemoteVideo(canvas) - } - } - - fun setRenderMode(engine: RtcEngine, @Annotations.AgoraVideoRenderMode renderMode: Int) { - canvas.renderMode = renderMode - setupRenderMode(engine) - } - - fun setMirrorMode(engine: RtcEngine, @Annotations.AgoraVideoMirrorMode mirrorMode: Int) { - canvas.mirrorMode = mirrorMode - setupRenderMode(engine) - } - - private fun setupRenderMode(engine: RtcEngine) { - if (canvas.uid == 0) { - engine.setLocalRenderMode(canvas.renderMode, canvas.mirrorMode) - } else { - channel?.get()?.let { - it.setRemoteRenderMode(canvas.uid, canvas.renderMode, canvas.mirrorMode) - return@setupRenderMode - } - engine.setRemoteRenderMode(canvas.uid, canvas.renderMode, canvas.mirrorMode) - } - } - - override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { - val width: Int = MeasureSpec.getSize(widthMeasureSpec) - val height: Int = MeasureSpec.getSize(heightMeasureSpec) - surface.layout(0, 0, width, height) - super.onMeasure(widthMeasureSpec, heightMeasureSpec) - } -} diff --git a/android/src/main/java/io/agora/rtc/base/RtcTextureView.kt b/android/src/main/java/io/agora/rtc/base/RtcTextureView.kt deleted file mode 100644 index 2ebecae67..000000000 --- a/android/src/main/java/io/agora/rtc/base/RtcTextureView.kt +++ /dev/null @@ -1,85 +0,0 @@ -package io.agora.rtc.base - -import android.content.Context -import android.view.TextureView -import android.widget.FrameLayout -import io.agora.rtc.RtcChannel -import io.agora.rtc.RtcEngine -import io.agora.rtc.video.VideoCanvas -import java.lang.ref.WeakReference - -class RtcTextureView( - context: Context -) : FrameLayout(context) { - private var texture: TextureView - private var canvas: VideoCanvas - private var channel: WeakReference? = null - - init { - try { - texture = RtcEngine.CreateTextureView(context) - } catch (e: UnsatisfiedLinkError) { - throw RuntimeException("Please init RtcEngine first!") - } - canvas = VideoCanvas(texture) - addView(texture) - } - - fun setData(engine: RtcEngine, channel: RtcChannel?, uid: Int) { - this.channel = if (channel != null) WeakReference(channel) else null - canvas.channelId = this.channel?.get()?.channelId() - canvas.uid = uid - setupVideoCanvas(engine) - } - - fun resetVideoCanvas(engine: RtcEngine) { - val canvas = VideoCanvas(null, canvas.renderMode, canvas.channelId, canvas.uid, canvas.mirrorMode) - if (canvas.uid == 0) { - engine.setupLocalVideo(canvas) - } else { - engine.setupRemoteVideo(canvas) - } - } - - private fun setupVideoCanvas(engine: RtcEngine) { - removeAllViews() - texture = RtcEngine.CreateTextureView(context.applicationContext) - addView(texture) - texture.layout(0, 0, width, height) - canvas.view = texture - if (canvas.uid == 0) { - engine.setupLocalVideo(canvas) - } else { - engine.setupRemoteVideo(canvas) - } - } - - fun setRenderMode(engine: RtcEngine, @Annotations.AgoraVideoRenderMode renderMode: Int) { - canvas.renderMode = renderMode - setupRenderMode(engine) - } - - fun setMirrorMode(engine: RtcEngine, @Annotations.AgoraVideoMirrorMode mirrorMode: Int) { - canvas.mirrorMode = mirrorMode - setupRenderMode(engine) - } - - private fun setupRenderMode(engine: RtcEngine) { - if (canvas.uid == 0) { - engine.setLocalRenderMode(canvas.renderMode, canvas.mirrorMode) - } else { - channel?.get()?.let { - it.setRemoteRenderMode(canvas.uid, canvas.renderMode, canvas.mirrorMode) - return@setupRenderMode - } - engine.setRemoteRenderMode(canvas.uid, canvas.renderMode, canvas.mirrorMode) - } - } - - override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { - val width: Int = MeasureSpec.getSize(widthMeasureSpec) - val height: Int = MeasureSpec.getSize(heightMeasureSpec) - texture.layout(0, 0, width, height) - super.onMeasure(widthMeasureSpec, heightMeasureSpec) - } -} diff --git a/android/src/main/java/io/agora/rtc/react/PromiseCallback.kt b/android/src/main/java/io/agora/rtc/react/PromiseCallback.kt deleted file mode 100644 index 17360577b..000000000 --- a/android/src/main/java/io/agora/rtc/react/PromiseCallback.kt +++ /dev/null @@ -1,32 +0,0 @@ -package io.agora.rtc.react - -import com.facebook.react.bridge.Arguments -import com.facebook.react.bridge.Promise -import io.agora.rtc.base.Callback - -class PromiseCallback( - private val promise: Promise? -) : Callback() { - override fun success(data: Any?) { - when (data) { - null, is Boolean, is Int, is String -> promise?.resolve(data) - is Number -> promise?.resolve(data.toDouble()) - is Array<*> -> promise?.resolve(Arguments.makeNativeArray(arrayOf(data))) - is List<*> -> promise?.resolve(Arguments.makeNativeArray(data)) - is Map<*, *> -> { - val map = mutableMapOf() - data.forEach { - if (it.key is String) { - map[it.key as String] = it.value - } - } - promise?.resolve(Arguments.makeNativeMap(map)) - } - else -> promise?.reject(IllegalArgumentException("Could not convert " + data.javaClass)) - } - } - - override fun failure(code: String, message: String) { - promise?.reject(code, message) - } -} diff --git a/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcChannelModule.kt b/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcChannelModule.kt deleted file mode 100644 index 4141ed832..000000000 --- a/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcChannelModule.kt +++ /dev/null @@ -1,71 +0,0 @@ -package io.agora.rtc.react - -import com.facebook.react.bridge.* -import com.facebook.react.module.annotations.ReactModule -import com.facebook.react.modules.core.DeviceEventManagerModule -import io.agora.rtc.RtcChannel -import io.agora.rtc.RtcEngine -import io.agora.rtc.base.RtcChannelEventHandler -import io.agora.rtc.base.RtcChannelManager -import io.agora.rtc.react.RCTAgoraRtcChannelModule.Companion.REACT_CLASS -import kotlin.reflect.full.declaredMemberFunctions -import kotlin.reflect.jvm.javaMethod - -@ReactModule(name = REACT_CLASS) -class RCTAgoraRtcChannelModule( - reactContext: ReactApplicationContext -) : ReactContextBaseJavaModule(reactContext) { - companion object { - const val REACT_CLASS = "RCTAgoraRtcChannelModule" - } - - private val manager = RtcChannelManager { methodName, data -> emit(methodName, data) } - - override fun getName(): String { - return REACT_CLASS - } - - override fun getConstants(): MutableMap { - return mutableMapOf( - "prefix" to RtcChannelEventHandler.PREFIX - ) - } - - override fun onCatalystInstanceDestroy() { - super.onCatalystInstanceDestroy() - manager.release() - } - - private fun emit(methodName: String, data: Map?) { - reactApplicationContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java) - .emit("${RtcChannelEventHandler.PREFIX}$methodName", Arguments.makeNativeMap(data)) - } - - private fun engine(): RtcEngine? { - return reactApplicationContext.getNativeModule(RCTAgoraRtcEngineModule::class.java)?.engine() - } - - fun channel(channelId: String): RtcChannel? { - return manager[channelId] - } - - @ReactMethod - fun callMethod(methodName: String, params: ReadableMap?, callback: Promise?) { - manager::class.declaredMemberFunctions.find { it.name == methodName }?.let { function -> - function.javaMethod?.let { method -> - try { - val parameters = mutableListOf() - params?.toHashMap()?.toMutableMap()?.let { - if (methodName == "create") { - it["engine"] = engine() - } - parameters.add(it) - } - method.invoke(manager, *parameters.toTypedArray(), PromiseCallback(callback)) - } catch (e: Exception) { - e.printStackTrace() - } - } - } - } -} diff --git a/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcEngineModule.kt b/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcEngineModule.kt deleted file mode 100644 index 34bb84244..000000000 --- a/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcEngineModule.kt +++ /dev/null @@ -1,66 +0,0 @@ -package io.agora.rtc.react - -import com.facebook.react.bridge.* -import com.facebook.react.module.annotations.ReactModule -import com.facebook.react.modules.core.DeviceEventManagerModule -import io.agora.rtc.RtcEngine -import io.agora.rtc.base.RtcEngineEventHandler -import io.agora.rtc.base.RtcEngineManager -import io.agora.rtc.react.RCTAgoraRtcEngineModule.Companion.REACT_CLASS -import kotlin.reflect.full.declaredMemberFunctions -import kotlin.reflect.jvm.javaMethod - -@ReactModule(name = REACT_CLASS) -class RCTAgoraRtcEngineModule( - reactContext: ReactApplicationContext -) : ReactContextBaseJavaModule(reactContext) { - companion object { - const val REACT_CLASS = "RCTAgoraRtcEngineModule" - } - - private val manager = RtcEngineManager { methodName, data -> emit(methodName, data) } - - override fun getName(): String { - return REACT_CLASS - } - - override fun getConstants(): MutableMap { - return mutableMapOf( - "prefix" to RtcEngineEventHandler.PREFIX - ) - } - - override fun onCatalystInstanceDestroy() { - super.onCatalystInstanceDestroy() - manager.release() - } - - private fun emit(methodName: String, data: Map?) { - reactApplicationContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java) - .emit("${RtcEngineEventHandler.PREFIX}$methodName", Arguments.makeNativeMap(data)) - } - - fun engine(): RtcEngine? { - return manager.engine - } - - @ReactMethod - fun callMethod(methodName: String, params: ReadableMap?, callback: Promise?) { - manager::class.declaredMemberFunctions.find { it.name == methodName }?.let { function -> - function.javaMethod?.let { method -> - try { - val parameters = mutableListOf() - params?.toHashMap()?.toMutableMap()?.let { - if (methodName == "create") { - it["context"] = reactApplicationContext.applicationContext - } - parameters.add(it) - } - method.invoke(manager, *parameters.toTypedArray(), PromiseCallback(callback)) - } catch (e: Exception) { - e.printStackTrace() - } - } - } - } -} diff --git a/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcPackage.kt b/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcPackage.kt deleted file mode 100644 index 66153008e..000000000 --- a/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcPackage.kt +++ /dev/null @@ -1,28 +0,0 @@ -package io.agora.rtc.react - -import com.facebook.react.ReactPackage -import com.facebook.react.bridge.JavaScriptModule -import com.facebook.react.bridge.NativeModule -import com.facebook.react.bridge.ReactApplicationContext -import com.facebook.react.uimanager.ViewManager - -class RCTAgoraRtcPackage : ReactPackage { - override fun createNativeModules(reactContext: ReactApplicationContext): List { - return listOf( - RCTAgoraRtcEngineModule(reactContext), - RCTAgoraRtcChannelModule(reactContext) - ) - } - - // Deprecated in RN 0.47 - fun createJSModules(): List> { - return emptyList() - } - - override fun createViewManagers(reactContext: ReactApplicationContext): List> { - return listOf( - RCTAgoraRtcSurfaceViewManager(), - RCTAgoraRtcTextureViewManager() - ) - } -} diff --git a/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcSurfaceViewManager.kt b/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcSurfaceViewManager.kt deleted file mode 100644 index 42506fbd0..000000000 --- a/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcSurfaceViewManager.kt +++ /dev/null @@ -1,67 +0,0 @@ -package io.agora.rtc.react - -import com.facebook.react.bridge.ReadableMap -import com.facebook.react.uimanager.SimpleViewManager -import com.facebook.react.uimanager.ThemedReactContext -import com.facebook.react.uimanager.annotations.ReactProp -import io.agora.rtc.RtcChannel -import io.agora.rtc.RtcEngine -import io.agora.rtc.base.RtcSurfaceView - -class RCTAgoraRtcSurfaceViewManager : SimpleViewManager() { - companion object { - const val REACT_CLASS = "RCTAgoraRtcSurfaceView" - } - - private var reactContext: ThemedReactContext? = null - - override fun createViewInstance(reactContext: ThemedReactContext): RtcSurfaceView { - this.reactContext = reactContext - return RtcSurfaceView(reactContext) - } - - override fun onDropViewInstance(view: RtcSurfaceView) { - // getEngine()?.let { view.resetVideoCanvas(it) } - super.onDropViewInstance(view) - } - - override fun getName(): String { - return REACT_CLASS - } - - @ReactProp(name = "zOrderMediaOverlay") - fun setZOrderMediaOverlay(view: RtcSurfaceView, isMediaOverlay: Boolean) { - view.setZOrderMediaOverlay(isMediaOverlay) - } - - @ReactProp(name = "zOrderOnTop") - fun setZOrderOnTop(view: RtcSurfaceView, onTop: Boolean) { - view.setZOrderOnTop(onTop) - } - - @ReactProp(name = "data") - fun setData(view: RtcSurfaceView, data: ReadableMap) { - data.toHashMap().let { map -> - val channel = (map["channelId"] as? String)?.let { getChannel(it) } - getEngine()?.let { view.setData(it, channel, (map["uid"] as Number).toInt()) } - } - } - - @ReactProp(name = "renderMode") - fun setRenderMode(view: RtcSurfaceView, renderMode: Int) { - getEngine()?.let { view.setRenderMode(it, renderMode) } - } - - @ReactProp(name = "mirrorMode") - fun setMirrorMode(view: RtcSurfaceView, mirrorMode: Int) { - getEngine()?.let { view.setMirrorMode(it, mirrorMode) } - } - - private fun getEngine(): RtcEngine? { - return reactContext?.getNativeModule(RCTAgoraRtcEngineModule::class.java)?.engine() - } - - private fun getChannel(channelId: String): RtcChannel? { - return reactContext?.getNativeModule(RCTAgoraRtcChannelModule::class.java)?.channel(channelId) - } -} diff --git a/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcTextureViewManager.kt b/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcTextureViewManager.kt deleted file mode 100644 index e3bf7f8a0..000000000 --- a/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcTextureViewManager.kt +++ /dev/null @@ -1,57 +0,0 @@ -package io.agora.rtc.react - -import com.facebook.react.bridge.ReadableMap -import com.facebook.react.uimanager.SimpleViewManager -import com.facebook.react.uimanager.ThemedReactContext -import com.facebook.react.uimanager.annotations.ReactProp -import io.agora.rtc.RtcChannel -import io.agora.rtc.RtcEngine -import io.agora.rtc.base.RtcTextureView - -class RCTAgoraRtcTextureViewManager : SimpleViewManager() { - companion object { - const val REACT_CLASS = "RCTAgoraRtcTextureView" - } - - private var reactContext: ThemedReactContext? = null - - override fun createViewInstance(reactContext: ThemedReactContext): RtcTextureView { - this.reactContext = reactContext - return RtcTextureView(reactContext) - } - - override fun onDropViewInstance(view: RtcTextureView) { - // getEngine()?.let { view.resetVideoRender(it) } - super.onDropViewInstance(view) - } - - override fun getName(): String { - return REACT_CLASS - } - - @ReactProp(name = "data") - fun setData(view: RtcTextureView, data: ReadableMap) { - data.toHashMap().let { map -> - val channel = (map["channelId"] as? String)?.let { getChannel(it) } - getEngine()?.let { view.setData(it, channel, (map["uid"] as Number).toInt()) } - } - } - - @ReactProp(name = "renderMode") - fun setRenderMode(view: RtcTextureView, renderMode: Int) { - getEngine()?.let { view.setRenderMode(it, renderMode) } - } - - @ReactProp(name = "mirrorMode") - fun setMirrorMode(view: RtcTextureView, mirrorMode: Int) { - getEngine()?.let { view.setMirrorMode(it, mirrorMode) } - } - - private fun getEngine(): RtcEngine? { - return reactContext?.getNativeModule(RCTAgoraRtcEngineModule::class.java)?.engine() - } - - private fun getChannel(channelId: String): RtcChannel? { - return reactContext?.getNativeModule(RCTAgoraRtcChannelModule::class.java)?.channel(channelId) - } -} diff --git a/babel.config.js b/babel.config.js deleted file mode 100644 index f842b77fc..000000000 --- a/babel.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - presets: ['module:metro-react-native-babel-preset'], -}; diff --git a/docs/v1/README.md b/docs/v1/README.md deleted file mode 100644 index 5ed218da0..000000000 --- a/docs/v1/README.md +++ /dev/null @@ -1,163 +0,0 @@ -##### 有任何问题欢迎加入QQ群进行反馈 471757030 - -# react-native-agora - -[![npm](https://img.shields.io/npm/v/react-native-agora.svg)](https://www.npmjs.com/package/react-native-agora) -[![npm](https://img.shields.io/npm/dm/react-native-agora.svg)](https://www.npmjs.com/package/react-native-agora) -[![npm](https://img.shields.io/npm/dt/react-native-agora.svg)](https://www.npmjs.com/package/react-native-agora) -[![npm](https://img.shields.io/npm/l/react-native-agora.svg)](https://github.com/syanbo/react-native-agora/blob/master/LICENSE) -[![join chat](https://img.shields.io/badge/gitter-join%20chat-brightgreen.svg)](https://gitter.im/react-native-agora/community) - -## 功能介绍 - -- 支持 iOS Android 声网Agora视频通讯SDK -- 支持 直播 多人视频会议 语音 功能 - -## 安装使用 - -Install with npm: - - `npm install --save react-native-agora` - -Or, install with yarn: - - `yarn add react-native-agora` - -Either way, then link with: - - `react-native link react-native-agora` - -### [iOS Installation](installation.ios.md) -### [iOS 开发环境安装指南](installation.ios.zh.md) - -### [Android Installation](installation.android.md) -### [Android 开发环境安装指南](installation.android.zh.md) - -## Documentation - -[声网API文档](https://docs.agora.io/cn/2.0.2/product/Video/API%20Reference/communication_android_video?platform=Android) - -##### RtcEngine方法 - -| Property | Type | Description | -| -------------------------------- | ---------------------------------------- | ------------------------------------- | -| init | object {appid: 'agora注册的应用id', channelProfile: '频道模式', videoProfile: '视频模式', clientRole: '角色', swapWidthAndHeight: 'bool值'} | 初始化Agora引擎 | -| joinChannel | string channelName (房间名称) number uid (用户设置的uid 传0系统会自动分配) | 加入房间 | -| leaveChannel | | 离开频道 | -| destroy | | 销毁引擎实例 | -| configPublisher | object{} config参数请前往Agora文档查看 | 配置旁路直播推流方法 | -| setLocalRenderMode | number mode (1 2 3) | 设置本地视频显示模式 | -| setRemoteRenderMode | number uid number mode (1 2 3) | 设置远端视频显示模式 | -| enableAudioVolumeIndication | number interval (时间间隔) number smooth(平滑系数。可以设置为 3) | 启用说话者音量提示 | -| startPreview | | 开启视频预览 | -| stopPreview | | 关闭视频预览 | -| switchCamera | | 切换前置/后置摄像头 | -| enableVideo | | 开启视频模式 | -| disableVideo | | 关闭视频 | -| setCameraAutoFocusFaceModeEnabled | | 是否开启人脸对焦功能 | -| setDefaultAudioRouteToSpeakerphone | | 修改默认的语音路由 | -| setCameraTorchOn | | 是否打开闪光灯 | -| setEnableSpeakerphone | bool | 开启扬声器 trun: 音频输出至扬声器 false: 音频输出至听筒 | -| muteLocalAudioStream | bool (default false) | 将自己静音 | -| muteAllRemoteAudioStreams | bool (default false) | 静音所有远端 音频 | -| muteRemoteAudioStream | number uid(用户uid) bool mute(是否静音) | 静音指定用户 音频 | -| muteLocalVideoStream | bool (default false) | 暂停发送本地 视频流 | -| enableLocalVideo | bool (default false) | 禁用本地视频功能 | -| muteAllRemoteVideoStreams | bool (default false) | 暂停所有远端视频流 | -| muteRemoteVideoStream | number uid(用户uid) bool mute(是否暂停) | 暂停指定远端视频流 | -| startRecordingService (iOS only) | string recordingKey | 启动服务端录制服务 | -| stopRecordingService (iOS only) | string recordingKey | 停止服务端录制服务 | -| getSdkVersion | callback | 获取版本号 | -| createDataStream | (boolean reliable, boolean ordered, (streamId) => {}), 其中 reliable, ordered 请参考官方文档同名方法说明 | 创建数据流通道 | -| sendStreamMessage | (number streamId, string message, (errorCode) => {})| 发送数据 | - -##### 原生通知事件 - -``` -RtcEngine.eventEmitter({ - onFirstRemoteVideoDecoded: data => {}, - onJoinChannelSuccess: data => {}, - onUserOffline: data => {}, - onUserJoined: data => {}, - onError: data => {}, - onWarning: data => {}, - onLeaveChannel: data => {}, - onAudioVolumeIndication: data => {}, - onStreamMessage: ({uid, streamId, data}) => {}, - onStreamMessageError: ({uid, streamId, error, missed, cached}) => {}, -}) -``` - -| Name | Description | -| ------------------------- | ------------ | -| onFirstRemoteVideoDecoded | 远端首帧视频接收解码回调 | -| onJoinChannelSuccess | 加入频道成功的回调 | -| onUserOffline | 其他用户离开当前频道 | -| onUserJoined | 其他用户加入当前频道 | -| onError | 错误信息 | -| onWarning | 警告 | -| onLeaveChannel | 退出频道 | -| onAudioVolumeIndication | 音量提示回调 | -| onStreamMessage | 接收到对方数据流消息的回调 | -| onStreamMessageError | 接收到对方数据流消息错误的回调 | - - -##### AgoraView 组件 - -| Name | Description | -| -------------- | -------------------- | -| showLocalVideo | 是否显示本地视频(bool) | -| remoteUid | 显示远程视频(number 传入uid) | -| zOrderMediaOverlay (Android only) | 多视频界面覆盖 设置为true优先在上层(bool) | - - -## 运行示例 - -- 更新示例 React-Native为0.51 -- 优化代码 - -[Samples](../../samples/README.md) - - -## 更新信息 -#### 1.1.2 -- 增加onVideoMute -- 新增onAudioMute回调 - -#### 1.1.1 - -- 新增方法 创建数据流通道 createDataStream -- 新增方法 发送数据流 sendStreamMessage -- 新增监听数据流事件 onStreamMessage - -#### 1.0.9 - -- 更新Agora SDK 为 2.0.2 - -- 新增方法 是否开启人脸对焦功能 setCameraAutoFocusFaceModeEnabled - -- 新增方法 修改默认的语音路由 setDefaultAudioRouteToSpeakerphone - -- 新增方法 是否打开闪光灯 setCameraTorchOn - -- 修复 Android 说话者音量提示bug - -#### 1.0.8 - - - 更新 Agora SDK 为 1.12 - - - init 不再默认开启视频预览 根据自己需求和时机调用startPreview - - - init options 新增参数 是否交换宽和高 swapWidthAndHeight 默认false - - - 新增方法 配置旁路直播推流方法 configPublisher - - - 新增方法 设置本地视频显示模式 setLocalRenderMode - - - 新增方法 设置远端视频显示模式 setRemoteRenderMode - - - 新增方法 启用说话者音量提示 enableAudioVolumeIndication - - - 新增音量提示回调 onAudioVolumeIndication - - - Android AgoraView 新增zOrderMediaOverlay属性 解决多视频界面覆盖 设置为true优先在上层 diff --git a/docs/v1/imgs/1.1_Open_iOS_ProjectFile.png b/docs/v1/imgs/1.1_Open_iOS_ProjectFile.png deleted file mode 100644 index bced90a16..000000000 Binary files a/docs/v1/imgs/1.1_Open_iOS_ProjectFile.png and /dev/null differ diff --git a/docs/v1/imgs/1.2_LinkBinaryWithLibraries.png b/docs/v1/imgs/1.2_LinkBinaryWithLibraries.png deleted file mode 100644 index ce1285703..000000000 Binary files a/docs/v1/imgs/1.2_LinkBinaryWithLibraries.png and /dev/null differ diff --git a/docs/v1/imgs/1.3_Add_Other_Libraries.png b/docs/v1/imgs/1.3_Add_Other_Libraries.png deleted file mode 100644 index 147696bae..000000000 Binary files a/docs/v1/imgs/1.3_Add_Other_Libraries.png and /dev/null differ diff --git a/docs/v1/imgs/1.4_Add_Framework_Search_Paths.png b/docs/v1/imgs/1.4_Add_Framework_Search_Paths.png deleted file mode 100644 index 74d73b507..000000000 Binary files a/docs/v1/imgs/1.4_Add_Framework_Search_Paths.png and /dev/null differ diff --git a/docs/v1/imgs/1.5_Add_Library_Search_Paths.png b/docs/v1/imgs/1.5_Add_Library_Search_Paths.png deleted file mode 100644 index 5a781c1c3..000000000 Binary files a/docs/v1/imgs/1.5_Add_Library_Search_Paths.png and /dev/null differ diff --git a/docs/v1/imgs/1.6_Set_Build_Settings_Enable_Bitcode_No.png b/docs/v1/imgs/1.6_Set_Build_Settings_Enable_Bitcode_No.png deleted file mode 100644 index 13172879a..000000000 Binary files a/docs/v1/imgs/1.6_Set_Build_Settings_Enable_Bitcode_No.png and /dev/null differ diff --git a/docs/v1/imgs/1.7_Set_Capabilities_Background_Modes.png b/docs/v1/imgs/1.7_Set_Capabilities_Background_Modes.png deleted file mode 100644 index 2e8783151..000000000 Binary files a/docs/v1/imgs/1.7_Set_Capabilities_Background_Modes.png and /dev/null differ diff --git a/docs/v1/imgs/1.8.1_Set_info_plist.png b/docs/v1/imgs/1.8.1_Set_info_plist.png deleted file mode 100644 index e3b5ecd7a..000000000 Binary files a/docs/v1/imgs/1.8.1_Set_info_plist.png and /dev/null differ diff --git a/docs/v1/imgs/1.8.2_Set_camera_and_microphone.png b/docs/v1/imgs/1.8.2_Set_camera_and_microphone.png deleted file mode 100644 index ef7dec4e7..000000000 Binary files a/docs/v1/imgs/1.8.2_Set_camera_and_microphone.png and /dev/null differ diff --git a/docs/v1/installation.android.md b/docs/v1/installation.android.md deleted file mode 100644 index 1a444a288..000000000 --- a/docs/v1/installation.android.md +++ /dev/null @@ -1,18 +0,0 @@ -# Android Installation v1 - -# Prerequisites -* Android SDK -* Android Studio - -# Step 1. Add `AndroidManifest.xml` -```xml - - - - -``` - -# Obfuscation Code Edit `android/proguard-rules.pro` -```java --keep class io.agora.**{*;} -``` diff --git a/docs/v1/installation.android.zh.md b/docs/v1/installation.android.zh.md deleted file mode 100644 index 5c5d5e75e..000000000 --- a/docs/v1/installation.android.zh.md +++ /dev/null @@ -1,18 +0,0 @@ -# Android 开发搭建指南 v1 - -# 环境准备 -* Android SDK -* Android Studio - -# Step 1. 新增 `AndroidManifest.xml` -```xml - - - - -``` - -# 当您在写混淆代码时,请在``添加以下代码: -```script - -keep class io.agora.**{*;} -``` diff --git a/docs/v1/installation.ios.md b/docs/v1/installation.ios.md deleted file mode 100644 index 543430085..000000000 --- a/docs/v1/installation.ios.md +++ /dev/null @@ -1,64 +0,0 @@ -# iOS Installation v1 - -# Prerequisites -* You should installed and linked `react-native-agora` -* Xcode 10.0+ - -# Step 1. Open Project in Xcode -Open `ios/projectName.xcodeproj` with XCode -![Step 1](imgs/1.1_Open_iOS_ProjectFile.png) -# Step 2. Add Link Binary With Libraries -Build Phases -> Link Binary With Libraries -> + -![Step 2](imgs/1.2_LinkBinaryWithLibraries.png) - - libresolv.tbd - libc++.tbd - AVFoundation.framework - AudioToolbox.framework - VideoToolbox.framework - CoreMotion.framework - CoreMedia.framework - CoreTelephony.framework - - -# Step 3. Add Other Link Binary With Libraries From `node_modules` -Build Phases -> Link Binary With Libraries -> + -> Add Other -![Step 3](imgs/1.3_Add_Other_Libraries.png) - - node_modules/react-native-agora/ios/RCTAgora/libs/libcrypto.a - node_modules/react-native-agora/ios/RCTAgora/libs/AgoraRtcCryptoLoader.framework - node_modules/react-native-agora/ios/RCTAgora/libs/AgoraRtcEngineKit.framework - - -# Step 4. Add Framework Search Paths -Build Settings -> Framework Search Paths -> + -![Step 4](imgs/1.4_Add_Framework_Search_Paths.png) -"$(SRCROOT)/../node_modules/react-native-agora/ios/RCTAgora/libs" - - -# Step 5. Add Library Search Paths -Build Settings -> Library Search Paths -> + -![Step 5](imgs/1.5_Add_Library_Search_Paths.png) - -"$(SRCROOT)/../node_modules/react-native-agora/ios/RCTAgora/libs" - - -# Step 6. Set Build Settings Enable Bitcode No -Build Settings -> Enable Bitcode -> ... -![Step 6](imgs/1.6_Set_Build_Settings_Enable_Bitcode_No.png) - -# Step 7. Set Capabilities Background Modes -Capabilities -> Background Modes -> Audio, Airplay, and Picture in Picture -![Step 7](imgs/1.7_Set_Capabilities_Background_Modes.png) - -# Step 8.1 Set info.plist -Change info.plist -"Privacy - Camera Usage Description":"use camera to start video call" -"Privacy - Microphone Usage Description":"use microphone to start video call" - -![Step 8.1](imgs/1.8.1_Set_info_plist.png) - -![Step 8.2](imgs/1.8.2_Set_camera_and_microphone.png) - -# Step 9 build -`react-native run-ios` diff --git a/docs/v1/installation.ios.zh.md b/docs/v1/installation.ios.zh.md deleted file mode 100644 index ebe24c7d8..000000000 --- a/docs/v1/installation.ios.zh.md +++ /dev/null @@ -1,60 +0,0 @@ -# iOS 开发搭建指南 v1 - -# 环境 -* 请先在项目里安装 `react-native-agora` & `react-native link react-native-agora` -* Xcode 10.0+ - -# Step 1. 使用Xcode打开ios项目 -用Xcode打开RN项目里的`ios/RN项目.xcodeproj`文件 -![Step 1](imgs/1.1_Open_iOS_ProjectFile.png) -# Step 2. 添加如下的链接库到Xcode工程 -选择 Build Phases -> Link Binary With Libraries -> + -![Step 2](imgs/1.2_LinkBinaryWithLibraries.png) - - libresolv.tbd - libc++.tbd - AVFoundation.framework - AudioToolbox.framework - VideoToolbox.framework - CoreMotion.framework - CoreMedia.framework - CoreTelephony.framework -# Step 3. 添加node_modules库到Xcode工程 -选择 Build Phases-> Link Binary With Libaries中点击“+”按钮,在弹出的窗口中点击“Add Other”按钮,选择 -![Step 3](imgs/1.3_Add_Other_Libraries.png) - - node_modules/react-native-agora/ios/RCTAgora/libs/libcrypto.a - node_modules/react-native-agora/ios/RCTAgora/libs/AgoraRtcCryptoLoader.framework - node_modules/react-native-agora/ios/RCTAgora/libs/AgoraRtcEngineKit.framework - -# Step 4. 添加Framework Search Paths -选择 Build Settings->Search Paths->Framework Search Paths添加 -"$(SRCROOT)/../node_modules/react-native-agora/ios/RCTAgora/libs" -![Step 4](imgs/1.4_Add_Framework_Search_Paths.png) - -# Step 5. 添加Library Search Paths -选择 Build Settings->Search Paths->Library Search Paths添加 -"$(SRCROOT)/../node_modules/react-native-agora/ios/RCTAgora/libs" -![Step 5](imgs/1.5_Add_Library_Search_Paths.png) - - -# Step 6. 设置Build Settings Enable Bitcode No -选择 Build Settings->Enable Bitcode设置为No -![Step 6](imgs/1.6_Set_Build_Settings_Enable_Bitcode_No.png) - -# Step 7. 设置Capabilities Background Modes -选择 Capabilities->Background Modes->Modes勾选Audio,AirPlay,and Picture In Picture -![Step 7](imgs/1.7_Set_Capabilities_Background_Modes.png) - -# Step 8.1 设置info.plist -修改info.plist -新增2项: -"Privacy - Camera Usage Description":"use camera to start video call" -"Privacy - Microphone Usage Description":"use microphone to start video call" - -![Step 8.1](imgs/1.8.1_Set_info_plist.png) - -![Step 8.2](imgs/1.8.2_Set_camera_and_microphone.png) - -# Step 9 编译 -`react-native run-ios` diff --git a/docs/v2/README.md b/docs/v2/README.md deleted file mode 100644 index 07a76d90c..000000000 --- a/docs/v2/README.md +++ /dev/null @@ -1,58 +0,0 @@ -##### 有任何问题欢迎加入QQ群进行反馈 471757030 - -## [for 1.x old version](../v1/README.md) - -# react-native-agora -[![npm](https://img.shields.io/npm/v/react-native-agora.svg)](https://www.npmjs.com/package/react-native-agora) -[![npm](https://img.shields.io/npm/dm/react-native-agora.svg)](https://www.npmjs.com/package/react-native-agora) -[![npm](https://img.shields.io/npm/dt/react-native-agora.svg)](https://www.npmjs.com/package/react-native-agora) -[![npm](https://img.shields.io/npm/l/react-native-agora.svg)](https://github.com/syanbo/react-native-agora/blob/master/LICENSE) -[![join chat](https://img.shields.io/badge/gitter-join%20chat-brightgreen.svg)](https://gitter.im/react-native-agora/community) - -## Description - -The react-native-agora is an open-source wrapper for react-native developers. This SDK takes advantage of React Native and Agora RTC Video SDKs on Android/iOS. - -## Compatibility - * `>= react native 0.59.9` - * `iOS SDK 8.0+` - * `Android 5.0+ x86 arm64 armv7a` - -## [quick start](https://github.com/AgoraIO-Community/Agora-RN-Quickstart) - -## Installation - -Install with npm: - - `npm i react-native-agora --save` - -Or, install with yarn: - - `yarn add react-native-agora` - -Either way, then link with: - - `react-native link react-native-agora` - -### iOS Installation - [中文](installation.ios.zh.md) - [English](installation.ios.md) - -### Android Installation - [中文](installation.android.zh.md) - [English](installation.android.md) - -## Agora Native API Documentation - -### Android - [中文](https://docs.agora.io/cn/Video/API%20Reference/java/index.html) - [English](https://docs.agora.io/en/Video/API%20Reference/java/index.html) - -## iOS - [中文](https://docs.agora.io/cn/Video/API%20Reference/oc/docs/headers/Agora-Objective-C-API-Overview.html) - [English](https://docs.agora.io/en/Video/API%20Reference/oc/docs/headers/Agora-Objective-C-API-Overview.html) - -## Resources -* Complete [API documentation](https://docs.agora.io/en/) at the Developer Center -* [File bugs about this sample](https://github.com/syanbo/react-native-agora/issues) -* [React Native Getting Started](https://facebook.github.io/react-native/docs/getting-started.html) diff --git a/docs/v2/imgs/05.png b/docs/v2/imgs/05.png deleted file mode 100644 index b315b8cc8..000000000 Binary files a/docs/v2/imgs/05.png and /dev/null differ diff --git a/docs/v2/imgs/05a.png b/docs/v2/imgs/05a.png deleted file mode 100644 index acc639097..000000000 Binary files a/docs/v2/imgs/05a.png and /dev/null differ diff --git a/docs/v2/imgs/05b.png b/docs/v2/imgs/05b.png deleted file mode 100644 index da165f534..000000000 Binary files a/docs/v2/imgs/05b.png and /dev/null differ diff --git a/docs/v2/imgs/05c.png b/docs/v2/imgs/05c.png deleted file mode 100644 index bcf000948..000000000 Binary files a/docs/v2/imgs/05c.png and /dev/null differ diff --git a/docs/v2/imgs/06.png b/docs/v2/imgs/06.png deleted file mode 100644 index 734f78512..000000000 Binary files a/docs/v2/imgs/06.png and /dev/null differ diff --git a/docs/v2/imgs/07.png b/docs/v2/imgs/07.png deleted file mode 100644 index 4c50ff331..000000000 Binary files a/docs/v2/imgs/07.png and /dev/null differ diff --git a/docs/v2/imgs/08a.png b/docs/v2/imgs/08a.png deleted file mode 100644 index 1b6b2daa4..000000000 Binary files a/docs/v2/imgs/08a.png and /dev/null differ diff --git a/docs/v2/imgs/08b.png b/docs/v2/imgs/08b.png deleted file mode 100644 index 7c322515a..000000000 Binary files a/docs/v2/imgs/08b.png and /dev/null differ diff --git a/docs/v2/imgs/08c.png b/docs/v2/imgs/08c.png deleted file mode 100644 index 85fb45040..000000000 Binary files a/docs/v2/imgs/08c.png and /dev/null differ diff --git a/docs/v2/imgs/1.2_OpenProject.png b/docs/v2/imgs/1.2_OpenProject.png deleted file mode 100644 index a4efaae38..000000000 Binary files a/docs/v2/imgs/1.2_OpenProject.png and /dev/null differ diff --git a/docs/v2/imgs/1.3.1_RCTAgora.png b/docs/v2/imgs/1.3.1_RCTAgora.png deleted file mode 100644 index 6a239f08e..000000000 Binary files a/docs/v2/imgs/1.3.1_RCTAgora.png and /dev/null differ diff --git a/docs/v2/imgs/1.3.3_UPDATE_RCTAgora_AgoraRtcEngineKit_Framework.png b/docs/v2/imgs/1.3.3_UPDATE_RCTAgora_AgoraRtcEngineKit_Framework.png deleted file mode 100644 index d18e69be5..000000000 Binary files a/docs/v2/imgs/1.3.3_UPDATE_RCTAgora_AgoraRtcEngineKit_Framework.png and /dev/null differ diff --git a/docs/v2/imgs/1.3.4_SELECT_AgoraRtcEngineKit_from_iOS_Pods_folder.png b/docs/v2/imgs/1.3.4_SELECT_AgoraRtcEngineKit_from_iOS_Pods_folder.png deleted file mode 100644 index 6f273271f..000000000 Binary files a/docs/v2/imgs/1.3.4_SELECT_AgoraRtcEngineKit_from_iOS_Pods_folder.png and /dev/null differ diff --git a/docs/v2/imgs/1.3.5_DRAG_IT_INTO_Link_Binary_With_Libraries.png b/docs/v2/imgs/1.3.5_DRAG_IT_INTO_Link_Binary_With_Libraries.png deleted file mode 100644 index 27ddd060a..000000000 Binary files a/docs/v2/imgs/1.3.5_DRAG_IT_INTO_Link_Binary_With_Libraries.png and /dev/null differ diff --git a/docs/v2/imgs/1.3_Add_Files_To_Project.png b/docs/v2/imgs/1.3_Add_Files_To_Project.png deleted file mode 100644 index ca55f0f57..000000000 Binary files a/docs/v2/imgs/1.3_Add_Files_To_Project.png and /dev/null differ diff --git a/docs/v2/imgs/1.4.1_SET_RCTAgora.a.png b/docs/v2/imgs/1.4.1_SET_RCTAgora.a.png deleted file mode 100644 index e4277d899..000000000 Binary files a/docs/v2/imgs/1.4.1_SET_RCTAgora.a.png and /dev/null differ diff --git a/docs/v2/imgs/10a.png b/docs/v2/imgs/10a.png deleted file mode 100644 index a15b4ea2f..000000000 Binary files a/docs/v2/imgs/10a.png and /dev/null differ diff --git a/docs/v2/imgs/10b.png b/docs/v2/imgs/10b.png deleted file mode 100644 index 636c9c90f..000000000 Binary files a/docs/v2/imgs/10b.png and /dev/null differ diff --git a/docs/v2/imgs/9a.png b/docs/v2/imgs/9a.png deleted file mode 100644 index 2c13d926e..000000000 Binary files a/docs/v2/imgs/9a.png and /dev/null differ diff --git a/docs/v2/imgs/9b.png b/docs/v2/imgs/9b.png deleted file mode 100644 index 3ff3e7901..000000000 Binary files a/docs/v2/imgs/9b.png and /dev/null differ diff --git a/docs/v2/imgs/9c.png b/docs/v2/imgs/9c.png deleted file mode 100644 index acd3a7f3f..000000000 Binary files a/docs/v2/imgs/9c.png and /dev/null differ diff --git a/docs/v2/imgs/9d.png b/docs/v2/imgs/9d.png deleted file mode 100644 index e1a88abef..000000000 Binary files a/docs/v2/imgs/9d.png and /dev/null differ diff --git a/docs/v2/imgs/9e.png b/docs/v2/imgs/9e.png deleted file mode 100644 index 09ad47bbf..000000000 Binary files a/docs/v2/imgs/9e.png and /dev/null differ diff --git a/docs/v2/imgs/t01.png b/docs/v2/imgs/t01.png deleted file mode 100644 index 6c46d833a..000000000 Binary files a/docs/v2/imgs/t01.png and /dev/null differ diff --git a/docs/v2/imgs/t02.png b/docs/v2/imgs/t02.png deleted file mode 100644 index 117b19f12..000000000 Binary files a/docs/v2/imgs/t02.png and /dev/null differ diff --git a/docs/v2/imgs/t03.png b/docs/v2/imgs/t03.png deleted file mode 100644 index a558bc20c..000000000 Binary files a/docs/v2/imgs/t03.png and /dev/null differ diff --git a/docs/v2/imgs/t04.png b/docs/v2/imgs/t04.png deleted file mode 100644 index 9e8d5a075..000000000 Binary files a/docs/v2/imgs/t04.png and /dev/null differ diff --git a/docs/v2/imgs/t05.png b/docs/v2/imgs/t05.png deleted file mode 100644 index aa9f04a29..000000000 Binary files a/docs/v2/imgs/t05.png and /dev/null differ diff --git a/docs/v2/installation.android.md b/docs/v2/installation.android.md deleted file mode 100644 index 32e3d80e5..000000000 --- a/docs/v2/installation.android.md +++ /dev/null @@ -1,47 +0,0 @@ -# Android Installation v2 - -# Prerequisites -* Android SDK -* Android Studio - -# Step 1. Add `AndroidManifest.xml` -```xml - - - - - -``` - -# Step 2. Add `react-native-agora` to `settings.gradle` -```groovy -... -include ':react-native-agora' -project(':react-native-agora').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-agora/android') -``` - -# To set android sdk version Create `local.properties` in android root directory -```bash -cd android -echo "sdk.dir = " > local.properties -``` - -# For Obfuscation Code Edit `android/proguard-rules.pro` -```java --keep class io.agora.**{*;} -``` - -# build for development -```bash -react-native run-android -react-native log-android -``` - -# build for Release -```bash -mkdir -p android/app/src/main/assets -curl "localhost:8081/index.bundle?platform=android&dev=false&minify=true" -o "android/app/src/main/assets/index.android.bundle" -cd android -./gradlew assembleRelease - -``` diff --git a/docs/v2/installation.android.zh.md b/docs/v2/installation.android.zh.md deleted file mode 100644 index 279bcc002..000000000 --- a/docs/v2/installation.android.zh.md +++ /dev/null @@ -1,46 +0,0 @@ -# Android 开发搭建指南 v2 - -# Prerequisites -* Android SDK -* Android Studio - -# Step 1. 新增 `AndroidManifest.xml` -```xml - - - - - -``` - -# Step 2. 在android目录里的`settings.gradle`新增`react-native-agora`的依赖管理 -```groovy -include ':react-native-agora' -project(':react-native-agora').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-agora/android') -``` - -# 可以创建`local.properties`设置android sdk -```bash -cd android -echo "sdk.dir = <你的android目录>" > local.properties -``` - -# 当您在写混淆代码时,请在``添加以下代码 到 `android/proguard-rules.pro` -```java --keep class io.agora.**{*;} -``` - -# 构建开发环境 -```bash -react-native run-android -react-native log-android -``` - -# 开发环境打包 -```bash -mkdir -p android/app/src/main/assets -curl "localhost:8081/index.bundle?platform=android&dev=false&minify=true" -o "android/app/src/main/assets/index.android.bundle" -cd android -./gradlew assembleRelease - -``` diff --git a/docs/v2/installation.ios.md b/docs/v2/installation.ios.md deleted file mode 100644 index 08f6004bc..000000000 --- a/docs/v2/installation.ios.md +++ /dev/null @@ -1,150 +0,0 @@ -# React native Agora iOS Installation v2 - -#### Minimum compatibility -* >= React native 0.55.x -* iOS SDK 8.0+ -* Android 5.0+ x86 arm64 armv7a - -#### 1. open up your terminal and write this : -When it comes to the version new release you can put any version you like as long as it is compatibility -```sh -$ react-native init agoraguide --version react-native@0.58 -``` - -#### 2. cd into your project folder -```sh -$ cd agoraguide -``` -#### 3. install npm package react-native-agora - -with npm - - -```sh -$ npm install --save react-native-agora -``` - -or yarn - -```sh -$ yarn add react-native-agora -``` - - -#### 4. cd into your ios folder -```sh -$ cd ios -``` - -#### 5. we need to initialize pod -if you don't have CocoaPods installed run this command in your terminal -```sh -$ gem install cocoapods -``` -after you have installed CocoaPods run this command inside of your ios folder -```sh -$ pod init -``` -and then we need to install the pods -```sh -$ pod install -``` -if you get a error from CocoaPods saying something like this : -![Step 5](imgs/05.png) -then you need to open up your `Podfile` and remove the part that is blue marked in the picture below - -#### *before* -![Step 5](imgs/05a.png) - -#### *after* -![Step 5](imgs/05b.png) - -we need to add this code at the bottom to our `Podfile` -```sh -post_install do |installer| - installer.pods_project.targets.each do |target| - - # The following is needed to ensure the "archive" step works in XCode. - # It removes React & Yoga from the Pods project, as it is already included in the main project. - # Without this, you'd see errors when you archive like: - # "Multiple commands produce ... libReact.a" - # "Multiple commands produce ... libyoga.a" - - targets_to_ignore = %w(React yoga) - - if targets_to_ignore.include? target.name - target.remove_from_project - end - - end -end -``` -This is how your podfile should look like -![Step 5](imgs/05c.png) -after that you can run this command again -```sh -$ pod install -``` - -#### 6. Open up your Xcode project *[project name].xcworkspace* inside in ios folder -![Step 6](imgs/06.png) - -#### 7. expand your project folder and right click on the *"Libraries"* folder and choose *"add files to [project name]"* -![Step 7](imgs/07.png) - -#### 8. follow the image below to find the RCTAgora lib - -![Step 8](imgs/08a.png) -the path is node_modules => react-native-agora => ios => RCTAgora.xcodeproj - -make sure you check so that those are checked - -![Step 8](imgs/08b.png) - -If the file is greyed out it means you already have it inside of you library folder. -Check so that RCTAgora.xcodeproj are inside of your "Libraries" folder -![Step 8](imgs/08c.png) - -#### 9. we need to add the framework -expand your "Frameworks" folder and you should see the "AgoraRtcEngineKit.framework" are red. -![Step 9](imgs/9a.png) -right click and delete that -Left click on your "RCTAgora.xcodeproj" and click on "Build Phases" -![Step 9](imgs/9b.png) -left click on the "AgoraRtcEngineKit.framework" in the list and click on the "-"(minus sign) to remove it from the list. -![Step 9](imgs/9c.png) -then click on the "+"(plus sign) so that we can add the framework. -Click on the "Add other..." button -![Step 9](imgs/9d.png) -then we need to navigate and find our framwork -![Step 9](imgs/9e.png) -the path is : ios => Pods => AgoraRtcEngine_iOS => AgoraRtcEngineKit.framework and click on "add" - -#### 10. at last we need to link the library -click on your project on the left and then click on "Build Phases" and then expand "Link Binary With Libraries" and then click on the "+"(plus sign) -![Step 10](imgs/10a.png) -Search for libRCTAgora and click on add -![Step 10](imgs/10b.png) -if you cant find it in your list check so that you dont already have it - ----------------------------------------------- -### Troubleshooting - -if you get some errors like the pictures below -![Step t1](imgs/t01.png) -![Step t2](imgs/t02.png) - -the chances are that you have some framework that already have imported time.h something like firestore. - -Expand your "Libraries" and then click on "RCTAgora.xcodeproj". Then click on "Build settings" and search for "Header search paths" -![Step t3](imgs/t03.png) -Doubble click on the path -![Step t4](imgs/t04.png) -and change the Pods path from "recursive" to non-recursive -![Step t5](imgs/t05.png) - - - - - - diff --git a/docs/v2/installation.ios.zh.md b/docs/v2/installation.ios.zh.md deleted file mode 100644 index 8c99a71ec..000000000 --- a/docs/v2/installation.ios.zh.md +++ /dev/null @@ -1,145 +0,0 @@ -# iOS 开发搭建指南 v2 - -#### 最低兼容 -* >= React Native 0.55.x -* iOS SDK 8.0+ -* Android 5.0+ x86 arm64 armv7a - -#### 1. 打开你的终端,输入如下命令: -对于新版本,你可以放置任何你喜欢的版本,只要它兼容。 -``` -$ react-native init agoraguide --version react-native@0.58 -``` - -#### 2. cd 到你的项目目录 -```sh -$ cd agoraguide -``` - -#### 3. 安装 react-native-agora - -npm方式 -```sh -$ npm install --save react-native-agora -``` - -yarn方式 -```sh -$ yarn add react-native-agora -``` - -#### 4. cd 到你的ios目录 -```sh -$ cd ios -``` - -#### 5. 安装pod -如果你没有安装过CocoaPods,在你的终端里输入以下命令并执行: -```sh -$ gem install Cocoapods -``` -在成功安装CocoaPods后,在你项目的ios目录里执行以下命令: -```sh -$ pod init -``` -接着执行安装pods -```sh -$ pod install -``` -当你在安装pod过程中,遇到问题如下的报错时: -![Step 5](imgs/05.png) -你需要打开`Podfile`并且如下图所示的蓝色部分。 - -#### *选中这部分* -![Step 5](imgs/05a.png) - -#### *删除后* -![Step 5](imgs/05b.png) - -在`Podfile`底部加入以下代码: -```sh -post_install do |installer| - installer.pods_project.targets.each do |target| - - # The following is needed to ensure the "archive" step works in XCode. - # It removes React & Yoga from the Pods project, as it is already included in the main project. - # Without this, you'd see errors when you archive like: - # "Multiple commands produce ... libReact.a" - # "Multiple commands produce ... libyoga.a" - - targets_to_ignore = %w(React yoga) - - if targets_to_ignore.include? target.name - target.remove_from_project - end - - end -end -``` -这是最终修改好的`Podfile`,如图所示。 -![Step 5](imgs/05c.png) -之后你就可以执行安装命令: -``` -$ pod install -``` - -#### 6. 在你项目的ios目录里,打开Xcode工程文件 *[项目名].xcworkspace -![Step 6](imgs/06.png) - -#### 7. 展开你的项目目录,并且右键点击*"Libraries"* 目录并且选择*"add file to [project name]"* -![Step 7](imgs/07.png) - -#### 8. 按照下图去找到RCTAgora lib -![Step 8](imgs/08a.png) -你可以沿路径找到:node_modules => react-native-agora => ios => RCTAgora.xcodeproj - -请按照如图所示的方式确认你已经配好编译环境 -![Step 8](imgs/08b.png) - -如果下图所示的文件是灰色的,请确保它的路径是在你的目录里的。 -请检查`RCTAgora.xcodeproj`是否在`Libraries`目录中。 -![Step 8](imgs/08c.png) - -#### 9. 检查你的Framework是否已经成功设置 -展开你的 "Frameworks" 目录,如果看到红色的 "AgoraRtcEngineKit.framework",你需要按照以下步骤重新把它载入到编译环境。 -![Step 9](imgs/9a.png) -单击右键并删除。 -单击左键 "RCTAgora.xcodeproj" 找到并点击 "Build Phases" -![Step 9](imgs/9b.png) -在列表里找到 "AgoraRtcEngineKit.framework" 单击左键 找到 "-"(减号按钮) 把它从列表里删除。 -![Step 9](imgs/9c.png) -然后点击"+"(加号按钮) 点击"Add other..."按钮。 -![Step 9](imgs/9d.png) -按照图下方式,找到"AgoraRtcEngineKit.framework" -![Step 9](imgs/9e.png) -你可以沿路径找到: ios => Pods => AgoraRtcEngine_iOS => AgoraRtcEngineKit.framework 并且点击 "add" - -#### 10. 最后我们需要连接Library -点击你的项目左侧,并且点击"Build Phases"然后展开"Link Binary With Libraries"接着点击"+"(加号按钮) -click on your project on the left and then click on "Build Phases" and then expand "Link Binary With Libraries" and then click on the "+"(plug sign) -![Step 10](imgs/10a.png) -找到 libRCTAgora 并且点击"add" -![Step 10](imgs/10b.png) -如果你无法在列表里找到它,表明你还没安装它。 - ----------------------------------------------- -### 常见故障排除 - -如果你遇到类似的报错: -![Step t1](imgs/t01.png) -![Step t2](imgs/t02.png) - -可能是因为你有一些框架已经导入了相同的头文件,例如firestore库也会引入time.h, - -展开你项目里的"Libraries" 并且点击"RCTAgora.xcodeproj"。然后点击"Build settings" 并且找到"Header search paths",按照以下方法设置。 -![Step t3](imgs/t03.png) -双击当前选中的路径 -![Step t4](imgs/t04.png) -把路径里的"recursive"修改成"non-recursive" -![Step t5](imgs/t05.png) - - - - - - diff --git a/docs/v3/installation.android.md b/docs/v3/installation.android.md deleted file mode 100644 index aa2dd9022..000000000 --- a/docs/v3/installation.android.md +++ /dev/null @@ -1,104 +0,0 @@ -# Android Installation v3 - -## Prerequisites - -* Android SDK 28+ -* Android Studio -* Kotlin - -## Step 1. Migrating to AndroidX. - -We use Kotlin and AndroidX in the native module. - -Android Studio -> Refactor -> Migrate to AndroidX... -> Migrate - -[Google Official Doc](https://developer.android.com/jetpack/androidx/migrate) - -## Step 2. Link the library. - -### Automatic - -Use `react-native link` to add the library to your project: - -```shell script -react-native link react-native-agora -``` - -### Manual - -Define the `react-native-agora` project in `android/settings.gradle`: - -```groovy -... -include ':react-native-agora' -project(':react-native-agora').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-agora/android') -``` - -Add the `react-native-agora` as a dependency of your app in `android/app/build.gradle`: - -```groovy -... -dependencies { - ... - implementation project(':react-native-agora') -} -``` - -Add `import io.agora.rtc.react.RCTAgoraRtcPackage;` and `new RCTAgoraRtcPackage()` in your `MainApplication.java`: - -```java -import io.agora.rtc.react.RCTAgoraRtcPackage; -... - @Override - protected List getPackages() { - return Arrays.asList( - new MainReactPackage(), - new RCTAgoraRtcPackage() - ); - } -``` - -## Step 3. Add ext Config. (**recommended**) - -If you've defined *[project-wide properties](https://developer.android.com/studio/build/gradle-tips.html)* in your root `build.gradle`, this library will detect the presence of the following properties: - -```groovy -buildscript {...} -allprojects {...} - -/** - * Project-wide Gradle configuration properties - */ -ext { - compileSdkVersion = 28 - buildToolsVersion = "28.0.3" - minSdkVersion = 16 - targetSdkVersion = 28 - kotlin_version = "1.3.72" -} -``` -or do -```groovy -buildscript { - ext { - compileSdkVersion = 28 - buildToolsVersion = "28.0.3" - minSdkVersion = 16 - targetSdkVersion = 28 - kotlin_version = "1.3.72" - } -} -... -``` - -## Step 4. Add Network Security Config. - -Add `android:networkSecurityConfig` to your manifest file (`android/app/src/main/AndroidManifest.xml`): - -```xml - -... - -``` - -[Google Official Doc](https://developer.android.com/training/articles/security-config) diff --git a/docs/v3/installation.ios.md b/docs/v3/installation.ios.md deleted file mode 100644 index 52c8493bd..000000000 --- a/docs/v3/installation.ios.md +++ /dev/null @@ -1,117 +0,0 @@ -# iOS Installation v3 - -## Prerequisites - -* iOS SDK 9.0+ -* Xcode -* Swift - -## Step 1. Migrating to Swift. - -We use Swift in the native module. - -You should **create a swift file by Xcode** to make your project support swift. - -[Apple Official Doc](https://developer.apple.com/documentation/swift/migrating_your_objective-c_code_to_swift) - -## Step 2. Link the library. - -### Using without CocoaPods. - -Use `react-native link` to add the library to your project: - -```shell script -react-native link react-native-agora -``` - -#### Download native SDK - -We provide a shell script to help you download the correct version of SDK. - -```shell script -cd node_modules/react-native-agora -sh ./install.sh -``` - -Then frameworks will be saved to this path: - -```shell script -node_modules/react-native-agora/ios/RCTAgora/Libs/*.xcframework -``` - -You should **copy frameworks to your root project** and [embedding](https://developer.apple.com/library/archive/technotes/tn2435/_index.html#//apple_ref/doc/uid/DTS40017543-CH1-EMBED_IN_APP_SECTION) these because they are dynamic libraries. - -### Using with CocoaPods. (**recommended**) - -Install CocoaPods. - -[CocoaPods Official Doc](https://guides.cocoapods.org/using/getting-started.html) - -```shell script -cd ios -pod init -``` - -Setup your `Podfile` (found at `ios/Podfile` as below, replacing all references to `_YOUR_PROJECT_TARGET_` with your project target (it's the same as project name by default). - -[CocoaPods Official Doc](https://guides.cocoapods.org/using/using-cocoapods.html) - -```ruby -# Uncomment the next line to define a global platform for your project -# platform :ios, '9.0' - -target '_YOUR_PROJECT_TARGET_' do - # Comment the next line if you don't want to use dynamic frameworks - - # https://reactnative.dev/docs/0.59/integration-with-existing-apps#configuring-cocoapods-dependencies - # Your 'node_modules' directory is probably in the root of your project, - # but if not, adjust the `:path` accordingly - pod 'React', :path => '../node_modules/react-native', :subspecs => [ - 'Core', - 'CxxBridge', # Include this for RN >= 0.47 - 'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43 - 'RCTText', - 'RCTNetwork', - 'RCTWebSocket', # needed for debugging - # Add any other subspecs you want to use in your project - 'RCTActionSheet', - 'RCTAnimation', - 'RCTBlob', - 'RCTCameraRoll', - 'RCTGeolocation', - 'RCTImage', - 'RCTPushNotification', - 'RCTSettings', - 'RCTVibration', - 'RCTLinkingIOS', - ], :modular_headers => true - # Explicitly include Yoga if you are using RN >= 0.42.0 - pod "yoga", :path => "../node_modules/react-native/ReactCommon/yoga", :modular_headers => true - - # Third party deps podspec link - pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec', :modular_headers => false - pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec', :modular_headers => false - pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec', :modular_headers => false - - # Pods for _YOUR_PROJECT_TARGET_ -end - -``` - -Use `react-native link` to add the library to your project: - -```shell script -react-native link react-native-agora -``` - -Then run in the `ios` folder: - -```shell script -pod install -``` - -Open the produced workspace file (`.xcworkspace`) in XCode to build your project. - -## Step 3. App store submission. - -The app's `Info.plist` file must contain `Privacy - Microphone Usage Description` and `Privacy - Camera Usage Description` with a user-facing purpose string explaining clearly and completely why your app needs the permission, otherwise Apple will reject your app submission. diff --git a/example/agora.config.json b/example/agora.config.json deleted file mode 100644 index 35a80e7e3..000000000 --- a/example/agora.config.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "//appId": "Get your own App ID at https://dashboard.agora.io/", - "appId": YOUR_APP_ID, - "//token": "Please refer to https://docs.agora.io/en/Agora%20Platform/token", - "token": YOUR_TOEKN, - "channelId": YOUR_CHANNEL_ID, - "uid": YOUR_UID, - "stringUid": YOUR_STRING_UID -} diff --git a/example/android/.project b/example/android/.project deleted file mode 100644 index 3964dd3f5..000000000 --- a/example/android/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - android - Project android created by Buildship. - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.buildship.core.gradleprojectnature - - diff --git a/example/android/.settings/org.eclipse.buildship.core.prefs b/example/android/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index e8895216f..000000000 --- a/example/android/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,2 +0,0 @@ -connection.project.dir= -eclipse.preferences.version=1 diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle deleted file mode 100644 index 251c4de9e..000000000 --- a/example/android/app/build.gradle +++ /dev/null @@ -1,227 +0,0 @@ -apply plugin: "com.android.application" - -import com.android.build.OutputFile - -/** - * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets - * and bundleReleaseJsAndAssets). - * These basically call `react-native bundle` with the correct arguments during the Android build - * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the - * bundle directly from the development server. Below you can see all the possible configurations - * and their defaults. If you decide to add a configuration block, make sure to add it before the - * `apply from: "../../node_modules/react-native/react.gradle"` line. - * - * project.ext.react = [ - * // the name of the generated asset file containing your JS bundle - * bundleAssetName: "index.android.bundle", - * - * // the entry file for bundle generation. If none specified and - * // "index.android.js" exists, it will be used. Otherwise "index.js" is - * // default. Can be overridden with ENTRY_FILE environment variable. - * entryFile: "index.android.js", - * - * // https://reactnative.dev/docs/performance#enable-the-ram-format - * bundleCommand: "ram-bundle", - * - * // whether to bundle JS and assets in debug mode - * bundleInDebug: false, - * - * // whether to bundle JS and assets in release mode - * bundleInRelease: true, - * - * // whether to bundle JS and assets in another build variant (if configured). - * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants - * // The configuration property can be in the following formats - * // 'bundleIn${productFlavor}${buildType}' - * // 'bundleIn${buildType}' - * // bundleInFreeDebug: true, - * // bundleInPaidRelease: true, - * // bundleInBeta: true, - * - * // whether to disable dev mode in custom build variants (by default only disabled in release) - * // for AgoraExample: to disable dev mode in the staging build type (if configured) - * devDisabledInStaging: true, - * // The configuration property can be in the following formats - * // 'devDisabledIn${productFlavor}${buildType}' - * // 'devDisabledIn${buildType}' - * - * // the root of your project, i.e. where "package.json" lives - * root: "../../", - * - * // where to put the JS bundle asset in debug mode - * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", - * - * // where to put the JS bundle asset in release mode - * jsBundleDirRelease: "$buildDir/intermediates/assets/release", - * - * // where to put drawable resources / React Native assets, e.g. the ones you use via - * // require('./image.png')), in debug mode - * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", - * - * // where to put drawable resources / React Native assets, e.g. the ones you use via - * // require('./image.png')), in release mode - * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", - * - * // by default the gradle tasks are skipped if none of the JS files or assets change; this means - * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to - * // date; if you have any other folders that you want to ignore for performance reasons (gradle - * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ - * // for AgoraExample, you might want to remove it from here. - * inputExcludes: ["android/**", "ios/**"], - * - * // override which node gets called and with what additional arguments - * nodeExecutableAndArgs: ["node"], - * - * // supply additional arguments to the packager - * extraPackagerArgs: [] - * ] - */ - -project.ext.react = [ - enableHermes: false, // clean and rebuild if changing -] - -apply from: "../../node_modules/react-native/react.gradle" - -/** - * Set this to true to create two separate APKs instead of one: - * - An APK that only works on ARM devices - * - An APK that only works on x86 devices - * The advantage is the size of the APK is reduced by about 4MB. - * Upload all the APKs to the Play Store and people will download - * the correct one based on the CPU architecture of their device. - */ -def enableSeparateBuildPerCPUArchitecture = false - -/** - * Run Proguard to shrink the Java bytecode in release builds. - */ -def enableProguardInReleaseBuilds = false - -/** - * The preferred build flavor of JavaScriptCore. - * - * For AgoraExample, to use the international variant, you can use: - * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` - * - * The international variant includes ICU i18n library and necessary data - * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that - * give correct results when using with locales other than en-US. Note that - * this variant is about 6MiB larger per architecture than default. - */ -def jscFlavor = 'org.webkit:android-jsc:+' - -/** - * Whether to enable the Hermes VM. - * - * This should be set on project.ext.react and mirrored here. If it is not set - * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode - * and the benefits of using Hermes will therefore be sharply reduced. - */ -def enableHermes = project.ext.react.get("enableHermes", false); - -android { - ndkVersion rootProject.ext.ndkVersion - - compileSdkVersion rootProject.ext.compileSdkVersion - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - defaultConfig { - applicationId "com.example.reactnativeagora" - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 1 - versionName "1.0" - multiDexEnabled true - } - splits { - abi { - reset() - enable enableSeparateBuildPerCPUArchitecture - universalApk false // If true, also generate a universal APK - include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" - } - } - signingConfigs { - debug { - storeFile file('debug.keystore') - storePassword 'android' - keyAlias 'androiddebugkey' - keyPassword 'android' - } - } - buildTypes { - debug { - signingConfig signingConfigs.debug - } - release { - // Caution! In production, you need to generate your own keystore file. - // see https://reactnative.dev/docs/signed-apk-android. - signingConfig signingConfigs.debug - minifyEnabled enableProguardInReleaseBuilds - proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" - } - } - - // applicationVariants are e.g. debug, release - applicationVariants.all { variant -> - variant.outputs.each { output -> - // For each separate APK per architecture, set a unique version code as described here: - // https://developer.android.com/studio/build/configure-apk-splits.html - // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc. - def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] - def abi = output.getFilter(OutputFile.ABI) - if (abi != null) { // null for the universal-debug, universal-release variants - output.versionCodeOverride = - defaultConfig.versionCode * 1000 + versionCodes.get(abi) - } - - } - } -} - -dependencies { - implementation fileTree(dir: "libs", include: ["*.jar"]) - //noinspection GradleDynamicVersion - implementation "com.facebook.react:react-native:+" // From node_modules - - implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" - - debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { - exclude group: 'com.facebook.fbjni' - } - - debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { - exclude group: 'com.facebook.flipper' - exclude group: 'com.squareup.okhttp3', module: 'okhttp' - } - - debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { - exclude group: 'com.facebook.flipper' - } - - if (enableHermes) { - def hermesPath = "../../node_modules/hermes-engine/android/"; - debugImplementation files(hermesPath + "hermes-debug.aar") - releaseImplementation files(hermesPath + "hermes-release.aar") - } else { - implementation jscFlavor - } - - implementation 'androidx.multidex:multidex:2.0.1' - - implementation project(':react-native-agora') -} - -// Run this once to be able to run the application with BUCK -// puts all compile dependencies into folder libs for BUCK to use -task copyDownloadableDepsToLibs(type: Copy) { - from configurations.compile - into 'libs' -} - -apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) diff --git a/example/android/app/debug.keystore b/example/android/app/debug.keystore deleted file mode 100644 index 364e105ed..000000000 Binary files a/example/android/app/debug.keystore and /dev/null differ diff --git a/example/android/app/proguard-rules.pro b/example/android/app/proguard-rules.pro deleted file mode 100644 index 11b025724..000000000 --- a/example/android/app/proguard-rules.pro +++ /dev/null @@ -1,10 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml deleted file mode 100644 index fa26aa56e..000000000 --- a/example/android/app/src/debug/AndroidManifest.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - diff --git a/example/android/app/src/debug/java/com/example/reactnativeagora/ReactNativeFlipper.java b/example/android/app/src/debug/java/com/example/reactnativeagora/ReactNativeFlipper.java deleted file mode 100644 index 533f5e00b..000000000 --- a/example/android/app/src/debug/java/com/example/reactnativeagora/ReactNativeFlipper.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - *

This source code is licensed under the MIT license found in the LICENSE file in the root - * directory of this source tree. - */ -package com.example.reactnativeagora; - -import android.content.Context; -import com.facebook.flipper.android.AndroidFlipperClient; -import com.facebook.flipper.android.utils.FlipperUtils; -import com.facebook.flipper.core.FlipperClient; -import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; -import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; -import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; -import com.facebook.flipper.plugins.inspector.DescriptorMapping; -import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; -import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; -import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; -import com.facebook.flipper.plugins.react.ReactFlipperPlugin; -import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; -import com.facebook.react.ReactInstanceManager; -import com.facebook.react.bridge.ReactContext; -import com.facebook.react.modules.network.NetworkingModule; -import okhttp3.OkHttpClient; - -public class ReactNativeFlipper { - public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { - if (FlipperUtils.shouldEnableFlipper(context)) { - final FlipperClient client = AndroidFlipperClient.getInstance(context); - client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); - client.addPlugin(new ReactFlipperPlugin()); - client.addPlugin(new DatabasesFlipperPlugin(context)); - client.addPlugin(new SharedPreferencesFlipperPlugin(context)); - client.addPlugin(CrashReporterPlugin.getInstance()); - NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); - NetworkingModule.setCustomClientBuilder( - new NetworkingModule.CustomClientBuilder() { - @Override - public void apply(OkHttpClient.Builder builder) { - builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); - } - }); - client.addPlugin(networkFlipperPlugin); - client.start(); - // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized - // Hence we run if after all native modules have been initialized - ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); - if (reactContext == null) { - reactInstanceManager.addReactInstanceEventListener( - new ReactInstanceManager.ReactInstanceEventListener() { - @Override - public void onReactContextInitialized(ReactContext reactContext) { - reactInstanceManager.removeReactInstanceEventListener(this); - reactContext.runOnNativeModulesQueueThread( - new Runnable() { - @Override - public void run() { - client.addPlugin(new FrescoFlipperPlugin()); - } - }); - } - }); - } else { - client.addPlugin(new FrescoFlipperPlugin()); - } - } - } -} diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index 79e63c62b..000000000 --- a/example/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - diff --git a/example/android/app/src/main/assets/Sound_Horizon.mp3 b/example/android/app/src/main/assets/Sound_Horizon.mp3 deleted file mode 100644 index 8f4cdb876..000000000 Binary files a/example/android/app/src/main/assets/Sound_Horizon.mp3 and /dev/null differ diff --git a/example/android/app/src/main/java/com/example/reactnativeagora/MainActivity.java b/example/android/app/src/main/java/com/example/reactnativeagora/MainActivity.java deleted file mode 100644 index f37ad495f..000000000 --- a/example/android/app/src/main/java/com/example/reactnativeagora/MainActivity.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.example.reactnativeagora; - -import com.facebook.react.ReactActivity; - -public class MainActivity extends ReactActivity { - - /** - * Returns the name of the main component registered from JavaScript. This is used to schedule - * rendering of the component. - */ - @Override - protected String getMainComponentName() { - return "AgoraExample"; - } -} diff --git a/example/android/app/src/main/java/com/example/reactnativeagora/MainApplication.java b/example/android/app/src/main/java/com/example/reactnativeagora/MainApplication.java deleted file mode 100644 index fc1670b32..000000000 --- a/example/android/app/src/main/java/com/example/reactnativeagora/MainApplication.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.example.reactnativeagora; - -import android.app.Application; -import android.content.Context; -import com.facebook.react.PackageList; -import com.facebook.react.ReactApplication; -import com.facebook.react.ReactNativeHost; -import com.facebook.react.ReactPackage; -import com.facebook.react.ReactInstanceManager; -import com.facebook.soloader.SoLoader; -import java.lang.reflect.InvocationTargetException; -import java.util.List; - -import io.agora.rtc.react.RCTAgoraRtcPackage; - -public class MainApplication extends Application implements ReactApplication { - - private final ReactNativeHost mReactNativeHost = - new ReactNativeHost(this) { - @Override - public boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } - - @Override - protected List getPackages() { - @SuppressWarnings("UnnecessaryLocalVariable") - List packages = new PackageList(this).getPackages(); - // Packages that cannot be autolinked yet can be added manually here, for AgoraExample: - // packages.add(new MyReactNativePackage()); - packages.add(new RCTAgoraRtcPackage()); - - return packages; - } - - @Override - protected String getJSMainModuleName() { - return "index"; - } - }; - - @Override - public ReactNativeHost getReactNativeHost() { - return mReactNativeHost; - } - - @Override - public void onCreate() { - super.onCreate(); - SoLoader.init(this, /* native exopackage */ false); - initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); // Remove this line if you don't want Flipper enabled - } - - /** - * Loads Flipper in React Native templates. - * - * @param context - */ - private static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { - if (BuildConfig.DEBUG) { - try { - /* - We use reflection here to pick up the class that initializes Flipper, - since Flipper library is not available in release mode - */ - Class aClass = Class.forName("com.reactnativeagoraExample.ReactNativeFlipper"); - aClass - .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) - .invoke(null, context, reactInstanceManager); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); - } - } - } -} diff --git a/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index a2f590828..000000000 Binary files a/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index 1b5239980..000000000 Binary files a/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index ff10afd6e..000000000 Binary files a/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index 115a4c768..000000000 Binary files a/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index dcd3cd808..000000000 Binary files a/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 459ca609d..000000000 Binary files a/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 8ca12fe02..000000000 Binary files a/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index 8e19b410a..000000000 Binary files a/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index b824ebdd4..000000000 Binary files a/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index 4c19a13c2..000000000 Binary files a/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/example/android/app/src/main/res/values/strings.xml b/example/android/app/src/main/res/values/strings.xml deleted file mode 100644 index e8e419ef0..000000000 --- a/example/android/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - Agora Example - diff --git a/example/android/app/src/main/res/values/styles.xml b/example/android/app/src/main/res/values/styles.xml deleted file mode 100644 index 9fab0be74..000000000 --- a/example/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/example/android/build.gradle b/example/android/build.gradle deleted file mode 100644 index 26bba24a5..000000000 --- a/example/android/build.gradle +++ /dev/null @@ -1,39 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - ext { - buildToolsVersion = "29.0.3" - minSdkVersion = 21 - compileSdkVersion = 29 - targetSdkVersion = 29 - ndkVersion = "20.1.5948944" - kotlinVersion = "1.3.72" - } - repositories { - google() - jcenter() - } - dependencies { - classpath("com.android.tools.build:gradle:4.1.0") - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -allprojects { - repositories { - mavenLocal() - maven { - // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm - url("$rootDir/../node_modules/react-native/android") - } - maven { - // Android JSC is installed from npm - url("$rootDir/../node_modules/jsc-android/dist") - } - - google() - jcenter() - maven { url 'https://www.jitpack.io' } - } -} diff --git a/example/android/gradle.properties b/example/android/gradle.properties deleted file mode 100644 index d21d03f2b..000000000 --- a/example/android/gradle.properties +++ /dev/null @@ -1,28 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true - -# AndroidX package structure to make it clearer which packages are bundled with the -# Android operating system, and which are packaged with your app's APK -# https://developer.android.com/topic/libraries/support-library/androidx-rn -android.useAndroidX=true -# Automatically convert third-party libraries to use AndroidX -android.enableJetifier=true - -# Version of flipper SDK to use with React Native -FLIPPER_VERSION=0.75.1 diff --git a/example/android/gradle/wrapper/gradle-wrapper.jar b/example/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 5c2d1cf01..000000000 Binary files a/example/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 14e30f741..000000000 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/example/android/gradlew b/example/android/gradlew deleted file mode 100755 index 4f906e0c8..000000000 --- a/example/android/gradlew +++ /dev/null @@ -1,185 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -exec "$JAVACMD" "$@" diff --git a/example/android/gradlew.bat b/example/android/gradlew.bat deleted file mode 100644 index 107acd32c..000000000 --- a/example/android/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/example/android/settings.gradle b/example/android/settings.gradle deleted file mode 100644 index ed8ccdd9a..000000000 --- a/example/android/settings.gradle +++ /dev/null @@ -1,6 +0,0 @@ -rootProject.name = 'AgoraExample' -apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) -include ':app' - -include ':react-native-agora' -project(':react-native-agora').projectDir = new File(rootProject.projectDir, '../../android') diff --git a/example/app.json b/example/app.json deleted file mode 100644 index e53420e6d..000000000 --- a/example/app.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "AgoraExample", - "displayName": "Agora Example" -} diff --git a/example/babel.config.js b/example/babel.config.js deleted file mode 100644 index db64a007b..000000000 --- a/example/babel.config.js +++ /dev/null @@ -1,16 +0,0 @@ -const path = require('path'); -const pak = require('../package.json'); - -module.exports = { - presets: ['module:metro-react-native-babel-preset'], - plugins: [ - [ - 'module-resolver', - { - alias: { - [pak.name]: path.join(__dirname, '..', pak.source), - }, - }, - ], - ], -}; diff --git a/example/index.js b/example/index.js deleted file mode 100644 index 117ddcae4..000000000 --- a/example/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import { AppRegistry } from 'react-native'; -import App from './src/App'; -import { name as appName } from './app.json'; - -AppRegistry.registerComponent(appName, () => App); diff --git a/example/ios/AgoraExample-Bridging-Header.h b/example/ios/AgoraExample-Bridging-Header.h deleted file mode 100644 index e11d920b1..000000000 --- a/example/ios/AgoraExample-Bridging-Header.h +++ /dev/null @@ -1,3 +0,0 @@ -// -// Use this file to import your target's public headers that you would like to expose to Swift. -// diff --git a/example/ios/AgoraExample.xcodeproj/project.pbxproj b/example/ios/AgoraExample.xcodeproj/project.pbxproj deleted file mode 100644 index 51f9f4d9f..000000000 --- a/example/ios/AgoraExample.xcodeproj/project.pbxproj +++ /dev/null @@ -1,501 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 0D1336C0461A88D01186E375 /* libPods-AgoraExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BCEA90A70F4BEAD7E9FA28B2 /* libPods-AgoraExample.a */; }; - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; - 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; - 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 20F357B024636CDF00C146DC /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20F357AF24636CDF00C146DC /* File.swift */; }; - F550788525DF9BB20027CF64 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F550788425DF9BB20027CF64 /* LaunchScreen.storyboard */; }; - F5A97F0625D3B42C00263532 /* Sound_Horizon.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = F5A97ED425D3ADDC00263532 /* Sound_Horizon.mp3 */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; - 13B07F961A680F5B00A75B9A /* AgoraExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AgoraExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = AgoraExample/AppDelegate.h; sourceTree = ""; }; - 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = AgoraExample/AppDelegate.m; sourceTree = ""; }; - 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = AgoraExample/Images.xcassets; sourceTree = ""; }; - 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = AgoraExample/Info.plist; sourceTree = ""; }; - 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = AgoraExample/main.m; sourceTree = ""; }; - 20F357AE24636CDF00C146DC /* AgoraExample-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "AgoraExample-Bridging-Header.h"; sourceTree = ""; }; - 20F357AF24636CDF00C146DC /* File.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = ""; }; - 4D7192F03A36A017E887435B /* Pods-AgoraExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AgoraExample.release.xcconfig"; path = "Target Support Files/Pods-AgoraExample/Pods-AgoraExample.release.xcconfig"; sourceTree = ""; }; - 871719007ECC5EAD276C345C /* Pods-AgoraExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AgoraExample.debug.xcconfig"; path = "Target Support Files/Pods-AgoraExample/Pods-AgoraExample.debug.xcconfig"; sourceTree = ""; }; - BCEA90A70F4BEAD7E9FA28B2 /* libPods-AgoraExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AgoraExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; - F550788425DF9BB20027CF64 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = AgoraExample/LaunchScreen.storyboard; sourceTree = ""; }; - F5A97ED425D3ADDC00263532 /* Sound_Horizon.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = Sound_Horizon.mp3; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 0D1336C0461A88D01186E375 /* libPods-AgoraExample.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 13B07FAE1A68108700A75B9A /* AgoraExample */ = { - isa = PBXGroup; - children = ( - 008F07F21AC5B25A0029DE68 /* main.jsbundle */, - 13B07FAF1A68108700A75B9A /* AppDelegate.h */, - 13B07FB01A68108700A75B9A /* AppDelegate.m */, - 13B07FB51A68108700A75B9A /* Images.xcassets */, - 13B07FB61A68108700A75B9A /* Info.plist */, - F550788425DF9BB20027CF64 /* LaunchScreen.storyboard */, - 13B07FB71A68108700A75B9A /* main.m */, - ); - name = AgoraExample; - sourceTree = ""; - }; - 1CFFDEF7170271C97B8B7E5A /* Pods */ = { - isa = PBXGroup; - children = ( - 871719007ECC5EAD276C345C /* Pods-AgoraExample.debug.xcconfig */, - 4D7192F03A36A017E887435B /* Pods-AgoraExample.release.xcconfig */, - ); - path = Pods; - sourceTree = ""; - }; - 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { - isa = PBXGroup; - children = ( - ED297162215061F000B7C4FE /* JavaScriptCore.framework */, - BCEA90A70F4BEAD7E9FA28B2 /* libPods-AgoraExample.a */, - ); - name = Frameworks; - sourceTree = ""; - }; - 832341AE1AAA6A7D00B99B32 /* Libraries */ = { - isa = PBXGroup; - children = ( - ); - name = Libraries; - sourceTree = ""; - }; - 83CBB9F61A601CBA00E9B192 = { - isa = PBXGroup; - children = ( - 20F357AF24636CDF00C146DC /* File.swift */, - 20F357AE24636CDF00C146DC /* AgoraExample-Bridging-Header.h */, - 13B07FAE1A68108700A75B9A /* AgoraExample */, - 832341AE1AAA6A7D00B99B32 /* Libraries */, - 83CBBA001A601CBA00E9B192 /* Products */, - 2D16E6871FA4F8E400B85C8A /* Frameworks */, - F5A97ED525D3ADEF00263532 /* Resources */, - 1CFFDEF7170271C97B8B7E5A /* Pods */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 83CBBA001A601CBA00E9B192 /* Products */ = { - isa = PBXGroup; - children = ( - 13B07F961A680F5B00A75B9A /* AgoraExample.app */, - ); - name = Products; - sourceTree = ""; - }; - F5A97ED525D3ADEF00263532 /* Resources */ = { - isa = PBXGroup; - children = ( - F5A97ED425D3ADDC00263532 /* Sound_Horizon.mp3 */, - ); - path = Resources; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 13B07F861A680F5B00A75B9A /* AgoraExample */ = { - isa = PBXNativeTarget; - buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "AgoraExample" */; - buildPhases = ( - CCCC07BCAFDEF1FCADC0D0C9 /* [CP] Check Pods Manifest.lock */, - FD10A7F022414F080027D42C /* Start Packager */, - 13B07F871A680F5B00A75B9A /* Sources */, - 13B07F8C1A680F5B00A75B9A /* Frameworks */, - 13B07F8E1A680F5B00A75B9A /* Resources */, - 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, - 784B7493D27387E7554188B3 /* [CP] Embed Pods Frameworks */, - 6D3DD787D9DAA9B0C5163B24 /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = AgoraExample; - productName = AgoraExample; - productReference = 13B07F961A680F5B00A75B9A /* AgoraExample.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 83CBB9F71A601CBA00E9B192 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 13B07F861A680F5B00A75B9A = { - DevelopmentTeam = GM72UGLGZW; - LastSwiftMigration = 1110; - ProvisioningStyle = Manual; - }; - }; - }; - buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "AgoraExample" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - English, - en, - Base, - ); - mainGroup = 83CBB9F61A601CBA00E9B192; - productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 13B07F861A680F5B00A75B9A /* AgoraExample */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 13B07F8E1A680F5B00A75B9A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F5A97F0625D3B42C00263532 /* Sound_Horizon.mp3 in Resources */, - F550788525DF9BB20027CF64 /* LaunchScreen.storyboard in Resources */, - 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Bundle React Native code and images"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; - }; - 6D3DD787D9DAA9B0C5163B24 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-AgoraExample/Pods-AgoraExample-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AgoraExample/Pods-AgoraExample-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 784B7493D27387E7554188B3 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-AgoraExample/Pods-AgoraExample-frameworks.sh", - "${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", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraDav1dExtension/AgoraDav1dExtension.framework/AgoraDav1dExtension", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL/OpenSSL.framework/OpenSSL", - ); - 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}/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", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraDav1dExtension.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OpenSSL.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AgoraExample/Pods-AgoraExample-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - CCCC07BCAFDEF1FCADC0D0C9 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-AgoraExample-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - FD10A7F022414F080027D42C /* Start Packager */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = "Start Packager"; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 13B07F871A680F5B00A75B9A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, - 20F357B024636CDF00C146DC /* File.swift in Sources */, - 13B07FC11A68108700A75B9A /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 13B07F941A680F5B00A75B9A /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 871719007ECC5EAD276C345C /* Pods-AgoraExample.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 1; - DEAD_CODE_STRIPPING = NO; - DEVELOPMENT_TEAM = GM72UGLGZW; - INFOPLIST_FILE = AgoraExample/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_CFLAGS = ( - "$(inherited)", - "-DFB_SONARKIT_ENABLED=1", - ); - OTHER_LDFLAGS = ( - "$(inherited)", - "-ObjC", - "-lc++", - ); - PRODUCT_BUNDLE_IDENTIFIER = io.agora.react.AgoraExample; - PRODUCT_NAME = AgoraExample; - PROVISIONING_PROFILE_SPECIFIER = App; - SWIFT_OBJC_BRIDGING_HEADER = "AgoraExample-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Debug; - }; - 13B07F951A680F5B00A75B9A /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 4D7192F03A36A017E887435B /* Pods-AgoraExample.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = GM72UGLGZW; - INFOPLIST_FILE = AgoraExample/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_CFLAGS = ( - "$(inherited)", - "-DFB_SONARKIT_ENABLED=1", - ); - OTHER_LDFLAGS = ( - "$(inherited)", - "-ObjC", - "-lc++", - ); - PRODUCT_BUNDLE_IDENTIFIER = io.agora.react.AgoraExample; - PRODUCT_NAME = AgoraExample; - PROVISIONING_PROFILE_SPECIFIER = App; - SWIFT_OBJC_BRIDGING_HEADER = "AgoraExample-Bridging-Header.h"; - SWIFT_VERSION = 4.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Release; - }; - 83CBBA201A601CBA00E9B192 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 "; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 83CBBA211A601CBA00E9B192 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 "; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "AgoraExample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 13B07F941A680F5B00A75B9A /* Debug */, - 13B07F951A680F5B00A75B9A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "AgoraExample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 83CBBA201A601CBA00E9B192 /* Debug */, - 83CBBA211A601CBA00E9B192 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; -} diff --git a/example/ios/AgoraExample.xcodeproj/xcshareddata/xcschemes/AgoraExample.xcscheme b/example/ios/AgoraExample.xcodeproj/xcshareddata/xcschemes/AgoraExample.xcscheme deleted file mode 100644 index de8cf2a97..000000000 --- a/example/ios/AgoraExample.xcodeproj/xcshareddata/xcschemes/AgoraExample.xcscheme +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/ios/AgoraExample.xcworkspace/contents.xcworkspacedata b/example/ios/AgoraExample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 59283523c..000000000 --- a/example/ios/AgoraExample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/example/ios/AgoraExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/ios/AgoraExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003..000000000 --- a/example/ios/AgoraExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/example/ios/AgoraExample/AppDelegate.h b/example/ios/AgoraExample/AppDelegate.h deleted file mode 100644 index 2726d5e13..000000000 --- a/example/ios/AgoraExample/AppDelegate.h +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -@interface AppDelegate : UIResponder - -@property (nonatomic, strong) UIWindow *window; - -@end diff --git a/example/ios/AgoraExample/AppDelegate.m b/example/ios/AgoraExample/AppDelegate.m deleted file mode 100644 index 57923b718..000000000 --- a/example/ios/AgoraExample/AppDelegate.m +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "AppDelegate.h" - -#import -#import -#import - -#ifdef FB_SONARKIT_ENABLED -#import -#import -#import -#import -#import -#import -static void InitializeFlipper(UIApplication *application) { - FlipperClient *client = [FlipperClient sharedClient]; - SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; - [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; - [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; - [client addPlugin:[FlipperKitReactPlugin new]]; - [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; - [client start]; -} -#endif - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - #ifdef FB_SONARKIT_ENABLED - InitializeFlipper(application); - #endif - RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; - RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge - moduleName:@"AgoraExample" - initialProperties:nil]; - - if (@available(iOS 13.0, *)) { - rootView.backgroundColor = [UIColor systemBackgroundColor]; - } else { - rootView.backgroundColor = [UIColor whiteColor]; - } - - self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - UIViewController *rootViewController = [UIViewController new]; - rootViewController.view = rootView; - self.window.rootViewController = rootViewController; - [self.window makeKeyAndVisible]; - return YES; -} - -- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge -{ -#if DEBUG - return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; -#else - return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; -#endif -} - -@end diff --git a/example/ios/AgoraExample/Images.xcassets/AppIcon.appiconset/Contents.json b/example/ios/AgoraExample/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 81213230d..000000000 --- a/example/ios/AgoraExample/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "scale" : "2x", - "size" : "20x20" - }, - { - "idiom" : "iphone", - "scale" : "3x", - "size" : "20x20" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "size" : "29x29" - }, - { - "idiom" : "iphone", - "scale" : "3x", - "size" : "29x29" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "size" : "40x40" - }, - { - "idiom" : "iphone", - "scale" : "3x", - "size" : "40x40" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "size" : "60x60" - }, - { - "idiom" : "iphone", - "scale" : "3x", - "size" : "60x60" - }, - { - "idiom" : "ios-marketing", - "scale" : "1x", - "size" : "1024x1024" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/example/ios/AgoraExample/Images.xcassets/Contents.json b/example/ios/AgoraExample/Images.xcassets/Contents.json deleted file mode 100644 index 2d92bd53f..000000000 --- a/example/ios/AgoraExample/Images.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/example/ios/AgoraExample/Info.plist b/example/ios/AgoraExample/Info.plist deleted file mode 100644 index 7361dfb89..000000000 --- a/example/ios/AgoraExample/Info.plist +++ /dev/null @@ -1,61 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - Agora Example - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - NSExceptionDomains - - localhost - - NSExceptionAllowsInsecureHTTPLoads - - - - - NSCameraUsageDescription - Camera - NSLocationWhenInUseUsageDescription - - NSMicrophoneUsageDescription - Microphone - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIViewControllerBasedStatusBarAppearance - - - diff --git a/example/ios/AgoraExample/LaunchScreen.storyboard b/example/ios/AgoraExample/LaunchScreen.storyboard deleted file mode 100644 index cd794e3aa..000000000 --- a/example/ios/AgoraExample/LaunchScreen.storyboard +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/ios/AgoraExample/main.m b/example/ios/AgoraExample/main.m deleted file mode 100644 index c316cf816..000000000 --- a/example/ios/AgoraExample/main.m +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/example/ios/File.swift b/example/ios/File.swift deleted file mode 100644 index aae0fbc1a..000000000 --- a/example/ios/File.swift +++ /dev/null @@ -1,6 +0,0 @@ -// -// File.swift -// AgoraExample -// - -import Foundation diff --git a/example/ios/Podfile b/example/ios/Podfile deleted file mode 100644 index ab6e0b405..000000000 --- a/example/ios/Podfile +++ /dev/null @@ -1,26 +0,0 @@ -require_relative '../node_modules/react-native/scripts/react_native_pods' -require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' - -platform :ios, '10.0' - -target 'AgoraExample' do - config = use_native_modules! - - use_react_native!( - :path => config[:reactNativePath], - # to enable hermes on iOS, change `false` to `true` and then install pods - :hermes_enabled => false - ) - - pod 'react-native-agora', :path => '../..' - - # Enables Flipper. - # - # Note that if you have use_frameworks! enabled, Flipper will not work and - # you should disable the next line. - use_flipper!({ 'Flipper' => '0.75.1' }) - - post_install do |installer| - react_native_post_install(installer) - end -end diff --git a/example/ios/Resources/Sound_Horizon.mp3 b/example/ios/Resources/Sound_Horizon.mp3 deleted file mode 100644 index 8f4cdb876..000000000 Binary files a/example/ios/Resources/Sound_Horizon.mp3 and /dev/null differ diff --git a/example/metro.config.js b/example/metro.config.js deleted file mode 100644 index d1f468ab0..000000000 --- a/example/metro.config.js +++ /dev/null @@ -1,40 +0,0 @@ -const path = require('path'); -const blacklist = require('metro-config/src/defaults/blacklist'); -const escape = require('escape-string-regexp'); -const pak = require('../package.json'); - -const root = path.resolve(__dirname, '..'); - -const modules = Object.keys({ - ...pak.peerDependencies, -}); - -module.exports = { - projectRoot: __dirname, - watchFolders: [root], - - // We need to make sure that only one version is loaded for peerDependencies - // So we blacklist them at the root, and alias them to the versions in example's node_modules - resolver: { - blacklistRE: blacklist( - modules.map( - (m) => - new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`) - ) - ), - - extraNodeModules: modules.reduce((acc, name) => { - acc[name] = path.join(__dirname, 'node_modules', name); - return acc; - }, {}), - }, - - transformer: { - getTransformOptions: async () => ({ - transform: { - experimentalImportSupport: false, - inlineRequires: true, - }, - }), - }, -}; diff --git a/example/package.json b/example/package.json deleted file mode 100644 index 03b166b7d..000000000 --- a/example/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "react-native-agora-example", - "description": "Example app for react-native-agora", - "version": "0.0.1", - "private": true, - "scripts": { - "android": "react-native run-android", - "ios": "react-native run-ios", - "start": "react-native start" - }, - "dependencies": { - "@react-native-community/masked-view": "^0.1.10", - "@react-navigation/native": "^5.7.1", - "@react-navigation/stack": "^5.7.1", - "react": "17.0.1", - "react-native": "0.64.0", - "react-native-fs": "^2.16.6", - "react-native-gesture-handler": "^1.7.0", - "react-native-reanimated": "^1.10.1", - "react-native-safe-area-context": "^3.1.1", - "react-native-screens": "^2.9.0" - }, - "devDependencies": { - "@babel/core": "^7.12.9", - "@babel/runtime": "^7.12.5", - "babel-plugin-module-resolver": "^4.1.0", - "metro-react-native-babel-preset": "^0.64.0", - "react-test-renderer": "17.0.1" - } -} diff --git a/example/src/App.tsx b/example/src/App.tsx deleted file mode 100644 index d252b2335..000000000 --- a/example/src/App.tsx +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Sample React Native App - * https://github.com/facebook/react-native - * - * Generated with the TypeScript template - * https://github.com/react-native-community/react-native-template-typescript - * - * @format - */ - -import React from 'react'; -import { - SafeAreaView, - StyleSheet, - SectionList, - Text, - View, - TouchableOpacity, -} from 'react-native'; - -import { NavigationContainer } from '@react-navigation/native'; -import { createStackNavigator } from '@react-navigation/stack'; - -import Basic from './examples/basic'; -import Advanced from './examples/advanced'; - -const Stack = createStackNavigator(); - -const DATA = [Basic, Advanced]; - -const App = () => { - return ( - - - - {DATA.map((value) => - // @ts-ignore - value.data.map(({ name, component }) => ( - - )) - )} - - - ); -}; - -// @ts-ignore -const Home = ({ navigation }) => { - return ( - - item.name + index} - renderItem={({ item }) => } - renderSectionHeader={({ section: { title } }) => ( - {title} - )} - /> - - ); -}; - -// @ts-ignore -const Item = ({ item, navigation }) => ( - - navigation.navigate(item.name)}> - {item.name} - - -); - -const styles = StyleSheet.create({ - container: { - flex: 1, - }, - header: { - padding: 10, - fontSize: 24, - color: 'white', - backgroundColor: 'grey', - }, - item: { - padding: 15, - }, - title: { - fontSize: 24, - color: 'black', - }, -}); - -export default App; diff --git a/example/src/examples/advanced/MultiChannel.tsx b/example/src/examples/advanced/MultiChannel.tsx deleted file mode 100644 index ca426f2cb..000000000 --- a/example/src/examples/advanced/MultiChannel.tsx +++ /dev/null @@ -1,276 +0,0 @@ -import React, { Component } from 'react'; -import { - Button, - PermissionsAndroid, - Platform, - ScrollView, - StyleSheet, - View, -} from 'react-native'; - -import RtcEngine, { - ChannelMediaOptions, - ChannelProfile, - ClientRole, - RtcChannel, - RtcEngineConfig, - RtcLocalView, - RtcRemoteView, - VideoRemoteState, -} from 'react-native-agora'; - -const config = require('../../../agora.config.json'); - -interface State { - renderChannelId: string; - isJoined0: boolean; - isJoined1: boolean; - remoteUid0: number[]; - remoteUid1: number[]; -} - -const channelId0 = 'channel0'; -const channelId1 = 'channel1'; - -export default class MultiChannel extends Component<{}, State, any> { - _engine: RtcEngine | undefined; - _channel0: RtcChannel | undefined; - _channel1: RtcChannel | undefined; - - constructor(props: {}) { - super(props); - this.state = { - renderChannelId: channelId0, - isJoined0: false, - isJoined1: false, - remoteUid0: [], - remoteUid1: [], - }; - } - - UNSAFE_componentWillMount() { - this._initEngine(); - } - - componentWillUnmount() { - this._engine?.destroy(); - } - - _initEngine = async () => { - this._engine = await RtcEngine.createWithConfig( - new RtcEngineConfig(config.appId) - ); - - await this._engine.enableVideo(); - await this._engine.startPreview(); - await this._engine.setChannelProfile(ChannelProfile.LiveBroadcasting); - await this._engine.setClientRole(ClientRole.Broadcaster); - }; - - _joinChannel0 = async () => { - if (Platform.OS === 'android') { - await PermissionsAndroid.requestMultiple([ - PermissionsAndroid.PERMISSIONS.RECORD_AUDIO, - PermissionsAndroid.PERMISSIONS.CAMERA, - ]); - } - - this._channel0 = await RtcChannel.create(channelId0); - this._addListener(this._channel0); - - await this._channel0.setClientRole(ClientRole.Broadcaster); - await this._channel0.joinChannel( - null, - null, - 0, - new ChannelMediaOptions(true, true) - ); - }; - - _joinChannel1 = async () => { - if (Platform.OS === 'android') { - await PermissionsAndroid.requestMultiple([ - PermissionsAndroid.PERMISSIONS.RECORD_AUDIO, - PermissionsAndroid.PERMISSIONS.CAMERA, - ]); - } - - this._channel1 = await RtcChannel.create(channelId1); - this._addListener(this._channel1); - - await this._channel1.setClientRole(ClientRole.Broadcaster); - await this._channel1.joinChannel( - null, - null, - 0, - new ChannelMediaOptions(true, true) - ); - }; - - _addListener = (rtcChannel: RtcChannel) => { - const { channelId } = rtcChannel; - rtcChannel.addListener('JoinChannelSuccess', (channel, uid, elapsed) => { - console.info('JoinChannelSuccess', channel, uid, elapsed); - if (channelId === channelId0) { - this.setState({ isJoined0: true }); - } else if (channelId === channelId1) { - this.setState({ isJoined1: true }); - } - }); - rtcChannel.addListener('UserJoined', (uid, elapsed) => { - console.info('UserJoined', channelId, uid, elapsed); - }); - rtcChannel.addListener('UserOffline', (uid, reason) => { - console.info('UserOffline', channelId, uid, reason); - }); - rtcChannel.addListener('LeaveChannel', (stats) => { - console.info('LeaveChannel', channelId, stats); - if (channelId === channelId0) { - this.setState({ isJoined0: false, remoteUid0: [] }); - } else if (channelId === channelId1) { - this.setState({ isJoined1: false, remoteUid1: [] }); - } - }); - rtcChannel.addListener( - 'RemoteVideoStateChanged', - (uid, state, reason, elapsed) => { - console.info('RemoteVideoStateChanged', uid, state, reason, elapsed); - if (state === VideoRemoteState.Starting) { - if (channelId === channelId0) { - this.setState({ remoteUid0: [...this.state.remoteUid0, uid] }); - } else if (channelId === channelId1) { - this.setState({ remoteUid1: [...this.state.remoteUid1, uid] }); - } - } else if (state === VideoRemoteState.Stopped) { - if (channelId === channelId0) { - this.setState({ - remoteUid0: this.state.remoteUid0.filter( - (value) => value !== uid - ), - }); - } else if (channelId === channelId1) { - this.setState({ - remoteUid1: this.state.remoteUid1.filter( - (value) => value !== uid - ), - }); - } - } - } - ); - }; - - _publishChannel0 = async () => { - await this._channel1?.unpublish(); - await this._channel0?.publish(); - }; - - _publishChannel1 = async () => { - await this._channel0?.unpublish(); - await this._channel1?.publish(); - }; - - _leaveChannel0 = async () => { - await this._channel0?.leaveChannel(); - }; - - _leaveChannel1 = async () => { - await this._channel1?.leaveChannel(); - }; - - render() { - const { isJoined0, isJoined1 } = this.state; - return ( - - -