diff --git a/android/src/main/java/io/agora/rtc/base/RtcEngine.kt b/android/src/main/java/io/agora/rtc/base/RtcEngine.kt index 43a445780..ab510b994 100644 --- a/android/src/main/java/io/agora/rtc/base/RtcEngine.kt +++ b/android/src/main/java/io/agora/rtc/base/RtcEngine.kt @@ -848,10 +848,7 @@ open class RtcEngineManager( } override fun getAudioFileInfo(params: Map, 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) { @@ -875,7 +872,7 @@ open class RtcEngineManager( } override fun selectAudioTrack(params: Map, 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, callback: Callback) { diff --git a/example/ios/Runner/Runner-Bridging-Header.h b/example/ios/Runner/Runner-Bridging-Header.h index ebe17a1b2..06af07aec 100644 --- a/example/ios/Runner/Runner-Bridging-Header.h +++ b/example/ios/Runner/Runner-Bridging-Header.h @@ -1,13 +1,6 @@ #import "GeneratedPluginRegistrant.h" -#if __has_include() -#import -#endif -#if __has_include() -#import -#endif - #import "CustomCaptureAudio.h" #import "ExternalAudio.h" - +@import agora_rtc_engine; diff --git a/example/ios/RunnerTests/OCTestRtcEnginePlugin.h b/example/ios/RunnerTests/OCTestRtcEnginePlugin.h index eecd1dfdf..ad758d2f3 100644 --- a/example/ios/RunnerTests/OCTestRtcEnginePlugin.h +++ b/example/ios/RunnerTests/OCTestRtcEnginePlugin.h @@ -1,5 +1,6 @@ #import -#import + +@import agora_rtc_engine; @interface OCTestRtcEnginePlugin : NSObject @property bool isRtcEngineCreated; diff --git a/example/ios/RunnerTests/OCTestRtcEnginePlugin.m b/example/ios/RunnerTests/OCTestRtcEnginePlugin.m index ea525cebe..0096cd7ee 100644 --- a/example/ios/RunnerTests/OCTestRtcEnginePlugin.m +++ b/example/ios/RunnerTests/OCTestRtcEnginePlugin.m @@ -1,7 +1,5 @@ #import #import "OCTestRtcEnginePlugin.h" -#import "RtcEnginePluginRegistrant.h" -#import "RtcEnginePlugin.h" @implementation OCTestRtcEnginePlugin diff --git a/example/ios/fastlane/README.md b/example/ios/fastlane/README.md index ae91289f0..823febf92 100644 --- a/example/ios/fastlane/README.md +++ b/example/ios/fastlane/README.md @@ -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). diff --git a/ios/Classes/Base/RtcEngine.swift b/ios/Classes/Base/RtcEngine.swift index 514ec50b9..c304f39f6 100644 --- a/ios/Classes/Base/RtcEngine.swift +++ b/ios/Classes/Base/RtcEngine.swift @@ -86,7 +86,7 @@ protocol RtcEngineInterface: func setLocalAccessPoint(_ params: NSDictionary, _ callback: Callback) func enableVirtualBackground(_ params: NSDictionary, _ callback: Callback) - + func takeSnapshot(_ params: NSDictionary, _ callback: Callback) } @@ -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) @@ -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) { @@ -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!)) @@ -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) { diff --git a/ios/Classes/Base/RtcEnginePluginRegistrant.h b/ios/Classes/Base/RtcEnginePluginRegistrant.h deleted file mode 100644 index 27dc5e688..000000000 --- a/ios/Classes/Base/RtcEnginePluginRegistrant.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef RtcEnginePluginRegistrant_h -#define RtcEnginePluginRegistrant_h - -#import -#import "RtcEnginePlugin.h" - -/** - * Class for register the `RtcEnginePlugin`. - */ -@interface RtcEnginePluginRegistrant : NSObject - -/** - * Register a `RtcEnginePlugin`. The `plugin` will be called when the `RtcEngine` is created from - * flutter side. - */ -+(void)register:(NSObject *_Nonnull)plugin; - -/** - * Unregister a previously registered `RtcEnginePlugin`. - */ -+(void)unregister:(NSObject *_Nonnull)plugin; - -@end - -#endif /* RtcEnginePluginRegistrant_h */ diff --git a/ios/Classes/Base/RtcEnginePluginRegistrant.m b/ios/Classes/Base/RtcEnginePluginRegistrant.m deleted file mode 100644 index fa2dadce7..000000000 --- a/ios/Classes/Base/RtcEnginePluginRegistrant.m +++ /dev/null @@ -1,22 +0,0 @@ -#import -#if __has_include() -#import -#else -// Support project import fallback if the generated compatibility header -// is not copied when this plugin is created as a library. -// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 -#import "agora_rtc_engine-Swift.h" -#endif -#import "RtcEnginePlugin.h" -#import "RtcEnginePluginRegistrant.h" - -@implementation RtcEnginePluginRegistrant : NSObject - -+ (void)register:(NSObject *)plugin { - [RtcEnginePluginRegistrantSwift register:plugin]; -} - -+ (void)unregister:(NSObject *)plugin { - [RtcEnginePluginRegistrantSwift unregister:plugin]; -} -@end diff --git a/ios/Classes/Base/RtcEnginePluginRegistrant.swift b/ios/Classes/Base/RtcEnginePluginRegistrant.swift new file mode 100644 index 000000000..9921db30e --- /dev/null +++ b/ios/Classes/Base/RtcEnginePluginRegistrant.swift @@ -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) + } +} diff --git a/ios/Classes/Base/RtcEnginePluginRegistrantSwift.swift b/ios/Classes/Base/RtcEnginePluginRegistrantSwift.swift deleted file mode 100644 index 5def4c618..000000000 --- a/ios/Classes/Base/RtcEnginePluginRegistrantSwift.swift +++ /dev/null @@ -1,11 +0,0 @@ -import Foundation - -@objc public class RtcEnginePluginRegistrantSwift: NSObject { - @objc public static func register(_ plugin: RtcEnginePlugin) { - RtcEngineRegistry.shared.add(plugin) - } - - @objc public static func unregister(_ plugin: RtcEnginePlugin) { - RtcEngineRegistry.shared.remove(plugin) - } -} diff --git a/lib/src/rtc_engine.dart b/lib/src/rtc_engine.dart index 2190f0d6d..b9d9de250 100644 --- a/lib/src/rtc_engine.dart +++ b/lib/src/rtc_engine.dart @@ -537,7 +537,7 @@ class RtcEngine with RtcEngineInterface { } @override - Future getAudioFileInfo(String filePath) { + Future getAudioFileInfo(String filePath) { return _invokeMethod('getAudioFileInfo', { 'filePath': filePath, }); @@ -1152,9 +1152,9 @@ class RtcEngine with RtcEngineInterface { } @override - Future selectAudioTrack(int audioIndex) { + Future selectAudioTrack(int index) { return _invokeMethod('selectAudioTrack', { - 'audioIndex': audioIndex, + 'index': index, }); } @@ -2225,7 +2225,7 @@ mixin RtcAudioMixingInterface { /// **Returns** /// - 0: Success. /// - < 0: Failure. - Future getAudioFileInfo(String filePath); + Future getAudioFileInfo(String filePath); /// Gets the playback position of the audio file. /// @@ -2286,8 +2286,8 @@ mixin RtcAudioMixingInterface { /// - < 0: Failure. Future 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 @@ -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 selectAudioTrack(int audioIndex); + Future selectAudioTrack(int index); /// Sets the channel [mode] of the current music file. ///