-
Notifications
You must be signed in to change notification settings - Fork 388
/
rtc_engine.dart
2314 lines (2119 loc) · 156 KB
/
rtc_engine.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import 'dart:async';
import 'dart:typed_data';
import 'package:agora_rtc_engine/src/impl/rtc_engine_impl.dart';
import 'package:agora_rtc_engine/src/rtc_engine_event_handler.dart';
import 'package:flutter/foundation.dart';
import 'classes.dart';
import 'enums.dart';
import 'rtc_device_manager.dart';
// ignore_for_file: non_constant_identifier_names
///
/// The basic interface of the Agora SDK that implements the core functions of real-time communication.
/// RtcEngine provides the main methods that your app can call.
///
abstract class RtcEngine {
///
/// Gets the RtcDeviceManager class.
///
///
/// **return** The RtcDeviceManager class.
///
RtcDeviceManager get deviceManager;
///
/// Creates and gets an RtcChannel object.
/// You can call this method multiple times to create multiple RtcChannel objects, and then call the joinChannel methods in of each RtcChannel to join multiple channels at the same time.
/// After joining multiple channels, you can simultaneously subscribe to the the audio and video streams of all the channels, but publish a stream in only one channel at one time.
///
/// Param [channelId] The channel name. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters: The 26 lowercase English letters: a to z.
/// The 26 uppercase English letters: A to Z.
/// The 10 numeric characters: 0 to 9.
/// Space
/// "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
/// The parameter does not have a default value. You must set it.
/// Do not set this parameter as the empty string "". Otherwise, the SDK returns ERR_REFUSED(5).
///
///
/// **return** A pointer to the RtcChannel instance, if the method call succeeds.
/// If the call fails, returns null.
///
static Future<RtcEngine> create(String appId) {
return createWithContext(RtcEngineContext(appId));
}
///
/// Initializes the RtcEngine object.
/// Deprecated:
/// This method is deprecated. Use createWithContext instead.
///
/// Param [appId] The App ID of your Agora project.
///
/// Param [areaCode] The area code.
///
/// **return** The RtcEngine instance, if the method call succeeds.
/// An error code, if the call fails.
///
@Deprecated('This method is deprecated. Use createWithContext instead.')
static Future<RtcEngine> createWithAreaCode(
String appId, List<AreaCode> areaCode) {
return createWithContext(RtcEngineContext(appId, areaCode: areaCode));
}
///
/// Initializes the RtcEngine object.
/// Deprecated:
/// This method is deprecated. Use createWithContext instead.
///
/// Param [config] The RtcEngine configuraiton.
///
@Deprecated('This method is deprecated. Use createWithContext instead.')
static Future<RtcEngine> createWithConfig(RtcEngineConfig config) async {
return createWithContext(config);
}
///
/// Initializes RtcEngine.
/// All called methods provided by the RtcEngine class are executed asynchronously. Agora recommends calling these methods in the same thread. Before calling other APIs, you must call create and createWithContext to create and initialize the RtcEngine object.
/// The SDK supports creating only one RtcEngine instance for an app.
///
/// Param [config] Configurations for the RtcEngine instance. See RtcEngineContext .
///
///
static Future<RtcEngine> createWithContext(RtcEngineContext config) async {
return RtcEngineImpl.createWithContext(config);
}
///
/// Gets a child process object.
///
///
/// Param [appGroup] The app group.
///
/// **return** A child process object, which can be used in scenarios such as screen sharing.
///
Future<RtcEngine> getScreenShareHelper({String? appGroup});
/// @nodoc
@protected
Future<void> initialize(RtcEngineContext config);
///
/// Gets the SDK version.
///
///
/// **return** The SDK version number. The format is a string.
///
Future<String?> getSdkVersion();
///
/// Gets the warning or error description.
///
///
/// Param [error] The error code or warning code reported by the SDK.
///
/// **return** The specific error or warning description.
///
Future<String?> getErrorDescription(int error);
///
/// Releases the RtcEngine
/// This method releases all resources used by the Agora SDK. Use this method for apps in which users occasionally make voice or video calls. When users do not make calls, you can free up resources for other operations.
/// If you want to create a new RtcEngine instance after destroying the current one, ensure that you wait till the destroy method execution to complete.
///
Future<void> destroy();
///
/// Adds event handlers.
/// The SDK uses the RtcEngineEventHandler class to send callbacks to the app. The app inherits the methods of this class to receive these callbacks. All methods in this interface class have default (empty) implementations. Therefore, the application can only inherit some required events. In the callbacks, avoid time-consuming tasks or calling APIs that can block the thread, such as the sendStreamMessage method. Otherwise, the SDK may not work properly.
///
/// Param [handler] Callback events to be added.
///
void setEventHandler(RtcEngineEventHandler handler);
///
/// Sets the channel profile.
/// After initializing the SDK, the default channel profile is the communication profile. After initializing the SDK, the default channel profile is the live streaming profile. You can call this method to set the usage scenario of Agora channel. The Agora SDK differentiates channel profiles and applies optimization algorithms accordingly. For example, it prioritizes smoothness and low latency for a video call and prioritizes video quality for interactive live video streaming. To ensure the quality of real-time communication, Agora recommends that all users in a channel use the same channel profile.
/// This method must be called and set before joinChannel, and cannot be set again after joining the channel.
///
/// Param [profile] The channel profile. See ChannelProfile for details.
///
///
Future<void> setChannelProfile(ChannelProfile profile);
///
/// Sets the user role and level in an interactive live streaming channel.
/// In the interactive live streaming profile, the SDK sets the user role as audience by default. You can call this method to set the user role as host.
/// You can call this method either before or after joining a channel.
/// If you call this method to switch the user role after joining a channel, the SDK automatically does the following: Calls muteLocalAudioStream and muteLocalVideoStream to change the publishing state.
/// Triggers clientRoleChanged or on the local client.
/// Triggers userJoined or userOffline (USER_OFFLINE_BECOME_AUDIENCE) on the remote client. This method applies to the interactive live streaming profile (the profile parameter of setChannelProfile is LiveBroadcasting) only.
///
/// Param [role] The user role in the interactive live streaming.
///
///
/// Param [options] The detailed options of a user, including the user level. See ClientRoleOptions for details.
///
Future<void> setClientRole(ClientRole role, [ClientRoleOptions? options]);
///
/// Joins a channel with the user ID, and configures whether to automatically subscribe to the audio or video streams.
/// This method enables the local user to join a real-time audio and video interaction channel. With the same App ID, users in the same channel can talk to each other, and multiple users in the same channel can start a group chat.
/// A successful call of this method triggers the following callbacks: The local client: The joinChannelSuccess and connectionStateChanged callbacks.
/// The remote client: userJoined , if the user joining the channel is in the Communication profile or is a host in the Live-broadcasting profile. When the connection between the client and Agora's server is interrupted due to poor network conditions, the SDK tries reconnecting to the server. When the local client successfully rejoins the channel, the SDK triggers the rejoinChannelSuccess callback on the local client.
///
/// Param [token] The token generated on your server for authentication. See Authenticate Your Users with Token.
/// Ensure that the App ID used for creating the token is the same App ID used by the createWithContext method for initializing the RTC engine.
///
/// Param [channelName] The channel name. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters: The 26 lowercase English letters: a to z.
/// The 26 uppercase English letters: A to Z.
/// The 10 numeric characters: 0 to 9.
/// Space
/// "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
///
/// Param [optionalInfo] Reserved for future use.
///
///
/// Param [optionalUid] User ID This parameter is used to identify the user in the channel for real-time audio and video interaction. You need to set and manage user IDs yourself, and ensure that each user ID in the same channel is unique. This parameter is a 32-bit unsigned integer. The value range is 1 to
/// 232-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user ID and returns it in the joinChannelSuccess callback. Your app must maintain the returned user ID, because the SDK
/// does not do so.
///
/// Param [options] The channel media options.
///
///
Future<void> joinChannel(
String? token, String channelName, String? optionalInfo, int optionalUid,
[ChannelMediaOptions? options]);
///
/// Switches to a different channel, and configures whether to automatically subscribe to audio or video streams in the target channel.
/// This method allows the audience of a LIVE_BROADCASTING channel to switch to a different channel.
/// After the user successfully switches to another channel, the leaveChannel and joinChannelSuccess callbacks are triggered to indicate that the user has left the original channel and joined a new one.
/// Once the user switches to another channel, the user subscribes to the audio and video streams of all the other users in the channel by default, giving rise to usage and billing calculation. If you do not want to subscribe to a specified stream or all remote streams, call the mute methods accordingly.
///
/// Param [token] The token generated at your server. In scenarios with low security requirements, token is optional and can be set as null.
/// In scenarios with high security requirements, set the value to the token generated from your server. If you enable the App Certificate, you must use a token to join the channel. Ensure that the App ID used for creating the token is the same App ID used by the createWithContext method for initializing the RTC engine.
///
///
/// Param [channelName] The name of the channel. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channelId enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters: All lowercase English letters: a to z.
/// All uppercase English letters: A to Z.
/// All numeric characters: 0 to 9.
/// Space
/// "!"、"#"、"$"、"%"、"&"、"("、")"、"+"、"-"、":"、";"、"<"、"="、"."、">"、"?"、"@"、"["、"]"、"^"、"_"、"{"、"}"、"|"、"~"、","
///
/// Param [options] The channel media options. See ChannelMediaOptions.
///
Future<void> switchChannel(String? token, String channelName,
[ChannelMediaOptions? options]);
///
/// Leaves a channel.
/// This method releases all resources related to the session. This method call is asynchronous. When this method returns, it does not necessarily mean that the user has left the channel.
/// After joining the channel, you must call this method to end the call; otherwise, you cannot join the next call.
/// After joining the channel, you must call this method or to end the call; otherwise, you cannot join the next call.
/// A successful call of this method triggers the following callbacks: The local client: leaveChannel .
/// The remote client: userOffline , if the user joining the channel is in the Communication profile, or is a host in the Live-broadcasting profile.
/// If you call destroy immediately after calling this method, the SDK does not trigger the leaveChannel callback.
/// If you call this method during a CDN live streaming, the SDK automatically calls the removePublishStreamUrl method.
///
Future<void> leaveChannel();
///
/// Gets a new token when the current token expires after a period of time.
/// Passes a new token to the SDK. A token expires after a certain period of time. In the following two cases, the app should call this method to pass in a new token. Failure to do so will result in the SDK disconnecting from the server. The SDK triggers the tokenPrivilegeWillExpire callback.
/// The connectionStateChanged callback reports TokenExpired(9).
///
/// Param [token] The new token.
///
Future<void> renewToken(String token);
///
/// Enables interoperability with the Agora Web SDK (applicable only in the live streaming scenarios).
/// Deprecated:
/// The SDK automatically enables interoperability with the Web SDK, so you no longer need to call this method. This method enables or disables interoperability with the Agora Web SDK. If the channel has Web SDK users, ensure that you call this method, or the video of the Native user will be a black screen for the Web user.
/// This method is only applicable in live streaming scenarios, and interoperability is enabled by default in communication scenarios.
///
/// Param [enabled] Whether to enable interoperability with the Agora Web SDK. true: Enable interoperability.
/// false: (Default) Disable interoperability.
///
///
@Deprecated(
'The SDK automatically enables interoperability with the Web SDK, so you no longer need to call this method.')
Future<void> enableWebSdkInteroperability(bool enabled);
///
/// Gets the current connection state of the SDK.
/// You can call this method either before or after joining a channel.
///
/// **return** The current connection state.
///
Future<ConnectionStateType> getConnectionState();
///
/// Reports customized messages.
/// Agora supports reporting and analyzing customized messages. This function is in the beta stage with a free trial. The ability provided in its beta test version is reporting a maximum of 10 message pieces within 6 seconds, with each message piece not exceeding 256 bytes and each string not exceeding 100 bytes. To try out this function, contact and discuss the format of customized messages with us.
///
Future<void> sendCustomReportMessage(
String id, String category, String event, String label, int value);
///
/// Retrieves the call ID.
/// When a user joins a channel on a client, a callId is generated to identify the call from the client. Some methods, such as rate and complain , must be called after the call ends to submit feedback to the SDK. These methods require the callId parameter.
/// Call this method after joining a channel.
///
/// **return** The current call ID.
///
Future<String?> getCallId();
///
/// Allows a user to rate a call after the call ends.
/// Ensure that you call this method after leaving a channel.
///
/// Param [callId] The current call ID. You can get the call ID by calling getCallId .
///
/// Param [rating] The rating of the call. The value is between 1 (lowest score) and 5 (highest score). If you set a value out of this range, the SDK returns the -2 (ERR_INVALID_ARGUMENT) error.
///
/// Param [description] (Optional) A description of the call. The string length should be less than 800 bytes.
///
Future<void> rate(String callId, int rating, {String? description});
///
/// Allows a user to complain about the call quality after a call ends.
/// This method allows users to complain about the quality of the call. Call this method after the user leaves the channel.
///
/// Param [callId] The current call ID. You can get the call ID by calling getCallId .
///
/// Param [description] (Optional) A description of the call. The string length should be less than 800 bytes.
///
Future<void> complain(String callId, String description);
///
/// Sets the log files that the SDK outputs.
/// By default, the SDK outputs five log files: agorasdk.log, agorasdk_1.log, agorasdk_2.log, agorasdk_3.log, and agorasdk_4.log. Each log file has a default size of 512 KB. These log files are encoded in UTF-8. The SDK writes the latest log in agorasdk.log. When agorasdk.log is full, the SDK deletes the log file with the earliest modification time among the other four, renames agorasdk.log to the name of the deleted log file, and create a new agorasdk.log to record the latest logs.
/// Ensure that you call this method immediately after initializing RtcEngine , otherwise, the output log may not be complete.
///
/// Param [filePath] The absolute path of the log files. The default file path is C: \Users\<user_name>\AppData\Local\Agora\<process_name>\agorasdk.log. Ensure that the directory for the log files exists and is writable. You can use this parameter to rename the log files.
///
///
@Deprecated('')
Future<void> setLogFile(String filePath);
///
/// Sets the log output level of the SDK.
/// This method sets the output log level of the SDK. You can use one or a combination of the log filter levels. The log level follows the sequence of OFF, CRITICAL, ERROR, WARNING, INFO, and DEBUG. Choose a level to see the logs preceding that level.
/// If, for example, you set the log level to WARNING, you see the logs within levels CRITICAL, ERROR, and WARNING.
///
/// Param [filter] The output log level of the SDK.
///
@Deprecated('')
Future<void> setLogFilter(LogFilter filter);
///
/// Sets the size of a log file that the SDK outputs.
/// By default, the SDK outputs five log files: agorasdk.log, agorasdk_1.log, agorasdk_2.log, agorasdk_3.log, and agorasdk_4.log. Each log file has a default size of 512 KB. These log files are encoded in UTF-8. The SDK writes the latest log in agorasdk.log. When agorasdk.log is full, the SDK deletes the log file with the earliest modification time among the other four, renames agorasdk.log to the name of the deleted log file, and create a new agorasdk.log to record the latest logs.
/// If you want to set the size of the log file, you need to call this method before setLogFile , otherwise, the log will be cleared.
///
/// Param [fileSizeInKBytes] The size (KB) of a log file. The default value is 1024 KB. If you set fileSizeInKByte to 1024 KB, the maximum aggregate size of the log files output by the SDK is 5 MB. if you set fileSizeInKByte to less than 1024 KB, the setting is invalid, and the maximum size of a log file is still 1024 KB.
///
@Deprecated('')
Future<void> setLogFileSize(int fileSizeInKBytes);
///
/// Provides technical preview functionalities or special customizations by configuring the SDK with JSON options.
/// The JSON options are not public by default. Agora is working on making commonly used JSON options public in a standard way.
///
/// Param [parameters] Sets the parameter as a JSON string in the specified format.
///
Future<void> setParameters(String parameters);
///
/// Gets the C++ handle of the Native SDK.
/// This method is used to retrieve the native C++ handle of the SDK engine used in special scenarios, such as registering the audio and video frame observer.
///
/// **return** The native handle of the SDK.
///
Future<int?> getNativeHandle();
///
/// Enables/Disables deep-learning noise reduction.
/// The SDK enables traditional noise reduction mode by default to reduce most of the stationary background noise. If you need to reduce most of the non-stationary background noise, Agora recommends enabling deep-learning noise reduction as follows:
/// Ensure that the dynamic library is integrated in your project: libagora_ai_denoise_extension.dll
/// Call enableDeepLearningDenoise(true). Deep-learning noise reduction requires high-performance devices. The deep-learning noise reduction is enabled only when the device supports this function.
/// For example, the following devices and later models are known to support deep-learning noise reduction:
/// iPhone 6S
/// MacBook Pro 2015
/// iPad Pro (2nd generation)
/// iPad mini (5th generation)
/// iPad Air (3rd generation) After successfully enabling deep-learning noise reduction, if the SDK detects that the device performance is not sufficient, it automatically disables deep-learning noise reduction and enables traditional noise reduction.
/// If you call enableDeepLearningDenoise(true) or the SDK automatically disables deep-learning noise reduction in the channel, when you need to re-enable deep-learning noise reduction, you need to call leaveChannel first, and then call enableDeepLearningDenoise(true). This method dynamically loads the library, so Agora recommends calling this method before joining a channel.
/// This method works best with the human voice. Agora does not recommend using this method for audio containing music.
///
/// Param [enable] Whether to enable deep-learning noise reduction.
/// true: (Default) Enable deep-learning noise reduction.
/// false: Disable deep-learning noise reduction.
///
Future<void> enableDeepLearningDenoise(bool enable);
///
/// Sets the Agora cloud proxy service.
/// When users' network access is restricted by a firewall, configure the firewall to allow specific IP addresses and ports provided by Agora; then, call this method to enable the cloud proxy and set the cloud proxy type with the proxyType parameter.
/// After successfully connecting to the cloud proxy, the SDK triggers the connectionStateChanged (Connecting, SettingProxyServer) callback.
/// As of v3.6.2, when a user calls this method and then joins a channel successfully, the SDK triggers the proxyConnected callback to report the user ID, the proxy type connected, and the time calculated from when the user calling the method to the callback is triggered.
/// To disable the cloud proxy that has been set, call the setCloudProxy(None).
/// To change the cloud proxy type that has been set, call the setCloudProxy(None) first, and then call the setCloudProxy to set the proxyType you want. Agora recommends that you call this method before joining the channel or after leaving the channel.
/// For the SDK v3.3.x, when users use the Force UDP cloud proxy, the services for Media Push and cohosting across channels are not available; for the SDK v3.4.0 or later, when users behind a firewall use the Force UDP cloud proxy, the services for Media Push and cohosting across channels are not available.
/// When a user is behind a firewall and uses the Force UDP cloud proxy, the services for Media Push and cohosting across channels are not available.
/// When you use the Force UDP cloud proxy, note that an error would occur when calling the startAudioMixing method to play online music files in the HTTP protocol. The services for Media Push and cohosting across channels use the cloud proxy with the TCP protocol.
///
/// Param [proxyType] The type of the cloud proxy. See CloudProxyType .
/// This parameter is mandatory. The SDK reports an error if you do not pass in a value.
///
///
Future<void> setCloudProxy(CloudProxyType proxyType);
///
/// Uploads all SDK log files.
/// Since
/// v3.3.0 Uploads all SDK log files from the client to the Agora server. After calling this method successfully, the SDK triggers the uploadLogResult callback to report whether the log file is successfully uploaded to the Agora server.
/// For easier debugging, Agora recommends that you bind the uploadLogFile method to the UI element of your app, to instruct the user to upload a log file when a quality issue occurs.
///
/// **return** The method call succeeds: Return the request ID. The request ID is the same as the requestId in the uploadLogResult callback. You can use the requestId to match a specific upload with a callback.
/// The method callI fails: Returns null. Probably because the method call frequency exceeds the limit.
///
Future<String?> uploadLogFile();
/// @nodoc
Future<void> setLocalAccessPoint(LocalAccessPointConfiguration config);
///
/// Enables/Disables the virtual background. (beta feature)
/// The virtual background function allows you to replace the original background image of the local user or to blur the background. After successfully enabling the virtual background function, all users in the channel can see the customized background.
/// You can find out from the virtualBackgroundSourceEnabled callback whether the virtual background is successfully enabled or the cause of any errors.
/// Enabling the virtual background function involves a series of method calls. The calling sequence is as follows: Call (agora_segmentation, PortraitSegmentation, true) to enable the extension.
/// Call enableVideo to enable the video module.
/// Call this method to enable the virtual background function.
/// Before calling this method, ensure that you have integrated the dynamic library. Android: libagora_segmentation_extension.so
/// iOS: AgoraVideoSegmentationExtension.xcframework Call this method after enableVideo .
/// This function requires a high-performance device. Agora recommends that you use this function on devices with the following chips: Snapdragon 700 series 750G and later
/// Snapdragon 800 series 835 and later
/// Dimensity 700 series 720 and later
/// Kirin 800 series 810 and later
/// Kirin 900 series 980 and later
/// Devices with an A9 chip and better, as follows: iPhone 6S and later
/// iPad Air 3rd generation and later
/// iPad 5th generation and later
/// iPad Pro 2nd generation and later
/// iPad mini 5th generation and later Agora recommends that you use this function in scenarios that meet the following conditions: A high-definition camera device is used, and the environment is uniformly lit.
/// There are few objects in the captured video. Portraits are half-length and unobstructed. Ensure that the background is a solid color that is different from the color of the user's clothing.
///
/// Param [enabled] Whether to enable virtual background: true: Enable virtual background.
/// false: Disable virtual background.
///
///
/// Param [backgroundSource] The custom background image. See VirtualBackgroundSource for details. To adapt the resolution of the custom background image to that of the video captured by the SDK, the SDK scales and crops the custom background image while ensuring that the content of the custom background image is not distorted.
///
Future<void> enableVirtualBackground(
bool enabled, VirtualBackgroundSource backgroundSource);
///
/// Takes a snapshot of a video stream.
/// This method takes a snapshot of a video stream from the specified user, generates a JPG image, and saves it to the specified path.
/// The method is asynchronous, and the SDK has not taken the snapshot when the method call returns. After a successful method call, the SDK triggers snapshotTaken callback to report whether the snapshot is successfully taken as well as the details for the snapshot taken. Call this method after joining a channel.
/// If the video of the specified user is pre-processed, for example, added with watermarks or image enhancement effects, the generated snapshot also includes the pre-processing effects.
///
/// Param [channel] The channel name.
///
/// Param [uid] The user ID. Set uid as 0 if you want to take a snapshot of the local user's video.
///
/// Param [filePath] The local path (including the filename extensions) of the snapshot. For example, Windows: C:\Users\<user_name>\AppData\Local\Agora\<process_name>\example.jpg
/// iOS: /App Sandbox/Library/Caches/example.jpg
/// macOS: ~/Library/Logs/example.jpg
/// Android: /storage/emulated/0/Android/data/<package name>/files/example.jpg
/// Ensure that the path you specify exists and is writable.
///
///
Future<void> takeSnapshot(String channel, int uid, String filePath);
/// @nodoc
Future<void> enableContentInspect(bool enabled, ContentInspectConfig config);
///
/// Registers a user account.
/// Once registered, the user account can be used to identify the local user when the user joins the channel. After the registration is successful, the user account can identify the identity of the local user, and the user can use it to join the channel.
/// After the user successfully registers a user account, the SDK triggers the localUserRegistered callback on the local client, reporting the user ID and user account of the local user.
/// This method is optional. To join a channel with a user account, you can choose either of the following ways: Call registerLocalUserAccount to to create a user account, and then call joinChannelWithUserAccount to join the channel.
/// Call the joinChannelWithUserAccount method to join the channel. The difference between the two ways is that the time elapsed between calling the registerLocalUserAccount method and joining the channel is shorter than directly calling joinChannelWithUserAccount. Ensure that you set the userAccount parameter; otherwise, this method does not take effect.
/// Ensure that the userAccount is unique in the channel.
/// To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the ID of the user is set to the same parameter type.
///
/// Param [appId] The App ID of your project on Agora Console.
///
/// Param [userAccount] The user account. This parameter is used to identify the user in the channel for real-time audio and video engagement. You need to set and manage user accounts yourself and ensure that each user account in the same channel is unique. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported characters are (89 in total): The 26 lowercase English letters: a to z.
/// The 26 uppercase English letters: A to Z.
/// All numeric characters: 0 to 9.
/// Space
/// "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
///
Future<void> registerLocalUserAccount(String appId, String userAccount);
///
/// Joins the channel with a user account, and configures whether to automatically subscribe to audio or video streams after joining the channel.
/// This method allows a user to join the channel with the user account. After the user successfully joins the channel, the SDK triggers the following callbacks:
/// The local client: localUserRegistered , joinChannelSuccess and connectionStateChanged callbacks.
/// The remote client: The userJoined callback if the user is in the COMMUNICATION profile, and the userInfoUpdated callback if the user is a host in the LIVE_BROADCASTING profile. Once a user joins the channel, the user subscribes to the audio and video streams of all the other users in the channel by default, giving rise to usage and billing calculation. To stop subscribing to a specified stream or all remote streams, call the corresponding mute methods.
/// To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the ID of the user is set to the same parameter type.
///
/// Param [options] The channel media options.
///
///
/// Param [token]
///
/// Param [userAccount] The user account. This parameter is used to identify the user in the channel for real-time audio and video engagement. You need to set and manage user accounts yourself and ensure that each user account in the same channel is unique. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported characters are (89 in total):
/// The 26 lowercase English letters: a to z.
/// The 26 uppercase English letters: A to Z.
/// All numeric characters: 0 to 9.
/// Space
/// "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
///
Future<void> joinChannelWithUserAccount(
String? token, String channelName, String userAccount,
[ChannelMediaOptions? options]);
///
/// Gets the user information by passing in the user account.
/// After a remote user joins the channel, the SDK gets the UID and user account of the remote user, caches them in a mapping table object, and triggers the userInfoUpdated callback on the local client. After receiving the callback, you can call this method to get the user account of the remote user from the UserInfo object by passing in the user ID.
///
/// Param [userAccount] The user account.
///
/// **return** The UserInfo object that identifies the user information. Not null: Success.
/// Null: Failure.
///
Future<UserInfo> getUserInfoByUserAccount(String userAccount);
///
/// Gets the user information by passing in the user ID.
/// After a remote user joins the channel, the SDK gets the UID and user account of the remote user, caches them in a mapping table object, and triggers the userInfoUpdated callback on the local client. After receiving the callback, you can call this method to get the user account of the remote user from the UserInfo object by passing in the user ID.
///
/// Param [uid]
///
/// **return** The UserInfo object that identifies the user information. Not null: Success.
/// Null: Failure.
///
Future<UserInfo> getUserInfoByUid(int uid);
///
/// Enables the audio module.
/// The audio mode is enabled by default. This method enables the internal engine and can be called anytime after initialization. It is still valid after one leaves channel.
/// This method enables the audio module and takes some time to take effect. Agora recommends using the following API methods to control the audio module separately: enableLocalAudio : Whether to enable the microphone to create the local audio stream.
/// muteLocalAudioStream : Whether to publish the local audio stream.
/// muteRemoteAudioStream : Whether to subscribe and play the remote audio stream.
/// muteAllRemoteAudioStreams : Whether to subscribe to and play all remote audio streams.
///
Future<void> enableAudio();
///
/// Disables the audio module.
/// This method disables the internal engine and can be called anytime after initialization. It is still valid after one leaves channel.
/// This method resets the internal engine and takes some time to take effect. Agora recommends using the following API methods to control the audio modules separately: enableLocalAudio : Whether to enable the microphone to create the local audio stream.
/// muteLocalAudioStream : Whether to publish the local audio stream.
/// muteRemoteAudioStream : Whether to subscribe and play the remote audio stream.
/// muteAllRemoteAudioStreams : Whether to subscribe to and play all remote audio streams.
///
Future<void> disableAudio();
///
/// Sets the audio profile and audio scenario.
/// You can call this method either before or after joining a channel.
/// Ensure that you call this method before joining a channel.
/// In scenarios requiring high-quality audio, such as online music tutoring, Agora recommends you set profile as MusicHighQuality (4), and scenario as GameStreaming (3) or (6).
///
/// Param [profile] The audio profile, including the sampling rate, bitrate, encoding mode, and the number of channels. See AudioProfile .
///
/// Param [scenario] The audio scenario. See AudioScenario . Under different audio scenarios, the device uses different volume types.
///
///
Future<void> setAudioProfile(AudioProfile profile, AudioScenario scenario);
///
/// Adjusts the capturing signal volume.
/// You can call this method either before or after joining a channel.
///
/// Param [volume] The playback signal volume of all remote users. Integer only. The value range is [0,400]. 0: Mute.
/// 100: (Default) The original volume.
/// 400: Four times the original volume (amplifying the audio signals by four times).
///
Future<void> adjustRecordingSignalVolume(int volume);
///
/// Adjusts the playback signal volume of a specified remote user.
/// You can call this method to adjust the playback volume of a specified remote user. To adjust the playback volume of different remote users, call the method as many times, once for each remote user. Call this method after joining a channel.
/// The playback volume here refers to the mixed volume of a specified remote user.
///
/// Param [uid] The ID of the remote user.
///
/// Param [volume] The playback signal volume of a specified remote user.
///
Future<void> adjustUserPlaybackSignalVolume(int uid, int volume);
///
/// Enables loopback audio capturing.
/// If you enable loopback audio capturing, the output of the sound card is mixed into the audio stream sent to the other end. This method applies to macOS and Windows only.
/// The default sound card on the macOS system does not support loopback audio capture. To enable this capture, you need to enable a virtual sound card and pass the name of the virtual sound card in the deviceName parameter. Agora recommends that you use AgoraALD (Agora Audio Loopback Device) and pass in "AgoraALD".
/// You can call this method either before or after joining a channel.
///
/// Param [enabled] Sets whether to enable loopback capturing. true: Enable loopback audio capturing.
/// false: (Default) Disable loopback capturing.
///
///
/// Param [deviceName] The device name of the sound card. The default is set to nil, which means the SDK uses the current sound card to capture. If you are using a virtual sound card, such as AgoraALD (Agora Audio Loopback Device), set this parameter as the name of the sound card ("AgoraALD").
///
Future<void> enableLoopbackRecording(bool enabled, {String? deviceName});
///
/// Adjusts the playback signal volume of all remote users.
/// This method adjusts the playback volume that is the mixed volume of all remote users.
/// As of v2.3.2, to mute the local audio, you need to call the adjustPlaybackSignalVolume and adjustAudioMixingPlayoutVolume methods at the same time, and set volume to 0.
/// You can call this method either before or after joining a channel.
///
/// Param [volume] The playback signal volume of all remote users. Integer only. The value range is [0,400]. 0: Mute.
/// 100: (Default) The original volume.
/// 400: Four times the original volume (amplifying the audio signals by four times).
///
Future<void> adjustPlaybackSignalVolume(int volume);
///
/// Enables/Disables the local audio capture.
/// The audio function is enabled by default. This method disables or re-enables the local audio function to stop or restart local audio capturing.
/// This method does not affect receiving or playing the remote audio streams, and enableLocalAudio (false) applies to scenarios where the user wants to receive remote audio streams without sending any audio stream to other users in the channel.
/// Once the local audio function is disabled or re-enabled, the SDK triggers the localAudioStateChanged callback, which reports Stopped(0) or Recording(1).
/// This method is different from the muteLocalAudioStream method: enableLocalVideo: Disables/Re-enables the local audio capturing and processing. If you disable or re-enable local audio capturing using the enableLocalAudio method, the local user might hear a pause in the remote audio playback.
/// muteLocalAudioStream: Sends/Stops sending the local audio streams. You can call this method either before or after joining a channel.
///
/// Param [enabled] true: (Default) Re-enable the local audio function, that is, to start the local audio capturing device (for example, the microphone).
/// false: Disable the local audio function, that is, to stop local audio capturing.
///
Future<void> enableLocalAudio(bool enabled);
///
/// Stops or resumes publishing the local audio stream.
/// A successful call of this method triggers the userMuteAudio callback on the remote client. This method does not affect any ongoing audio recording, because it does not disable the microphone.
/// You can call this method either before or after joining a channel. If you call the setChannelProfile method after this method, the SDK resets whether or not to stop publishing the local audio according to the channel profile and user role. Therefore, Agora recommends calling this method after the setChannelProfile method.
///
/// Param [muted] Whether to stop publishing the local audio stream.
/// true: Stop publishing the local audio stream.
/// false: (Default) Resumes publishing the local audio stream.
///
Future<void> muteLocalAudioStream(bool muted);
///
/// Stops or resumes subscribing to the audio stream of a specified user.
/// Call this method after joining a channel.
/// See recommended settings in Set the Subscribing State.
///
/// Param [uid] The user ID of the specified user.
///
/// Param [muted] Whether to stop subscribing to the audio stream of the specified user.
/// true: Stop subscribing to the audio stream of the specified user.
/// false: (Default) Subscribe to the audio stream of the specified user.
///
Future<void> muteRemoteAudioStream(int uid, bool muted);
///
/// Stops or resumes subscribing to the audio streams of all remote users.
/// As of v3.3.0, after successfully calling this method, the local user stops or resumes subscribing to the audio streams of all remote users, including all subsequent users. Call this method after joining a channel.
///
/// Param [muted] Whether to subscribe to the audio streams of all remote users: true: Do not subscribe to the audio streams of all remote users.
/// false: (Default) Subscribe to the audio streams of all remote users by default.
///
Future<void> muteAllRemoteAudioStreams(bool muted);
///
/// Stops or resumes subscribing to the audio streams of all remote users by default.
/// Call this method after joining a channel. After successfully calling this method, the local user stops or resumes subscribing to the audio streams of all subsequent users. If you need to resume subscribing to the audio streams of remote users in the channel after calling this method, do the following: To resume subscribing to the audio stream of a specified user, call muteRemoteAudioStream (false), and specify the user ID.
/// To resume subscribing to the audio streams of multiple remote users, call muteRemoteAudioStream (false)multiple times.
///
/// Param [muted] Whether to stop subscribing to the audio streams of all remote users by default. true: Stop subscribing to the audio streams of all remote users by default.
/// false: (Default) Subscribe to the audio streams of all remote users by default.
///
@Deprecated('')
Future<void> setDefaultMuteAllRemoteAudioStreams(bool muted);
///
/// Enables the reporting of users' volume indication.
/// This method enables the SDK to regularly report the volume information of the local user who sends a stream and remote users (up to three) whose instantaneous volumes are the highest to the app. Once you call this method and users send streams in the channel, the SDK triggers the audioVolumeIndication callback at the time interval set in this method.
/// You can call this method either before or after joining a channel.
///
/// Param [interval] Sets the time interval between two consecutive volume indications: ≤ 0: Disables the volume indication.
/// > 0: Time interval (ms) between two consecutive volume indications. We recommend a setting greater than 200 ms. Do not set this parameter to less than 10 milliseconds, otherwise the audioVolumeIndication callback will not be triggered.
///
///
/// Param [smooth] The smoothing factor sets the sensitivity of the audio volume indicator. The value ranges between 0 and 10. The recommended value is 3. The greater the value, the more sensitive the indicator.
///
/// Param [report_vad] true: Enable the voice activity detection of the local user. Once it is enabled, the vad parameter of the audioVolumeIndication callback reports the voice activity status of the local user.
/// false: (Default) Disable the voice activity detection of the local user. Once it is disabled, the vad parameter of the audioVolumeIndication callback does not report the voice activity status of the local user, except for the scenario where the engine automatically detects the voice activity of the local user.
///
///
Future<void> enableAudioVolumeIndication(
int interval, int smooth, bool report_vad);
///
/// Enables the video module.
/// Call this method either before joining a channel or during a call. If this method is called before joining a channel, the call starts in the video mode. Call disableVideo to disable the video mode.
/// A successful call of this method triggers the remoteVideoStateChanged callback on the remote client. This method enables the internal engine and is valid after leaving the channel.
/// This method resets the internal engine and takes some time to take effect. Agora recommends using the following API methods to control the video engine modules separately: enableLocalVideo : Whether to enable the camera to create the local video stream.
/// muteLocalVideoStream : Whether to publish the local video stream.
/// muteRemoteVideoStream : Whether to subscribe to and play the remote video stream.
/// muteAllRemoteVideoStreams : Whether to subscribe to and play all remote video streams.
///
Future<void> enableVideo();
///
/// Disables the video module.
/// This method disables video. You can call this method either before or after joining a channel. If you call it before joining a channel, an audio call starts when you join the channel. If you call it after joining a channel, a video call switches to an audio call. Call enableVideo to enable video.
/// A successful call of this method triggers the userEnableVideo (false) callback on the remote client. This method affects the internal engine and can be called after leaving the channel.
/// This method resets the internal engine and takes some time to take effect. Agora recommends using the following API methods to control the video engine modules separately: enableLocalVideo : Whether to enable the camera to create the local video stream.
/// muteLocalVideoStream : Whether to publish the local video stream.
/// muteRemoteVideoStream : Whether to subscribe to and play the remote video stream.
/// muteAllRemoteVideoStreams : Whether to subscribe to and play all remote video streams.
///
Future<void> disableVideo();
///
/// Sets the video encoder configuration.
/// Sets the encoder configuration for the local video.
/// You can call this method either before or after joining a channel. If you don't need to set the video encoder configuration after joining a channel,
/// Agora recommends you calling this method before the enableVideo method to reduce the rendering time of the first video frame.
///
/// Param [config] Video profile. See VideoEncoderConfiguration .
///
Future<void> setVideoEncoderConfiguration(VideoEncoderConfiguration config);
///
/// Enables the local video preview.
/// This method starts the local video preview before joining the channel. Before calling this method, ensure that you do the following: Call enableVideo to enable the video.
/// The local preview enables the mirror mode by default.
/// After the local video preview is enabled, if you call leaveChannel to exit the channel, the local preview remains until you call stopPreview to disable it.
///
Future<void> startPreview();
///
/// Stops the local video preview.
///
///
Future<void> stopPreview();
///
/// Enables/Disables the local video capture.
/// This method disables or re-enables the local video capturer, and does not affect receiving the remote video stream.
/// After calling enableVideo , the local video capturer is enabled by default. You can call enableLocalVideo (false) to disable the local video capturer. If you want to re-enable the local video, call enableLocalVideo(true).
/// After the local video capturer is successfully disabled or re-enabled, the SDK triggers the callback on the remote client remoteVideoStateChanged . You can call this method either before or after joining a channel.
/// This method enables the internal engine and is valid after .
///
/// Param [enabled] Whether to enable the local video capture. true: (Default) Enable the local video capture.
/// false: Disables the local video capture. Once the local video is disabled, the remote users can no longer receive the video stream of this user, while this user can still receive the video streams of the other remote users. When set to false, this method does not require a local camera.
///
///
Future<void> enableLocalVideo(bool enabled);
///
/// Stops or resumes publishing the local video stream.
/// A successful call of this method triggers the userMuteVideo callback on the remote client. This method executes faster than the enableLocalVideo (false) method, which controls the sending of the local video stream.
/// This method does not affect any ongoing video recording, because it does not disable the camera.
/// You can call this method either before or after joining a channel. If you call setChannelProfile after this method, the SDK resets whether or not to stop publishing the local video according to the channel profile and user role. Therefore, Agora recommends calling this method after the setChannelProfile method.
///
/// Param [muted] Whether to stop publishing the local video stream. true: Stop publishing the local video stream.
/// false: (Default) Publish the local video stream.
///
Future<void> muteLocalVideoStream(bool muted);
///
/// Stops or resumes subscribing to the video stream of a specified user.
/// Call this method after joining a channel.
/// See recommended settings in Set the Subscribing State.
///
/// Param [userId] The ID of the specified user.
///
/// Param [muted] Whether to stop subscribing to the video stream of the specified user. true: Stop subscribing to the video streams of the specified user.
/// false: (Default) Subscribe to the video stream of the specified user.
///
Future<void> muteRemoteVideoStream(int uid, bool muted);
///
/// Stops or resumes subscribing to the video streams of all remote users.
/// As of v3.3.0, after successfully calling this method, the local user stops or resumes subscribing to the video streams of all remote users, including all subsequent users. Call this method after joining a channel.
/// See recommended settings in Set the Subscribing State.
///
/// Param [muted] Whether to stop subscribing to the video streams of all remote users. true: Stop subscribing to the video streams of all remote users.
/// false: (Default) Subscribe to the audio streams of all remote users by default.
///
Future<void> muteAllRemoteVideoStreams(bool muted);
///
/// Stops or resumes subscribing to the video streams of all remote users by default.
/// Call this method after joining a channel. After successfully calling this method, the local user stops or resumes subscribing to the audio streams of all subsequent users. If you need to resume subscribing to the audio streams of remote users in the channel after calling this method, do the following: To resume subscribing to the audio stream of a specified user, call muteRemoteVideoStream (false), and specify the user ID.
/// To resume subscribing to the audio streams of multiple remote users, call muteRemoteVideoStream(false)multiple times.
///
/// Param [muted] Whether to stop subscribing to the audio streams of all remote users by default. true: Stop subscribing to the audio streams of all remote users by default.
/// false: (Default) Resume subscribing to the audio streams of all remote users by default.
///
@Deprecated('')
Future<void> setDefaultMuteAllRemoteVideoStreams(bool muted);
///
/// Sets the image enhancement options.
/// Enables or disables image enhancement, and sets the options.
/// Enabling the image enhancement function involves a series of method calls. The calling sequence is as follows: Call (agora, beauty, true) to enable the extension.
/// Call enableVideo to enable the video module.
/// Call this method to enable the image enhancement function.
/// Call this method after enableVideo .
///
/// Param [enabled] Whether to enable the image enhancement function: true: Enable the image enhancement function.
/// false: (Default) Disable the image enhancement function.
///
///
/// Param [options] The image enhancement options. See BeautyOptions .
///
///
Future<void> setBeautyEffectOptions(bool enabled, BeautyOptions options);
///
/// Enables/Disables the super resolution algorithm for a remote user's video stream.
/// This feature effectively boosts the resolution of a remote user's video seen by the local user. If the original resolution of a remote user's video is a × b, the local user's device can render the remote video at a resolution of 2a × 2b
/// after you enable this feature.
/// After you call this method, the SDK triggers the userSuperResolutionEnabled callback to report whether you have successfully enabled super resolution.
/// After calling this method, you can confirm whether super resolution is successfully enabled through the remote video stream statistics ( RemoteVideoStats ) in the remoteVideoStats callback: If the parameter superResolutionType >0: Super resolution is enabled.
/// If parameter superResolutionType =0: Super resolution is not enabled. The super resolution feature requires extra system resources. To balance the visual experience and system consumption, this feature can only be enabled for a single remote user. If the local user uses super resolution on Android, the original resolution of the remote user's video cannot exceed 640 × 360 pixels; if the local user uses super resolution on iOS, the original resolution of the remote user's video cannot exceed 640 × 480 pixels.
/// If you exceed these limitations, the SDK triggers the warning callback and returns all corresponding warning codes: SuperResolutionStreamOverLimitation: 1610. The origin resolution of the remote video is beyond the range where super resolution can be applied.
/// SuperResolutionUserCountOverLimitation: 1611. Super resolution is already being used on another remote user's video.
/// SuperResolutionDeviceNotSupported: 1612. The device does not support using super resolution. This method applies to Android and iOS only.
/// Before calling this method, ensure that you have integrated the following dynamic libraries: Android: libagora_super_resolution_extension.so
/// iOS: AgoraSuperResolutionExtension.xcframework Because this method has certain system performance requirements, Agora recommends that you use the following devices or better: Android: VIVO: V1821A, NEX S, 1914A, 1916A, 1962A, 1824BA, X60, X60 Pro
/// OPPO: PCCM00, Find X3
/// OnePlus: A6000
/// Xiaomi: Mi 8, Mi 9, Mi 10, Mi 11, MIX3, Redmi K20 Pro
/// SAMSUNG: SM-G9600, SM-G9650, SM-N9600, SM-G9708, SM-G960U, SM-G9750, S20, S21
/// HUAWEI: SEA-AL00, ELE-AL00, VOG-AL00, YAL-AL10, HMA-AL00, EVR-AN00, nova 4, nova 5 Pro, nova 6 5G, nova 7 5G, Mate 30, Mate 30 Pro, Mate 40, Mate 40 Pro, P40, P40 Pro, Huawei M6, MatePad 10.8 iOS: iPhone XR
/// iPhone XS
/// iPhone XS Max
/// iPhone 11
/// iPhone 11 Pro
/// iPhone 11 Pro Max
/// iPhone 12
/// iPhone 12 mini
/// iPhone 12 Pro
/// iPhone 12 Pro Max
/// iPhone 12 SE (2nd generation)
/// iPad Pro 11-inch (3rd generation)
/// iPad Pro 12.9-inch (3rd generation)
/// iPad Air 3 (3rd generation)
/// iPad Air 3 (4th generation)
///
/// Param [userId] The user ID of the remote user.
///
/// Param [enable] Whether to enable super resolution for the remote user’s video: true: Enable super resolution.
/// false: Disable super resolution.
///
///
Future<void> enableRemoteSuperResolution(int userId, bool enable);
///
/// Starts playing the music file.
/// This method mixes the specified local or online audio file with the audio from the microphone, or replaces the microphone's audio with the specified local or remote audio file. A successful method call triggers the audioMixingStateChanged (PLAY) callback. When the audio mixing file playback finishes, the SDK triggers the audioMixingStateChanged (STOPPED) callback on the local client. Call this method after joining a channel. If you need to call startAudioMixing multiple times, ensure that the time interval between calling this method is more than 500 ms.
/// If the local audio mixing file does not exist, or if the SDK does not support the file format or cannot access the music file URL, the SDK returns WARN_AUDIO_MIXING_OPEN_ERROR (701).
///
/// Param [filePath] The absolute path or URL address (including the suffixes of the filename) of the audio effect file. For example: Android: /sdcard/emulated/0/audio.mp4, iOS: /var/mobile/Containers/Data/audio.mp4. Supported audio formats include MP3, AAC, M4A, MP4, WAV, and 3GP. See supported audio formats.
///
/// Param [loopback] Whether to only play music files on the local client: true: Only play music files on the local client so that only the local user can hear the music.
/// false: Publish music files to remote clients so that both the local user and remote users can hear the music.
///
/// Param [replace] Whether to replace the audio captured by the microphone with a music file: true: Replace the audio captured by the microphone with a music file. Users can only hear the music.
/// false: Do not replace the audio captured by the microphone with a music file. Users can hear both music and audio captured by the microphone.
///
/// Param [cycle] The number of times the music file plays. ≥ 0: The number of playback times. For example, 0 means that the SDK does not play the music file while 1 means that the SDK plays once.
/// -1: Play the music effect in an infinite loop.
///
/// Param [startPos] The playback position (ms) of the music file.
///
Future<void> startAudioMixing(
String filePath, bool loopback, bool replace, int cycle,
[int? startPos]);
///
/// Stops playing and mixing the music file.
/// This method stops the audio mixing. Call this method when you are in a channel.
///
Future<void> stopAudioMixing();
///
/// Pauses playing and mixing the music file.
/// Call this method when you are in a channel.
///
Future<void> pauseAudioMixing();
///
/// Resumes playing and mixing the music file.
/// This method resumes playing and mixing the music file. Call this method when you are in a channel.
///
Future<void> resumeAudioMixing();
///
/// Adjusts the volume during audio mixing.
/// This method adjusts the audio mixing volume on both the local client and remote clients. Call this method after startAudioMixing .
/// Calling this method does not affect the volume of audio effect file playback invoked by the playEffect method.
///
/// Param [volume] Audio mixing volume. The value ranges between 0 and 100. The default value is 100, the original volume.
///
Future<void> adjustAudioMixingVolume(int volume);
///
/// Adjusts the volume of audio mixing for local playback.
/// You need to call this method after calling startAudioMixing and receiving the audioMixingStateChanged(PLAY) callback.
///
/// Param [volume] Audio mixing volume for local playback. The value range is [0,100]. The default value is 100, the original volume.
///
Future<void> adjustAudioMixingPlayoutVolume(int volume);
///
/// Adjusts the volume of audio mixing for publishing.
/// This method adjusts the volume of audio mixing for publishing (sending to other users).
/// You need to call this method after calling startAudioMixing and receiving the audioMixingStateChanged(PLAY) callback.
///
/// Param [volume] Audio mixing volume. The value range is [0,100]. The default value is 100, the original volume.
///
Future<void> adjustAudioMixingPublishVolume(int volume);
///
/// Retrieves the audio mixing volume for local playback.
/// This method helps troubleshoot audio volume‑related issues.
/// You need to call this method after calling startAudioMixing and receiving the audioMixingStateChanged(PLAY) callback.
///
/// **return** ≥ 0: The audio mixing volume, if this method call succeeds. The value range is [0,100].
/// < 0: Failure.
///
Future<int?> getAudioMixingPlayoutVolume();
///
/// Retrieves the audio mixing volume for publishing.
/// This method helps troubleshoot audio volume‑related issues.
/// You need to call this method after calling startAudioMixing and receiving the audioMixingStateChanged(PLAY) callback.
///
/// **return** ≥ 0: The audio mixing volume, if this method call succeeds. The value range is [0,100].
/// < 0: Failure.
///
Future<int?> getAudioMixingPublishVolume();
///
/// Retrieves the duration (ms) of the music file.
/// Call this method after joining a channel.
///
/// Param [filePath] The absolute path or URL address (including the suffixes of the filename) of the audio effect file. For example: Android: /sdcard/emulated/0/audio.mp4, iOS: /var/mobile/Containers/Data/audio.mp4. Supported audio formats include MP3, AAC, M4A, MP4, WAV, and 3GP. See supported audio formats.
///
/// **return** ≥ 0: A successful method call. Returns the total duration (ms) of the specified music file.
/// < 0: Failure.
///
@Deprecated(
'This method is deprecated as of v4.1.0. Use getAudioFileInfo instead.')
Future<int?> getAudioMixingDuration([String? filePath]);
///
/// Gets the information of a specified audio file.
/// After calling this method successfully, the SDK triggers the requestAudioFileInfo callback to report the information of an audio file, such as audio duration. You can call this method multiple times to get the information of multiple audio files. For the audio file formats supported by this method, see What formats of audio files does the Agora RTC SDK support.
/// Call this method after joining a channel.
///
/// Param [filePath] The file path:
/// Android: The file path, including the filename extensions. To access an online file, Agora
/// supports using a URL address; to access a local file, Agora supports using a URI address, an absolute path, or a path that starts
/// with /assets/. You might encounter permission issues if you use an absolute path to access a local file, so Agora recommends
/// using a URI address instead. For example: content://com.android.providers.media.documents/document/audio%3A14441.
/// Windows: The absolute path or URL address (including the filename extensions) of the audio file.
/// For example: C:\music\audio.mp4.
/// iOS or macOS: The absolute path or URL address (including the filename extensions) of the audio file. For example: /var/mobile/Containers/Data/audio.mp4.
///
///
/// **return** 0: Success.
/// < 0: Failure.
///
Future<int?> getAudioFileInfo(String filePath);
///
/// Retrieves the playback position (ms) of the music file.
/// Retrieves the playback position (ms) of the audio.
/// You need to call this method after calling startAudioMixing and receiving the audioMixingStateChanged(PLAY) callback.
///
/// **return** ≥ 0: The current playback position of the audio mixing, if this method call succeeds.
/// < 0: Failure.
///
Future<int?> getAudioMixingCurrentPosition();
///
/// Sets the audio mixing position.
/// Call this method to set the playback position of the music file to a different starting position (the default plays from the beginning).
/// You need to call this method after calling startAudioMixing and receiving the audioMixingStateChanged(PLAY) callback.
///
/// Param [pos] Integer. The playback position (ms).
///
Future<void> setAudioMixingPosition(int pos);
///
/// Sets the pitch of the local music file.
/// When a local music file is mixed with a local human voice, call this method to set the pitch of the local music file only.
/// You need to call this method after calling startAudioMixing and receiving the audioMixingStateChanged(Playing) callback.
///
/// Param [pitch] Sets the pitch of the local music file by the chromatic scale. The default value is 0, which means keeping the original pitch. The value ranges from -12 to 12, and the pitch value between consecutive values is a chromatic value. The greater the absolute value of this parameter, the higher or lower the pitch of the local music file.
///
Future<void> setAudioMixingPitch(int pitch);
///
/// Sets the channel mode of the current music file.
/// Call this method after calling startAudioMixing and receiving the audioMixingStateChanged (Playing) callback.
///
/// Param [speed] The playback speed. Agora recommends that you limit this value to between 50 and 400, defined as follows: 50: Half the original speed.
/// 100: The original speed.
/// 400: 4 times the original speed.
///
///
Future<void> setAudioMixingPlaybackSpeed(int speed);
///
/// Gets the audio track index of the current music file.
/// For the audio file formats supported by this method, see What formats of audio files does the Agora RTC SDK support.
/// This method is for Android, iOS, and Windows only.
/// Call this method after calling startAudioMixing and receiving the audioMixingStateChanged (AUDIO_MIXING_STATE_PLAYING)
/// callback.
///
/// **return** ≥ 0: The audio track index of the current music file, if this method call
/// succeeds.
/// < 0: Failure.
///
Future<int?> getAudioTrackCount();
///
/// Specified the playback track of the current music file.
/// After getting the number of audio tracks of the current music file, call this method to specify any audio track to play. For example, if different tracks of a multitrack file store songs in different languages, you can call this method to set the language of the music file to play. This method is for Android, iOS, and Windows only.
/// Call this method after calling startAudioMixing and receive the audioMixingStateChanged (Playing)
/// callback.
/// For the audio file formats supported by this method, see .
///
/// Param [index] The specified playback track. The value range is [0, getAudioTrackCount ()].