Skip to content

Commit

Permalink
fix: optimize getAudioFileInfo & selectAudioTrack (#526)
Browse files Browse the repository at this point in the history
* Squashed 'android/src/main/java/io/agora/rtc/base/' changes from 21c7655..fbf0147

fbf0147 fix: getAudioFileInfo & selectAudioTrack
987de50 feat: support 3.5.2
4ebf77c feat: support 3.5.1 & plugin
27c788c chore: mapToColor
0278629 feat: support 3.5.0.2
45dcd16 chore: add API which is missing
58ca4b0 fix: AudioRecordingConfiguration bug
4a32e12 chore: prepare to migrate to iris
276c9fe chore: support 3.4.5
783aecf chore: add ERR_ALREADY_IN_RECORDING
3aed6ce fix: startAudioRecording bug
510b405 chore: optimize
4f801b9 chore: optimize
ab71f52 chore: optimize startAudioRecording
07f81c7 chore: optimize
5a20e13 style: optimize
858b58f fix(uid compatible): int to uint
8d14d2d feat(upgrade): 3.4.1
be5efea Merge pull request #4 from AgoraLibrary/dev/3.3.0
382f858 Merge branch 'master' into dev/3.3.0
8671535 Merge pull request #3 from AgoraLibrary/dev/3.2.0
feabda3 Merge branch 'master' into dev/3.2.0
9e57891 Merge pull request #2 from AgoraLibrary/dev/3.1.0
df303ee fix: merge some bug fix
cd7a2cd feat: support 3.3.1 for Android
551ebfe fix: annotation build warning
9c48594 feat: support 3.3.0 for Android
de52ca6 Merge branch 'master' into dev/3.2.0
ddeaefb Merge branch 'master' into dev/3.2.0
2fef3ae feat: add `setClientRole(role: ClientRole, options?: ClientRoleOptions): Promise<void>`
fcb57cc feat: upgrade to 3.2.0
REVERT: 21c7655 feat: support 3.0.+

git-subtree-dir: android/src/main/java/io/agora/rtc/base
git-subtree-split: fbf0147a1ba57f0eabe9c5b54fffeec83a7e2c14

* Squashed 'ios/Classes/Base/' changes from b664522..40fe426

40fe426 fix: getAudioFileInfo & selectAudioTrack
9d52a5f fix: build failed on other platform
a7ddd5e style: format
6db7748 feat: support 3.5.2
325c233 feat: support 3.5.1 & plugin
d4e2686 fix: mapToEncryptionConfig crash
f4be532 fix: compiler error
4eb127f chore: support 3.5.0.2
3c32dc5 chore: add API which is missing
3bb9210 fix: API call error
732df69 feat: support 3.4.6
782ec46 chore: prepare to migrate to iris
ba7fba7 chore: support 3.4.5
f25a603 fix: startAudioRecording bug
02b6cc3 chore: optimize startAudioRecording
88b3d59 style: format code
b60a451 Merge pull request #6 from AgoraLibrary/main/3.4.+
d1561f7 feat(upgrade): 3.4.1
bb84006 Merge pull request #5 from AgoraLibrary/main/3.3.+
4623dc3 fix: getErrorDescription key error
ee40ba1 Merge pull request #4 from AgoraLibrary/dev/3.3.0
f8bde68 Merge branch 'master' into dev/3.3.0
0db518f Merge pull request #3 from AgoraLibrary/dev/3.2.0
5f69768 Merge branch 'master' into dev/3.2.0
d355c51 Merge pull request #2 from AgoraLibrary/dev/3.1.0
a81db07 fix: merge some bug fix
2d1ac8f fix: iOS selector error
98c4331 fix: type cast error
836f3b4 feat: support 3.3.1 for iOS
b422ce8 feat: support 3.3.0 for iOS
c8a08e5 Merge branch 'master' into dev/3.2.0
561b3fd Merge branch 'master' into dev/3.2.0
da3222a Merge branch 'master' into dev/3.2.0
3a55997 feat: add `setClientRole(role: ClientRole, options?: ClientRoleOptions): Promise<void>`
4ee51a9 feat: upgrade to 3.2.0
REVERT: b664522 fix: merge error
REVERT: ed3b61b feat: support 3.0.+

git-subtree-dir: ios/Classes/Base
git-subtree-split: 40fe42656eea7efdb588fb7495ad7a452a804c0b

* merge: iOS 3.5.2

* fix: `getAudioFileInfo` & `selectAudioTrack`
  • Loading branch information
LichKing-2234 authored Dec 14, 2021
1 parent d561c43 commit 6697f78
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 109 deletions.
7 changes: 2 additions & 5 deletions android/src/main/java/io/agora/rtc/base/RtcEngine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -848,10 +848,7 @@ open class RtcEngineManager(
}

override fun getAudioFileInfo(params: Map<String, *>, callback: Callback) {
(params["filePath"] as? String)?.let { file ->
callback.code(engine?.getAudioFileInfo(file)) { it }
return@getAudioFileInfo
}
callback.code(engine?.getAudioFileInfo(params["filePath"] as String))
}

override fun getAudioMixingCurrentPosition(callback: Callback) {
Expand All @@ -875,7 +872,7 @@ open class RtcEngineManager(
}

override fun selectAudioTrack(params: Map<String, *>, callback: Callback) {
callback.code(engine?.selectAudioTrack((params["audioIndex"] as Number).toInt()))
callback.code(engine?.selectAudioTrack((params["index"] as Number).toInt()))
}

override fun setAudioMixingDualMonoMode(params: Map<String, *>, callback: Callback) {
Expand Down
9 changes: 1 addition & 8 deletions example/ios/Runner/Runner-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
#import "GeneratedPluginRegistrant.h"

#if __has_include(<agora_rtc_engine/RtcEnginePlugin.h>)
#import <agora_rtc_engine/RtcEnginePlugin.h>
#endif
#if __has_include(<agora_rtc_engine/RtcEnginePluginRegistrant.h>)
#import <agora_rtc_engine/RtcEnginePluginRegistrant.h>
#endif

#import "CustomCaptureAudio.h"
#import "ExternalAudio.h"


@import agora_rtc_engine;
3 changes: 2 additions & 1 deletion example/ios/RunnerTests/OCTestRtcEnginePlugin.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import <Flutter/Flutter.h>
#import <RtcEnginePlugin.h>

@import agora_rtc_engine;

@interface OCTestRtcEnginePlugin : NSObject<RtcEnginePlugin>
@property bool isRtcEngineCreated;
Expand Down
2 changes: 0 additions & 2 deletions example/ios/RunnerTests/OCTestRtcEnginePlugin.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#import <Foundation/Foundation.h>
#import "OCTestRtcEnginePlugin.h"
#import "RtcEnginePluginRegistrant.h"
#import "RtcEnginePlugin.h"

@implementation OCTestRtcEnginePlugin

Expand Down
32 changes: 19 additions & 13 deletions example/ios/fastlane/README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,43 @@
fastlane documentation
================
----

# Installation

Make sure you have the latest version of the Xcode command line tools installed:

```
```sh
xcode-select --install
```

Install _fastlane_ using
```
[sudo] gem install fastlane -NV
```
or alternatively using `brew install fastlane`
For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane)

# Available Actions

### tests
```
fastlane tests

```sh
[bundle exec] fastlane tests
```



----


## iOS

### ios custom_lane

```sh
[bundle exec] fastlane ios custom_lane
```
fastlane ios custom_lane
```

Description of what the lane does

----

This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
More information about fastlane can be found on [fastlane.tools](https://fastlane.tools).
The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools).

More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools).

The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools).
25 changes: 10 additions & 15 deletions ios/Classes/Base/RtcEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protocol RtcEngineInterface:
func setLocalAccessPoint(_ params: NSDictionary, _ callback: Callback)

func enableVirtualBackground(_ params: NSDictionary, _ callback: Callback)

func takeSnapshot(_ params: NSDictionary, _ callback: Callback)
}

Expand Down Expand Up @@ -180,7 +180,7 @@ protocol RtcEngineAudioMixingInterface {
func getAudioMixingPublishVolume(_ callback: Callback)

func getAudioMixingDuration(_ params: NSDictionary, _ callback: Callback)

func getAudioFileInfo(_ params: NSDictionary, _ callback: Callback)

func getAudioMixingCurrentPosition(_ callback: Callback)
Expand Down Expand Up @@ -725,14 +725,9 @@ class RtcEngineManager: NSObject, RtcEngineInterface {
$0
}
}

@objc func getAudioFileInfo(_ params: NSDictionary, _ callback: Callback) {
if let filePath = (params["filePath"] as? String) {
callback.code(engine?.getAudioFileInfo(filePath)) {
$0
}
return
}
callback.code(engine?.getAudioFileInfo(params["filePath"] as! String))
}

@objc func getAudioMixingCurrentPosition(_ callback: Callback) {
Expand All @@ -748,21 +743,21 @@ class RtcEngineManager: NSObject, RtcEngineInterface {
@objc func setAudioMixingPitch(_ params: NSDictionary, _ callback: Callback) {
callback.code(engine?.setAudioMixingPitch((params["pitch"] as! NSNumber).intValue))
}

@objc func setAudioMixingPlaybackSpeed(_ params: NSDictionary, _ callback: Callback) {
callback.code(engine?.setAudioMixingPlaybackSpeed(Int32((params["speed"] as! NSNumber).intValue)))
}

@objc func getAudioTrackCount(_ callback: Callback) {
callback.code(engine?.getAudioTrackCount()) {
$0
}
}

@objc func selectAudioTrack(_ params: NSDictionary, _ callback: Callback) {
callback.code(engine?.selectAudioTrack((params["audioIndex"] as! NSNumber).intValue))
callback.code(engine?.selectAudioTrack((params["index"] as! NSNumber).intValue))
}

@objc func setAudioMixingDualMonoMode(_ params: NSDictionary, _ callback: Callback) {
let mode = AgoraAudioMixingDualMonoMode(rawValue: UInt((params["mode"] as! NSNumber).intValue))
callback.code(engine?.setAudioMixingDualMonoMode(mode!))
Expand Down Expand Up @@ -1222,7 +1217,7 @@ class RtcEngineManager: NSObject, RtcEngineInterface {
@objc func enableVirtualBackground(_ params: NSDictionary, _ callback: Callback) {
callback.code(engine?.enableVirtualBackground(params["enabled"] as! Bool, backData: mapToVirtualBackgroundSource(params["backgroundSource"] as! [String: Any])))
}

@objc func takeSnapshot(_ params: NSDictionary, _ callback: Callback) {
var code: Int32?
if let ret = engine?.takeSnapshot(params["channel"] as! String, uid: (params["uid"] as! NSNumber).intValue, filePath: params["filePath"] as! String) {
Expand Down
25 changes: 0 additions & 25 deletions ios/Classes/Base/RtcEnginePluginRegistrant.h

This file was deleted.

22 changes: 0 additions & 22 deletions ios/Classes/Base/RtcEnginePluginRegistrant.m

This file was deleted.

22 changes: 22 additions & 0 deletions ios/Classes/Base/RtcEnginePluginRegistrant.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Foundation

/**
* Class for register the `RtcEnginePlugin`.
*/
@objc
public class RtcEnginePluginRegistrant: NSObject {
/**
* Register a `RtcEnginePlugin`. The `plugin` will be called when the `RtcEngine` is created from
* flutter side.
*/
@objc public static func register(_ plugin: RtcEnginePlugin) {
RtcEngineRegistry.shared.add(plugin)
}

/**
* Unregister a previously registered `RtcEnginePlugin`.
*/
@objc public static func unregister(_ plugin: RtcEnginePlugin) {
RtcEngineRegistry.shared.remove(plugin)
}
}
11 changes: 0 additions & 11 deletions ios/Classes/Base/RtcEnginePluginRegistrantSwift.swift

This file was deleted.

14 changes: 7 additions & 7 deletions lib/src/rtc_engine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ class RtcEngine with RtcEngineInterface {
}

@override
Future<int?> getAudioFileInfo(String filePath) {
Future<void> getAudioFileInfo(String filePath) {
return _invokeMethod('getAudioFileInfo', {
'filePath': filePath,
});
Expand Down Expand Up @@ -1152,9 +1152,9 @@ class RtcEngine with RtcEngineInterface {
}

@override
Future<void> selectAudioTrack(int audioIndex) {
Future<void> selectAudioTrack(int index) {
return _invokeMethod('selectAudioTrack', {
'audioIndex': audioIndex,
'index': index,
});
}

Expand Down Expand Up @@ -2225,7 +2225,7 @@ mixin RtcAudioMixingInterface {
/// **Returns**
/// - 0: Success.
/// - < 0: Failure.
Future<int?> getAudioFileInfo(String filePath);
Future<void> getAudioFileInfo(String filePath);

/// Gets the playback position of the audio file.
///
Expand Down Expand Up @@ -2286,8 +2286,8 @@ mixin RtcAudioMixingInterface {
/// - < 0: Failure.
Future<int?> getAudioTrackCount();

/// Specifies the playback track [audioIndex] of the current music file. The
/// [audioIndex] must be less than or equal to the return value of [getAudioTrackCount].
/// Specifies the playback track [index] of the current music file. The
/// [index] must be less than or equal to the return value of [getAudioTrackCount].
///
/// After getting the audio track index of the current music file, call this
/// method to specify any audio track to play. For example, if different tracks
Expand All @@ -2300,7 +2300,7 @@ mixin RtcAudioMixingInterface {
/// code [AudioMixingStateCode.Playing].
/// - For the audio file formats supported by this method, see
/// [What formats of audio files does the Agora RTC SDK support](https://docs.agora.io/en/faq/audio_format).
Future<void> selectAudioTrack(int audioIndex);
Future<void> selectAudioTrack(int index);

/// Sets the channel [mode] of the current music file.
///
Expand Down

0 comments on commit 6697f78

Please sign in to comment.