agora-electron-sdk 4.4.0-dev.1 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/js/AgoraSdk.js +1 -1
  3. package/js/Private/AgoraBase.js +28 -28
  4. package/js/Private/AgoraMediaBase.js +30 -4
  5. package/js/Private/IAgoraLog.js +4 -0
  6. package/js/Private/IAgoraRhythmPlayer.js +12 -12
  7. package/js/Private/IAgoraRtcEngine.js +64 -64
  8. package/js/Private/impl/IAgoraRtcEngineImpl.js +0 -32
  9. package/js/Private/internal/RtcEngineExInternal.js +9 -3
  10. package/js/Renderer/AgoraView.js +21 -2
  11. package/js/Renderer/IRendererManager.js +15 -2
  12. package/js/Renderer/RendererCache.js +2 -2
  13. package/package.json +9 -5
  14. package/scripts/downloadPrebuild.js +9 -3
  15. package/ts/AgoraSdk.ts +1 -1
  16. package/ts/Private/AgoraBase.ts +35 -31
  17. package/ts/Private/AgoraMediaBase.ts +60 -40
  18. package/ts/Private/IAgoraLog.ts +4 -0
  19. package/ts/Private/IAgoraMediaEngine.ts +8 -19
  20. package/ts/Private/IAgoraMediaPlayer.ts +13 -12
  21. package/ts/Private/IAgoraMusicContentCenter.ts +13 -1
  22. package/ts/Private/IAgoraRhythmPlayer.ts +12 -12
  23. package/ts/Private/IAgoraRtcEngine.ts +296 -262
  24. package/ts/Private/IAgoraRtcEngineEx.ts +35 -34
  25. package/ts/Private/IAudioDeviceManager.ts +4 -4
  26. package/ts/Private/impl/IAgoraRtcEngineImpl.ts +0 -42
  27. package/ts/Private/internal/RtcEngineExInternal.ts +7 -2
  28. package/ts/Renderer/AgoraView.ts +33 -4
  29. package/ts/Renderer/IRendererManager.ts +20 -2
  30. package/ts/Renderer/RendererCache.ts +2 -2
  31. package/ts/Types.ts +1 -1
  32. package/types/AgoraSdk.d.ts +1 -1
  33. package/types/Private/AgoraBase.d.ts +35 -31
  34. package/types/Private/AgoraBase.d.ts.map +1 -1
  35. package/types/Private/AgoraMediaBase.d.ts +59 -40
  36. package/types/Private/AgoraMediaBase.d.ts.map +1 -1
  37. package/types/Private/IAgoraLog.d.ts +5 -1
  38. package/types/Private/IAgoraLog.d.ts.map +1 -1
  39. package/types/Private/IAgoraMediaEngine.d.ts +8 -19
  40. package/types/Private/IAgoraMediaEngine.d.ts.map +1 -1
  41. package/types/Private/IAgoraMediaPlayer.d.ts +13 -12
  42. package/types/Private/IAgoraMediaPlayer.d.ts.map +1 -1
  43. package/types/Private/IAgoraMusicContentCenter.d.ts +13 -1
  44. package/types/Private/IAgoraMusicContentCenter.d.ts.map +1 -1
  45. package/types/Private/IAgoraRhythmPlayer.d.ts +12 -12
  46. package/types/Private/IAgoraRtcEngine.d.ts +296 -260
  47. package/types/Private/IAgoraRtcEngine.d.ts.map +1 -1
  48. package/types/Private/IAgoraRtcEngineEx.d.ts +35 -34
  49. package/types/Private/IAgoraRtcEngineEx.d.ts.map +1 -1
  50. package/types/Private/IAudioDeviceManager.d.ts +4 -4
  51. package/types/Private/impl/IAgoraRtcEngineImpl.d.ts +0 -4
  52. package/types/Private/impl/IAgoraRtcEngineImpl.d.ts.map +1 -1
  53. package/types/Private/internal/RtcEngineExInternal.d.ts.map +1 -1
  54. package/types/Renderer/AgoraView.d.ts +8 -2
  55. package/types/Renderer/AgoraView.d.ts.map +1 -1
  56. package/types/Renderer/IRendererManager.d.ts.map +1 -1
  57. package/types/Renderer/RendererCache.d.ts +1 -1
  58. package/types/Renderer/RendererCache.d.ts.map +1 -1
  59. package/types/Types.d.ts +1 -1
  60. package/types/Types.d.ts.map +1 -1
@@ -46,15 +46,14 @@ export class RtcConnection {
46
46
  */
47
47
  export abstract class IRtcEngineEx extends IRtcEngine {
48
48
  /**
49
- * Joins a channel with the connection ID.
49
+ * Joins a channel.
50
50
  *
51
- * You can call this method multiple times to join more than one channel.
52
- * If you are already in a channel, you cannot rejoin it with the same user ID.
53
- * If you want to join the same channel from different devices, ensure that the user IDs are different for all devices.
54
- * Ensure that the App ID you use to generate the token is the same as the App ID used when creating the IRtcEngine instance.
55
- * If you choose the Testing Mode (using an App ID for authentication) for your project and call this method to join a channel, you will automatically exit the channel after 24 hours.
51
+ * You can call this method multiple times to join more than one channel. If you want to join the same channel from different devices, ensure that the user IDs are different for all devices.
56
52
  *
57
- * @param token The token generated on your server for authentication. If you need to join different channels at the same time or switch between channels, Agora recommends using a wildcard token so that you don't need to apply for a new token every time joining a channel.
53
+ * @param token The token generated on your server for authentication.
54
+ * (Recommended) If your project has enabled the security mode (using APP ID and Token for authentication), this parameter is required.
55
+ * If you have only enabled the testing mode (using APP ID for authentication), this parameter is optional. You will automatically exit the channel 24 hours after successfully joining in.
56
+ * If you need to join different channels at the same time or switch between channels, Agora recommends using a wildcard token so that you don't need to apply for a new token every time joining a channel.
58
57
  * @param connection The connection information. See RtcConnection.
59
58
  * @param options The channel media options. See ChannelMediaOptions.
60
59
  *
@@ -62,11 +61,11 @@ export abstract class IRtcEngineEx extends IRtcEngine {
62
61
  * 0: Success.
63
62
  * < 0: Failure.
64
63
  * -2: The parameter is invalid. For example, the token is invalid, the uid parameter is not set to an integer, or the value of a member in ChannelMediaOptions is invalid. You need to pass in a valid parameter and join the channel again.
65
- * -3: Failes to initialize the IRtcEngine object. You need to reinitialize the IRtcEngine object.
64
+ * -3: Fails to initialize the IRtcEngine object. You need to reinitialize the IRtcEngine object.
66
65
  * -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine object before calling this method.
67
- * -8: The internal state of the IRtcEngine object is wrong. The typical cause is that you call this method to join the channel without calling startEchoTest to stop the test after calling stopEchoTest to start a call loop test. You need to call stopEchoTest before calling this method.
68
- * -17: The request to join the channel is rejected. The typical cause is that the user is in the channel. Agora recommends that you use the onConnectionStateChanged callback to determine whether the user exists in the channel. Do not call this method to join the channel unless you receive the ConnectionStateDisconnected (1) state.
69
- * -102: The channel name is invalid. You need to pass in a valid channelname in channelId to rejoin the channel.
66
+ * -8: The internal state of the IRtcEngine object is wrong. The typical cause is that after calling startEchoTest to start a call loop test, you call this method to join the channel without calling stopEchoTest to stop the test. You need to call stopEchoTest before calling this method.
67
+ * -17: The request to join the channel is rejected. The typical cause is that the user is already in the channel. Agora recommends that you use the onConnectionStateChanged callback to see whether the user is in the channel. Do not call this method to join the channel unless you receive the ConnectionStateDisconnected (1) state.
68
+ * -102: The channel name is invalid. You need to pass in a valid channel name in channelId to rejoin the channel.
70
69
  * -121: The user ID is invalid. You need to pass in a valid user ID in uid to rejoin the channel.
71
70
  */
72
71
  abstract joinChannelEx(
@@ -103,9 +102,9 @@ export abstract class IRtcEngineEx extends IRtcEngine {
103
102
  * @returns
104
103
  * 0: Success.
105
104
  * < 0: Failure.
106
- * -2: The value of a member in the ChannelMediaOptions structure is invalid. For example, the token or the user ID is invalid. You need to fill in a valid parameter.
105
+ * -2: The value of a member in ChannelMediaOptions is invalid. For example, the token or the user ID is invalid. You need to fill in a valid parameter.
107
106
  * -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine object before calling this method.
108
- * -8: The internal state of the IRtcEngine object is wrong. The possible reason is that the user is not in the channel. Agora recommends that you use the onConnectionStateChanged callback to determine whether the user exists in the channel. If you receive the ConnectionStateDisconnected (1) or ConnectionStateFailed (5) state, the user is not in the channel. You need to call joinChannel to join a channel before calling this method.
107
+ * -8: The internal state of the IRtcEngine object is wrong. The possible reason is that the user is not in the channel. Agora recommends that you use the onConnectionStateChanged callback to see whether the user is in the channel. If you receive the ConnectionStateDisconnected (1) or ConnectionStateFailed (5) state, the user is not in the channel. You need to call joinChannel to join a channel before calling this method.
109
108
  */
110
109
  abstract updateChannelMediaOptionsEx(
111
110
  options: ChannelMediaOptions,
@@ -132,7 +131,8 @@ export abstract class IRtcEngineEx extends IRtcEngine {
132
131
  /**
133
132
  * Initializes the video view of a remote user.
134
133
  *
135
- * This method initializes the video view of a remote stream on the local device. It affects only the video view that the local user sees. Call this method to bind the remote video stream to a video view and to set the rendering and mirror modes of the video view. The application specifies the uid of the remote video in the VideoCanvas method before the remote user joins the channel. If the remote uid is unknown to the application, set it after the application receives the onUserJoined callback. If the Video Recording function is enabled, the Video Recording Service joins the channel as a dummy client, causing other clients to also receive the onUserJoined callback. Do not bind the dummy client to the application view because the dummy client does not send any video streams. To unbind the remote user from the view, set the view parameter to NULL. Once the remote user leaves the channel, the SDK unbinds the remote user. To update the rendering or mirror mode of the remote video view during a call, use the setRemoteRenderModeEx method.
134
+ * This method initializes the video view of a remote stream on the local device. It affects only the video view that the local user sees. Call this method to bind the remote video stream to a video view and to set the rendering and mirror modes of the video view. The application specifies the uid of the remote video in the VideoCanvas method before the remote user joins the channel. If the remote uid is unknown to the application, set it after the application receives the onUserJoined callback. If the Video Recording function is enabled, the Video Recording Service joins the channel as a dummy client, causing other clients to also receive the onUserJoined callback. Do not bind the dummy client to the application view because the dummy client does not send any video streams. To unbind the remote user from the view, set the view parameter to NULL. Once the remote user leaves the channel, the SDK unbinds the remote user.
135
+ * To update the rendering or mirror mode of the remote video view during a call, use the setRemoteRenderModeEx method.
136
136
  *
137
137
  * @param canvas The remote video view settings. See VideoCanvas.
138
138
  * @param connection The connection information. See RtcConnection.
@@ -185,7 +185,10 @@ export abstract class IRtcEngineEx extends IRtcEngine {
185
185
  /**
186
186
  * Sets the video stream type to subscribe to.
187
187
  *
188
- * The SDK will dynamically adjust the size of the corresponding video stream based on the size of the video window to save bandwidth and computing resources. The default aspect ratio of the low-quality video stream is the same as that of the high-quality video stream. According to the current aspect ratio of the high-quality video stream, the system will automatically allocate the resolution, frame rate, and bitrate of the low-quality video stream. The SDK defaults to enabling low-quality video stream adaptive mode (AutoSimulcastStream) on the sending end, which means the sender does not actively send low-quality video stream. The receiver with the role of the host can initiate a low-quality video stream request by calling this method, and upon receiving the request, the sending end automatically starts sending the low-quality video stream.
188
+ * The SDK will dynamically adjust the size of the corresponding video stream based on the size of the video window to save bandwidth and computing resources. The default aspect ratio of the low-quality video stream is the same as that of the high-quality video stream. According to the current aspect ratio of the high-quality video stream, the system will automatically allocate the resolution, frame rate, and bitrate of the low-quality video stream. Depending on the default behavior of the sender and the specific settings when calling setDualStreamMode, the scenarios for the receiver calling this method are as follows:
189
+ * The SDK enables low-quality video stream adaptive mode (AutoSimulcastStream) on the sender side by default, meaning only the high-quality video stream is transmitted. Only the receiver with the role of the host can call this method to initiate a low-quality video stream request. Once the sender receives the request, it starts automatically sending the low-quality video stream. At this point, all users in the channel can call this method to switch to low-quality video stream subscription mode.
190
+ * If the sender calls setDualStreamMode and sets mode to DisableSimulcastStream (never send low-quality video stream), then calling this method will have no effect.
191
+ * If the sender calls setDualStreamMode and sets mode to EnableSimulcastStream (always send low-quality video stream), both the host and audience receivers can call this method to switch to low-quality video stream subscription mode.
189
192
  * If the publisher has already called setDualStreamModeEx and set mode to DisableSimulcastStream (never send low-quality video stream), calling this method will not take effect, you should call setDualStreamModeEx again on the sending end and adjust the settings.
190
193
  * Calling this method on the receiving end of the audience role will not take effect.
191
194
  *
@@ -485,8 +488,6 @@ export abstract class IRtcEngineEx extends IRtcEngine {
485
488
  * Adjusts the playback signal volume of a specified remote user.
486
489
  *
487
490
  * 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.
488
- * Call this method after joining a channel.
489
- * The playback volume here refers to the mixed volume of a specified remote user.
490
491
  *
491
492
  * @param uid The user ID of the remote user.
492
493
  * @param volume The volume of the user. The value range is [0,400].
@@ -518,7 +519,7 @@ export abstract class IRtcEngineEx extends IRtcEngine {
518
519
  /**
519
520
  * Enables or disables the built-in encryption.
520
521
  *
521
- * All users in the same channel must use the same encryption mode and encryption key. After the user leaves the channel, the SDK automatically disables the built-in encryption. To enable the built-in encryption, call this method before the user joins the channel again. In scenarios requiring high security, Agora recommends calling this method to enable the built-in encryption before joining a channel.
522
+ * After the user leaves the channel, the SDK automatically disables the built-in encryption. To enable the built-in encryption, call this method before the user joins the channel again.
522
523
  *
523
524
  * @param connection The connection information. See RtcConnection.
524
525
  * @param enabled Whether to enable built-in encryption: true : Enable the built-in encryption. false : (Default) Disable the built-in encryption.
@@ -552,10 +553,11 @@ export abstract class IRtcEngineEx extends IRtcEngine {
552
553
  /**
553
554
  * Sends data stream messages.
554
555
  *
555
- * After calling createDataStreamEx, you can call this method to send data stream messages to all users in the channel. The SDK has the following restrictions on this method:
556
- * Up to 60 packets can be sent per second in a channel with each packet having a maximum size of 1 KB.
557
- * Each client can send up to 30 KB of data per second.
558
- * Each user can have up to five data streams simultaneously. A successful method call triggers the onStreamMessage callback on the remote client, from which the remote user gets the stream message. A failed method call triggers the onStreamMessageError callback on the remote client.
556
+ * A successful method call triggers the onStreamMessage callback on the remote client, from which the remote user gets the stream message. A failed method call triggers the onStreamMessageError callback on the remote client. The SDK has the following restrictions on this method:
557
+ * Each user can have up to five data streams simultaneously.
558
+ * Up to 60 packets can be sent per second in a data stream with each packet having a maximum size of 1 KB.
559
+ * Up to 30 KB of data can be sent per second in a data stream. After calling createDataStreamEx, you can call this method to send data stream messages to all users in the channel.
560
+ * Call this method after joinChannelEx.
559
561
  * Ensure that you call createDataStreamEx to create a data channel before calling this method.
560
562
  * This method applies only to the COMMUNICATION profile or to the hosts in the LIVE_BROADCASTING profile. If an audience in the LIVE_BROADCASTING profile calls this method, the audience may be switched to a host.
561
563
  *
@@ -630,7 +632,7 @@ export abstract class IRtcEngineEx extends IRtcEngine {
630
632
  /**
631
633
  * Enables the reporting of users' volume indication.
632
634
  *
633
- * This method enables the SDK to regularly report the volume information to the app of the local user who sends a stream and remote users (three users at most) whose instantaneous volumes are the highest. Once you call this method and users send streams in the channel, the SDK triggers the onAudioVolumeIndication callback at the time interval set in this method.
635
+ * This method enables the SDK to regularly report the volume information to the app of the local user who sends a stream and remote users (three users at most) whose instantaneous volumes are the highest.
634
636
  *
635
637
  * @param interval Sets the time interval between two consecutive volume indications:
636
638
  * ≤ 0: Disables the volume indication.
@@ -747,7 +749,6 @@ export abstract class IRtcEngineEx extends IRtcEngine {
747
749
  * < 0: Failure.
748
750
  * -1: A general error occurs (no specified reason).
749
751
  * -2: The parameter is invalid.
750
- * -7: The method call was rejected. It may be because the SDK has not been initialized successfully, or the user role is not a host.
751
752
  * -8: Internal state error. Probably because the user is not a broadcaster.
752
753
  */
753
754
  abstract startOrUpdateChannelMediaRelayEx(
@@ -765,6 +766,7 @@ export abstract class IRtcEngineEx extends IRtcEngine {
765
766
  * @returns
766
767
  * 0: Success.
767
768
  * < 0: Failure.
769
+ * -5: The method call was rejected. There is no ongoing channel media relay.
768
770
  */
769
771
  abstract stopChannelMediaRelayEx(connection: RtcConnection): number;
770
772
 
@@ -778,6 +780,7 @@ export abstract class IRtcEngineEx extends IRtcEngine {
778
780
  * @returns
779
781
  * 0: Success.
780
782
  * < 0: Failure.
783
+ * -5: The method call was rejected. There is no ongoing channel media relay.
781
784
  */
782
785
  abstract pauseAllChannelMediaRelayEx(connection: RtcConnection): number;
783
786
 
@@ -791,6 +794,7 @@ export abstract class IRtcEngineEx extends IRtcEngine {
791
794
  * @returns
792
795
  * 0: Success.
793
796
  * < 0: Failure.
797
+ * -5: The method call was rejected. There is no paused channel media relay.
794
798
  */
795
799
  abstract resumeAllChannelMediaRelayEx(connection: RtcConnection): number;
796
800
 
@@ -831,7 +835,7 @@ export abstract class IRtcEngineEx extends IRtcEngine {
831
835
  /**
832
836
  * Sets the dual-stream mode on the sender side.
833
837
  *
834
- * The SDK defaults to enabling low-quality video stream adaptive mode (AutoSimulcastStream) on the sending end, which means the sender does not actively send low-quality video stream. The receiver with the role of the host can initiate a low-quality video stream request by calling setRemoteVideoStreamTypeEx, and upon receiving the request, the sending end automatically starts sending the low-quality video stream.
838
+ * The SDK defaults to enabling low-quality video stream adaptive mode (AutoSimulcastStream) on the sender side, which means the sender does not actively send low-quality video stream. The receiving end with the role of the host can initiate a low-quality video stream request by calling setRemoteVideoStreamTypeEx, and upon receiving the request, the sending end automatically starts sending low-quality stream.
835
839
  * If you want to modify this behavior, you can call this method and set mode to DisableSimulcastStream (never send low-quality video streams) or EnableSimulcastStream (always send low-quality video streams).
836
840
  * If you want to restore the default behavior after making changes, you can call this method again with mode set to AutoSimulcastStream. The difference and connection between this method and enableDualStreamModeEx is as follows:
837
841
  * When calling this method and setting mode to DisableSimulcastStream, it has the same effect as enableDualStreamModeEx (false).
@@ -871,12 +875,9 @@ export abstract class IRtcEngineEx extends IRtcEngine {
871
875
  ): number;
872
876
 
873
877
  /**
874
- * Takes a snapshot of a video stream.
878
+ * Takes a snapshot of a video stream using connection ID.
875
879
  *
876
- * 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 the onSnapshotTaken callback to report whether the snapshot is successfully taken, as well as the details for that snapshot. This method takes a snapshot of a video stream from the specified user, generates a JPG image, and saves it to the specified path.
877
- * Call this method after the joinChannelEx method.
878
- * When used for local video snapshots, this method takes a snapshot for the video streams specified in ChannelMediaOptions.
879
- * If the user's video has been preprocessed, for example, watermarked or beautified, the resulting snapshot includes the pre-processing effect.
880
+ * This method takes a snapshot of a video stream from the specified user, generates a JPG image, and saves it to the specified path.
880
881
  *
881
882
  * @param connection The connection information. See RtcConnection.
882
883
  * @param uid The user ID. Set uid as 0 if you want to take a snapshot of the local user's video.
@@ -897,10 +898,10 @@ export abstract class IRtcEngineEx extends IRtcEngine {
897
898
  /**
898
899
  * Enables or disables video screenshot and upload.
899
900
  *
900
- * This method can take screenshots for multiple video streams and upload them. When video screenshot and upload function is enabled, the SDK takes screenshots and uploads videos sent by local users based on the type and frequency of the module you set in ContentInspectConfig. After video screenshot and upload, the Agora server sends the callback notification to your app server in HTTPS requests and sends all screenshots to the third-party cloud storage service. Before calling this method, ensure that you have contacted to activate the video screenshot upload service.
901
+ * This method can take screenshots for multiple video streams and upload them. When video screenshot and upload function is enabled, the SDK takes screenshots and uploads videos sent by local users based on the type and frequency of the module you set in ContentInspectConfig. After video screenshot and upload, the Agora server sends the callback notification to your app server in HTTPS requests and sends all screenshots to the third-party cloud storage service.
901
902
  *
902
- * @param enabled Whether to enable video screenshot and upload : true : Enables video screenshot and upload. false : Disables video screenshot and upload.
903
- * @param config Configuration of video screenshot and upload. See ContentInspectConfig. When the video moderation module is set to video moderation via Agora self-developed extension(ContentInspectSupervision), the video screenshot and upload dynamic library libagora_content_inspect_extension.dll is required. Deleting this library disables the screenshot and upload feature.
903
+ * @param enabled Whether to enalbe video screenshot and upload: true : Enables video screenshot and upload. false : Disables video screenshot and upload.
904
+ * @param config Screenshot and upload configuration. See ContentInspectConfig. When the video moderation module is set to video moderation via Agora self-developed extension(ContentInspectSupervision), the video screenshot and upload dynamic library libagora_content_inspect_extension.dll is required. Deleting this library disables the screenshot and upload feature.
904
905
  * @param connection The connection information. See RtcConnection.
905
906
  *
906
907
  * @returns
@@ -938,7 +939,7 @@ export abstract class IRtcEngineEx extends IRtcEngine {
938
939
  /**
939
940
  * Gets the call ID with the connection ID.
940
941
  *
941
- * Call this method after joining a channel. When a user joins a channel on a client, a callId is generated to identify the call from the client. You can call this method to get the callId parameter, and pass it in when calling methods such as rate and complain.
942
+ * When a user joins a channel on a client, a callId is generated to identify the call from the client. You can call this method to get the callId parameter, and pass it in when calling methods such as rate and complain.
942
943
  *
943
944
  * @param connection The connection information. See RtcConnection.
944
945
  *
@@ -193,7 +193,7 @@ export abstract class IAudioDeviceManager {
193
193
  /**
194
194
  * Starts the audio playback device test.
195
195
  *
196
- * This method tests whether the audio device for local playback works properly. Once a user starts the test, the SDK plays an audio file specified by the user. If the user can hear the audio, the playback device works properly. After calling this method, the SDK triggers the onAudioVolumeIndication callback every 100 ms, reporting uid = 1 and the volume information of the playback device. The difference between this method and the startEchoTest method is that the former checks if the local audio playback device is working properly, while the latter can check the audio and video devices and network conditions. Ensure that you call this method before joining a channel. After the test is completed, call stopPlaybackDeviceTest to stop the test before joining a channel.
196
+ * This method tests whether the audio device for local playback works properly. Once a user starts the test, the SDK plays an audio file specified by the user. If the user can hear the audio, the playback device works properly. After calling this method, the SDK triggers the onAudioVolumeIndication callback every 100 ms, reporting uid = 1 and the volume information of the playback device. The difference between this method and the startEchoTest method is that the former checks if the local audio playback device is working properly, while the latter can check the audio and video devices and network conditions. Call this method before joining a channel. After the test is completed, call stopPlaybackDeviceTest to stop the test before joining a channel.
197
197
  *
198
198
  * @param testAudioFilePath The path of the audio file. The data format is string in UTF-8.
199
199
  * Supported file formats: wav, mp3, m4a, and aac.
@@ -208,7 +208,7 @@ export abstract class IAudioDeviceManager {
208
208
  /**
209
209
  * Stops the audio playback device test.
210
210
  *
211
- * This method stops the audio playback device test. You must call this method to stop the test after calling the startPlaybackDeviceTest method. Ensure that you call this method before joining a channel.
211
+ * This method stops the audio playback device test. You must call this method to stop the test after calling the startPlaybackDeviceTest method. Call this method before joining a channel.
212
212
  *
213
213
  * @returns
214
214
  * 0: Success.
@@ -219,7 +219,7 @@ export abstract class IAudioDeviceManager {
219
219
  /**
220
220
  * Starts the audio capturing device test.
221
221
  *
222
- * This method tests whether the audio capturing device works properly. After calling this method, the SDK triggers the onAudioVolumeIndication callback at the time interval set in this method, which reports uid = 0 and the volume information of the capturing device. The difference between this method and the startEchoTest method is that the former checks if the local audio capturing device is working properly, while the latter can check the audio and video devices and network conditions. Ensure that you call this method before joining a channel. After the test is completed, call stopRecordingDeviceTest to stop the test before joining a channel.
222
+ * This method tests whether the audio capturing device works properly. After calling this method, the SDK triggers the onAudioVolumeIndication callback at the time interval set in this method, which reports uid = 0 and the volume information of the capturing device. The difference between this method and the startEchoTest method is that the former checks if the local audio capturing device is working properly, while the latter can check the audio and video devices and network conditions. Call this method before joining a channel. After the test is completed, call stopRecordingDeviceTest to stop the test before joining a channel.
223
223
  *
224
224
  * @param indicationInterval The interval (ms) for triggering the onAudioVolumeIndication callback. This value should be set to greater than 10, otherwise, you will not receive the onAudioVolumeIndication callback and the SDK returns the error code -2. Agora recommends that you set this value to 100.
225
225
  *
@@ -233,7 +233,7 @@ export abstract class IAudioDeviceManager {
233
233
  /**
234
234
  * Stops the audio capturing device test.
235
235
  *
236
- * This method stops the audio capturing device test. You must call this method to stop the test after calling the startRecordingDeviceTest method. Ensure that you call this method before joining a channel.
236
+ * This method stops the audio capturing device test. You must call this method to stop the test after calling the startRecordingDeviceTest method. Call this method before joining a channel.
237
237
  *
238
238
  * @returns
239
239
  * 0: Success.
@@ -2071,27 +2071,6 @@ export class IRtcEngineImpl implements IRtcEngine {
2071
2071
  return 'RtcEngine_muteAllRemoteAudioStreams_5039d15';
2072
2072
  }
2073
2073
 
2074
- setDefaultMuteAllRemoteAudioStreams(mute: boolean): number {
2075
- const apiType =
2076
- this.getApiTypeFromSetDefaultMuteAllRemoteAudioStreams(mute);
2077
- const jsonParams = {
2078
- mute: mute,
2079
- toJSON: () => {
2080
- return {
2081
- mute: mute,
2082
- };
2083
- },
2084
- };
2085
- const jsonResults = callIrisApi.call(this, apiType, jsonParams);
2086
- return jsonResults.result;
2087
- }
2088
-
2089
- protected getApiTypeFromSetDefaultMuteAllRemoteAudioStreams(
2090
- mute: boolean
2091
- ): string {
2092
- return 'RtcEngine_setDefaultMuteAllRemoteAudioStreams_5039d15';
2093
- }
2094
-
2095
2074
  muteRemoteAudioStream(uid: number, mute: boolean): number {
2096
2075
  const apiType = this.getApiTypeFromMuteRemoteAudioStream(uid, mute);
2097
2076
  const jsonParams = {
@@ -2169,27 +2148,6 @@ export class IRtcEngineImpl implements IRtcEngine {
2169
2148
  return 'RtcEngine_muteAllRemoteVideoStreams_5039d15';
2170
2149
  }
2171
2150
 
2172
- setDefaultMuteAllRemoteVideoStreams(mute: boolean): number {
2173
- const apiType =
2174
- this.getApiTypeFromSetDefaultMuteAllRemoteVideoStreams(mute);
2175
- const jsonParams = {
2176
- mute: mute,
2177
- toJSON: () => {
2178
- return {
2179
- mute: mute,
2180
- };
2181
- },
2182
- };
2183
- const jsonResults = callIrisApi.call(this, apiType, jsonParams);
2184
- return jsonResults.result;
2185
- }
2186
-
2187
- protected getApiTypeFromSetDefaultMuteAllRemoteVideoStreams(
2188
- mute: boolean
2189
- ): string {
2190
- return 'RtcEngine_setDefaultMuteAllRemoteVideoStreams_5039d15';
2191
- }
2192
-
2193
2151
  setRemoteDefaultVideoStreamType(streamType: VideoStreamType): number {
2194
2152
  const apiType =
2195
2153
  this.getApiTypeFromSetRemoteDefaultVideoStreamType(streamType);
@@ -1,7 +1,12 @@
1
1
  import { createCheckers } from 'ts-interface-checker';
2
2
 
3
- import { RendererManager } from '../../Renderer/RendererManager';
4
3
  import { AgoraEnv, logError, parseIntPtr2Number } from '../../Utils';
4
+ let RendererManager: any;
5
+ if (typeof window !== 'undefined') {
6
+ RendererManager = require('../../Renderer/RendererManager').RendererManager;
7
+ } else {
8
+ RendererManager = undefined;
9
+ }
5
10
  import {
6
11
  AudioEncodedFrameObserverConfig,
7
12
  ClientRoleOptions,
@@ -90,7 +95,7 @@ export class RtcEngineExInternal extends IRtcEngineExImpl {
90
95
  if (AgoraEnv.webEnvReady) {
91
96
  // @ts-ignore
92
97
  window.AgoraEnv = AgoraEnv;
93
- if (AgoraEnv.AgoraRendererManager === undefined) {
98
+ if (AgoraEnv.AgoraRendererManager === undefined && RendererManager) {
94
99
  AgoraEnv.AgoraRendererManager = new RendererManager();
95
100
  }
96
101
  }
@@ -1,10 +1,15 @@
1
1
  import { VideoMirrorModeType, VideoViewSetupMode } from '../Private/AgoraBase';
2
- import { RenderModeType, VideoSourceType } from '../Private/AgoraMediaBase';
2
+ import {
3
+ RenderModeType,
4
+ VideoModulePosition,
5
+ VideoSourceType,
6
+ } from '../Private/AgoraMediaBase';
3
7
  import { AgoraEnv } from '../Utils';
4
8
 
5
9
  const VIDEO_SOURCE_TYPE_STRING = 'video-source-type';
6
10
  const UID_STRING = 'uid';
7
11
  const CHANNEL_ID_STRING = 'channel-id';
12
+ const POSITION_STRING = 'position';
8
13
  const RENDERER_CONTENT_MODE_STRING = 'renderer-content-mode';
9
14
  const RENDERER_MIRROR_STRING = 'renderer-mirror';
10
15
 
@@ -12,6 +17,7 @@ const observedAttributes = [
12
17
  VIDEO_SOURCE_TYPE_STRING,
13
18
  UID_STRING,
14
19
  CHANNEL_ID_STRING,
20
+ POSITION_STRING,
15
21
  RENDERER_CONTENT_MODE_STRING,
16
22
  RENDERER_MIRROR_STRING,
17
23
  ];
@@ -19,7 +25,7 @@ const observedAttributes = [
19
25
  declare global {
20
26
  /**
21
27
  * Attributes of the Agora custom element.
22
- * You can use this custom element as follows:<agora-view video-source-type="{VideoSourceType.VideoSourceCamera}" channel-id="" uid="{0}"></agora-view>
28
+ * You can use this custom element as follows:<agora-view video-source-type="{VideoSourceType.VideoSourceCamera}" channel-id="" uid="{0}" position="{VideoModulePosition.PositionPreRenderer}"></agora-view>
23
29
  */
24
30
  interface AgoraView {
25
31
  /**
@@ -39,6 +45,10 @@ declare global {
39
45
  * "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "= ", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
40
46
  */
41
47
  'channel-id': string;
48
+ /**
49
+ * The frame position of the video observer.
50
+ */
51
+ 'position': VideoModulePosition;
42
52
  /**
43
53
  * The video display mode.
44
54
  */
@@ -109,6 +119,22 @@ export default class AgoraView extends HTMLElement {
109
119
  }
110
120
  }
111
121
 
122
+ get position(): VideoModulePosition {
123
+ const number = Number(this.getAttribute(POSITION_STRING));
124
+ return isNaN(number)
125
+ ? VideoModulePosition.PositionPreEncoder |
126
+ VideoModulePosition.PositionPreRenderer
127
+ : number;
128
+ }
129
+
130
+ set position(val) {
131
+ if (val) {
132
+ this.setAttribute(POSITION_STRING, String(val));
133
+ } else {
134
+ this.removeAttribute(POSITION_STRING);
135
+ }
136
+ }
137
+
112
138
  get renderMode(): RenderModeType {
113
139
  const number = Number(
114
140
  this.getAttribute(RENDERER_CONTENT_MODE_STRING) ||
@@ -142,12 +168,14 @@ export default class AgoraView extends HTMLElement {
142
168
  }
143
169
 
144
170
  initializeRender = () => {
145
- const { channelId, uid, sourceType, renderMode, renderMirror } = this;
171
+ const { channelId, uid, sourceType, position, renderMode, renderMirror } =
172
+ this;
146
173
  AgoraEnv.AgoraRendererManager?.addOrRemoveRenderer({
147
174
  sourceType,
148
175
  view: this,
149
176
  uid,
150
177
  channelId,
178
+ position,
151
179
  renderMode,
152
180
  mirrorMode: renderMirror
153
181
  ? VideoMirrorModeType.VideoMirrorModeEnabled
@@ -157,9 +185,10 @@ export default class AgoraView extends HTMLElement {
157
185
  };
158
186
 
159
187
  destroyRender = () => {
160
- const { channelId, uid, sourceType } = this;
188
+ const { channelId, uid, sourceType, position } = this;
161
189
  AgoraEnv.AgoraRendererManager?.removeRendererFromCache({
162
190
  channelId,
191
+ position,
163
192
  uid,
164
193
  sourceType,
165
194
  view: this,
@@ -1,5 +1,9 @@
1
1
  import { VideoMirrorModeType, VideoViewSetupMode } from '../Private/AgoraBase';
2
- import { RenderModeType, VideoSourceType } from '../Private/AgoraMediaBase';
2
+ import {
3
+ RenderModeType,
4
+ VideoModulePosition,
5
+ VideoSourceType,
6
+ } from '../Private/AgoraMediaBase';
3
7
  import { RendererContext, RendererType } from '../Types';
4
8
  import { logDebug } from '../Utils';
5
9
 
@@ -86,6 +90,7 @@ export abstract class IRendererManager {
86
90
  sourceType,
87
91
  uid,
88
92
  channelId,
93
+ position,
89
94
  mediaPlayerId,
90
95
  renderMode = this.defaultRenderMode,
91
96
  mirrorMode = this.defaultMirrorMode,
@@ -114,7 +119,20 @@ export abstract class IRendererManager {
114
119
  uid = 0;
115
120
  break;
116
121
  }
117
- return { ...context, sourceType, uid, channelId, renderMode, mirrorMode };
122
+ if (!position) {
123
+ position =
124
+ VideoModulePosition.PositionPreEncoder |
125
+ VideoModulePosition.PositionPreRenderer;
126
+ }
127
+ return {
128
+ ...context,
129
+ position,
130
+ sourceType,
131
+ uid,
132
+ channelId,
133
+ renderMode,
134
+ mirrorMode,
135
+ };
118
136
  }
119
137
 
120
138
  public addOrRemoveRenderer(
@@ -18,7 +18,7 @@ export class RendererCache {
18
18
  private _context: RendererCacheContext;
19
19
  private _enabled: boolean;
20
20
 
21
- constructor({ channelId, uid, sourceType }: RendererContext) {
21
+ constructor({ channelId, uid, sourceType, position }: RendererContext) {
22
22
  this._renderers = [];
23
23
  this._videoFrame = {
24
24
  yBuffer: Buffer.alloc(0),
@@ -31,7 +31,7 @@ export class RendererCache {
31
31
  vStride: 0,
32
32
  rotation: 0,
33
33
  };
34
- this._context = { channelId, uid, sourceType };
34
+ this._context = { channelId, uid, sourceType, position };
35
35
  this._enabled = false;
36
36
  }
37
37
 
package/ts/Types.ts CHANGED
@@ -55,7 +55,7 @@ export type RendererContext = VideoCanvas & RtcConnection;
55
55
 
56
56
  export type RendererCacheContext = Pick<
57
57
  RendererContext,
58
- 'channelId' | 'uid' | 'sourceType'
58
+ 'channelId' | 'uid' | 'sourceType' | 'position'
59
59
  >;
60
60
 
61
61
  /**
@@ -30,7 +30,7 @@ export declare function createAgoraRtcEngine(options?: AgoraEnvOptions): IRtcEng
30
30
  /**
31
31
  * Gets one IMediaPlayerCacheManager instance.
32
32
  *
33
- * When you successfully call this method, the SDK returns a media player cache manager instance. The cache manager is a singleton pattern. Therefore, multiple calls to this method returns the same instance. Make sure the IRtcEngine is initialized before you call this method.
33
+ * Before calling any APIs in the IMediaPlayerCacheManager class, you need to call this method to get a cache manager instance of a media player.
34
34
  *
35
35
  * @returns
36
36
  * The IMediaPlayerCacheManager instance.