agora-electron-sdk 4.4.0-dev.1 → 4.4.0-dev.2
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.
- package/CHANGELOG.md +12 -0
- package/js/AgoraSdk.js +1 -1
- package/js/Private/AgoraBase.js +7 -7
- package/js/Private/AgoraMediaBase.js +29 -3
- package/js/Private/IAgoraLog.js +4 -0
- package/js/Private/IAgoraRhythmPlayer.js +12 -12
- package/js/Private/impl/IAgoraRtcEngineImpl.js +0 -32
- package/js/Private/internal/RtcEngineExInternal.js +9 -3
- package/js/Renderer/AgoraView.js +21 -2
- package/js/Renderer/IRendererManager.js +15 -2
- package/js/Renderer/RendererCache.js +2 -2
- package/package.json +9 -5
- package/scripts/downloadPrebuild.js +9 -3
- package/ts/AgoraSdk.ts +1 -1
- package/ts/Private/AgoraBase.ts +13 -9
- package/ts/Private/AgoraMediaBase.ts +51 -35
- package/ts/Private/IAgoraLog.ts +4 -0
- package/ts/Private/IAgoraMediaEngine.ts +8 -19
- package/ts/Private/IAgoraMediaPlayer.ts +2 -0
- package/ts/Private/IAgoraRhythmPlayer.ts +12 -12
- package/ts/Private/IAgoraRtcEngine.ts +114 -119
- package/ts/Private/IAgoraRtcEngineEx.ts +20 -17
- package/ts/Private/IAudioDeviceManager.ts +4 -4
- package/ts/Private/impl/IAgoraRtcEngineImpl.ts +0 -42
- package/ts/Private/internal/RtcEngineExInternal.ts +7 -2
- package/ts/Renderer/AgoraView.ts +33 -4
- package/ts/Renderer/IRendererManager.ts +20 -2
- package/ts/Renderer/RendererCache.ts +2 -2
- package/ts/Types.ts +1 -1
- package/types/AgoraSdk.d.ts +1 -1
- package/types/Private/AgoraBase.d.ts +13 -9
- package/types/Private/AgoraBase.d.ts.map +1 -1
- package/types/Private/AgoraMediaBase.d.ts +50 -35
- package/types/Private/AgoraMediaBase.d.ts.map +1 -1
- package/types/Private/IAgoraLog.d.ts +5 -1
- package/types/Private/IAgoraLog.d.ts.map +1 -1
- package/types/Private/IAgoraMediaEngine.d.ts +8 -19
- package/types/Private/IAgoraMediaEngine.d.ts.map +1 -1
- package/types/Private/IAgoraMediaPlayer.d.ts +2 -0
- package/types/Private/IAgoraMediaPlayer.d.ts.map +1 -1
- package/types/Private/IAgoraRhythmPlayer.d.ts +12 -12
- package/types/Private/IAgoraRtcEngine.d.ts +114 -117
- package/types/Private/IAgoraRtcEngine.d.ts.map +1 -1
- package/types/Private/IAgoraRtcEngineEx.d.ts +20 -17
- package/types/Private/IAgoraRtcEngineEx.d.ts.map +1 -1
- package/types/Private/IAudioDeviceManager.d.ts +4 -4
- package/types/Private/impl/IAgoraRtcEngineImpl.d.ts +0 -4
- package/types/Private/impl/IAgoraRtcEngineImpl.d.ts.map +1 -1
- package/types/Private/internal/RtcEngineExInternal.d.ts.map +1 -1
- package/types/Renderer/AgoraView.d.ts +8 -2
- package/types/Renderer/AgoraView.d.ts.map +1 -1
- package/types/Renderer/IRendererManager.d.ts.map +1 -1
- package/types/Renderer/RendererCache.d.ts +1 -1
- package/types/Renderer/RendererCache.d.ts.map +1 -1
- package/types/Types.d.ts +1 -1
- package/types/Types.d.ts.map +1 -1
|
@@ -62,11 +62,11 @@ export abstract class IRtcEngineEx extends IRtcEngine {
|
|
|
62
62
|
* 0: Success.
|
|
63
63
|
* < 0: Failure.
|
|
64
64
|
* -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:
|
|
65
|
+
* -3: Fails to initialize the IRtcEngine object. You need to reinitialize the IRtcEngine object.
|
|
66
66
|
* -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
|
|
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
|
|
69
|
-
* -102: The channel name is invalid. You need to pass in a valid
|
|
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 stopEchoTest to stop the test after calling startEchoTest 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 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.
|
|
69
|
+
* -102: The channel name is invalid. You need to pass in a valid channel name in channelId to rejoin the channel.
|
|
70
70
|
* -121: The user ID is invalid. You need to pass in a valid user ID in uid to rejoin the channel.
|
|
71
71
|
*/
|
|
72
72
|
abstract joinChannelEx(
|
|
@@ -103,9 +103,9 @@ export abstract class IRtcEngineEx extends IRtcEngine {
|
|
|
103
103
|
* @returns
|
|
104
104
|
* 0: Success.
|
|
105
105
|
* < 0: Failure.
|
|
106
|
-
* -2: The value of a member in
|
|
106
|
+
* -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
107
|
* -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
|
|
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 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
109
|
*/
|
|
110
110
|
abstract updateChannelMediaOptionsEx(
|
|
111
111
|
options: ChannelMediaOptions,
|
|
@@ -132,7 +132,8 @@ export abstract class IRtcEngineEx extends IRtcEngine {
|
|
|
132
132
|
/**
|
|
133
133
|
* Initializes the video view of a remote user.
|
|
134
134
|
*
|
|
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.
|
|
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.
|
|
136
|
+
* To update the rendering or mirror mode of the remote video view during a call, use the setRemoteRenderModeEx method.
|
|
136
137
|
*
|
|
137
138
|
* @param canvas The remote video view settings. See VideoCanvas.
|
|
138
139
|
* @param connection The connection information. See RtcConnection.
|
|
@@ -518,7 +519,7 @@ export abstract class IRtcEngineEx extends IRtcEngine {
|
|
|
518
519
|
/**
|
|
519
520
|
* Enables or disables the built-in encryption.
|
|
520
521
|
*
|
|
521
|
-
*
|
|
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,10 @@ export abstract class IRtcEngineEx extends IRtcEngine {
|
|
|
552
553
|
/**
|
|
553
554
|
* Sends data stream messages.
|
|
554
555
|
*
|
|
555
|
-
*
|
|
556
|
-
*
|
|
557
|
-
*
|
|
558
|
-
*
|
|
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.
|
|
559
560
|
* Ensure that you call createDataStreamEx to create a data channel before calling this method.
|
|
560
561
|
* 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
562
|
*
|
|
@@ -747,7 +748,6 @@ export abstract class IRtcEngineEx extends IRtcEngine {
|
|
|
747
748
|
* < 0: Failure.
|
|
748
749
|
* -1: A general error occurs (no specified reason).
|
|
749
750
|
* -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
751
|
* -8: Internal state error. Probably because the user is not a broadcaster.
|
|
752
752
|
*/
|
|
753
753
|
abstract startOrUpdateChannelMediaRelayEx(
|
|
@@ -765,6 +765,7 @@ export abstract class IRtcEngineEx extends IRtcEngine {
|
|
|
765
765
|
* @returns
|
|
766
766
|
* 0: Success.
|
|
767
767
|
* < 0: Failure.
|
|
768
|
+
* -5: The method call was rejected. There is no ongoing channel media relay.
|
|
768
769
|
*/
|
|
769
770
|
abstract stopChannelMediaRelayEx(connection: RtcConnection): number;
|
|
770
771
|
|
|
@@ -778,6 +779,7 @@ export abstract class IRtcEngineEx extends IRtcEngine {
|
|
|
778
779
|
* @returns
|
|
779
780
|
* 0: Success.
|
|
780
781
|
* < 0: Failure.
|
|
782
|
+
* -5: The method call was rejected. There is no ongoing channel media relay.
|
|
781
783
|
*/
|
|
782
784
|
abstract pauseAllChannelMediaRelayEx(connection: RtcConnection): number;
|
|
783
785
|
|
|
@@ -791,6 +793,7 @@ export abstract class IRtcEngineEx extends IRtcEngine {
|
|
|
791
793
|
* @returns
|
|
792
794
|
* 0: Success.
|
|
793
795
|
* < 0: Failure.
|
|
796
|
+
* -5: The method call was rejected. There is no paused channel media relay.
|
|
794
797
|
*/
|
|
795
798
|
abstract resumeAllChannelMediaRelayEx(connection: RtcConnection): number;
|
|
796
799
|
|
|
@@ -897,10 +900,10 @@ export abstract class IRtcEngineEx extends IRtcEngine {
|
|
|
897
900
|
/**
|
|
898
901
|
* Enables or disables video screenshot and upload.
|
|
899
902
|
*
|
|
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.
|
|
903
|
+
* 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
904
|
*
|
|
902
|
-
* @param enabled Whether to
|
|
903
|
-
* @param config
|
|
905
|
+
* @param enabled Whether to enalbe video screenshot and upload: true : Enables video screenshot and upload. false : Disables video screenshot and upload.
|
|
906
|
+
* @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
907
|
* @param connection The connection information. See RtcConnection.
|
|
905
908
|
*
|
|
906
909
|
* @returns
|
|
@@ -938,7 +941,7 @@ export abstract class IRtcEngineEx extends IRtcEngine {
|
|
|
938
941
|
/**
|
|
939
942
|
* Gets the call ID with the connection ID.
|
|
940
943
|
*
|
|
941
|
-
*
|
|
944
|
+
* 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
945
|
*
|
|
943
946
|
* @param connection The connection information. See RtcConnection.
|
|
944
947
|
*
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
}
|
package/ts/Renderer/AgoraView.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { VideoMirrorModeType, VideoViewSetupMode } from '../Private/AgoraBase';
|
|
2
|
-
import {
|
|
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 } =
|
|
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 {
|
|
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
|
-
|
|
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
package/types/AgoraSdk.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export declare function createAgoraRtcEngine(options?: AgoraEnvOptions): IRtcEng
|
|
|
30
30
|
/**
|
|
31
31
|
* Gets one IMediaPlayerCacheManager instance.
|
|
32
32
|
*
|
|
33
|
-
*
|
|
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.
|
|
@@ -231,7 +231,7 @@ export declare enum ErrorCodeType {
|
|
|
231
231
|
ErrNetDown = 14,
|
|
232
232
|
/**
|
|
233
233
|
* 17: The request to join the channel is rejected. Possible reasons include the following:
|
|
234
|
-
* The user is already in the channel. Agora recommends that you use the onConnectionStateChanged callback to
|
|
234
|
+
* 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.
|
|
235
235
|
* After calling startEchoTest for the call test, the user tries to join the channel without calling stopEchoTest to end the current test. To join a channel, the call test must be ended by calling stopEchoTest.
|
|
236
236
|
*/
|
|
237
237
|
ErrJoinChannelRejected = 17,
|
|
@@ -1259,6 +1259,10 @@ export declare class AdvanceOptions {
|
|
|
1259
1259
|
* Compression preference for video encoding. See CompressionPreference.
|
|
1260
1260
|
*/
|
|
1261
1261
|
compressionPreference?: CompressionPreference;
|
|
1262
|
+
/**
|
|
1263
|
+
* Whether to encode and send the Alpha data present in the video frame to the remote end: true : Encode and send Alpha data. false : (Default) Do not encode and send Alpha data.
|
|
1264
|
+
*/
|
|
1265
|
+
encodeAlpha?: boolean;
|
|
1262
1266
|
}
|
|
1263
1267
|
/**
|
|
1264
1268
|
* Video mirror mode.
|
|
@@ -1389,7 +1393,7 @@ export declare class VideoEncoderConfiguration {
|
|
|
1389
1393
|
*/
|
|
1390
1394
|
orientationMode?: OrientationMode;
|
|
1391
1395
|
/**
|
|
1392
|
-
* Video degradation preference under limited bandwidth. See DegradationPreference.
|
|
1396
|
+
* Video degradation preference under limited bandwidth. See DegradationPreference. When this parameter is set to MaintainFramerate (1) or MaintainBalanced (2), orientationMode needs to be set to OrientationModeAdaptive (0) at the same time, otherwise the setting will not take effect.
|
|
1393
1397
|
*/
|
|
1394
1398
|
degradationPreference?: DegradationPreference;
|
|
1395
1399
|
/**
|
|
@@ -1879,7 +1883,7 @@ export declare enum AudioScenarioType {
|
|
|
1879
1883
|
*/
|
|
1880
1884
|
AudioScenarioGameStreaming = 3,
|
|
1881
1885
|
/**
|
|
1882
|
-
* 5: Chatroom scenario, where users need to frequently switch the user role or mute and unmute the microphone. For example, education scenarios.
|
|
1886
|
+
* 5: Chatroom scenario, where users need to frequently switch the user role or mute and unmute the microphone. For example, education scenarios.
|
|
1883
1887
|
*/
|
|
1884
1888
|
AudioScenarioChatroom = 5,
|
|
1885
1889
|
/**
|
|
@@ -1959,7 +1963,7 @@ export declare enum VideoApplicationScenarioType {
|
|
|
1959
1963
|
*/
|
|
1960
1964
|
ApplicationScenarioGeneral = 0,
|
|
1961
1965
|
/**
|
|
1962
|
-
* If set to ApplicationScenarioMeeting (1), the SDK automatically enables the following strategies:
|
|
1966
|
+
* ApplicationScenarioMeeting (1) is suitable for meeting scenarios. If set to ApplicationScenarioMeeting (1), the SDK automatically enables the following strategies:
|
|
1963
1967
|
* In meeting scenarios where low-quality video streams are required to have a high bitrate, the SDK automatically enables multiple technologies used to deal with network congestions, to enhance the performance of the low-quality streams and to ensure the smooth reception by subscribers.
|
|
1964
1968
|
* The SDK monitors the number of subscribers to the high-quality video stream in real time and dynamically adjusts its configuration based on the number of subscribers.
|
|
1965
1969
|
* If nobody subscribers to the high-quality stream, the SDK automatically reduces its bitrate and frame rate to save upstream bandwidth.
|
|
@@ -3309,7 +3313,7 @@ export declare enum ConnectionChangedReasonType {
|
|
|
3309
3313
|
*/
|
|
3310
3314
|
export declare enum ClientRoleChangeFailedReason {
|
|
3311
3315
|
/**
|
|
3312
|
-
* 1: The number of hosts in the channel
|
|
3316
|
+
* 1: The number of hosts in the channel exceeds the limit. This enumerator is reported only when the support for 128 users is enabled. The maximum number of hosts is based on the actual number of hosts configured when you enable the 128-user feature.
|
|
3313
3317
|
*/
|
|
3314
3318
|
ClientRoleChangeFailedTooManyBroadcasters = 1,
|
|
3315
3319
|
/**
|
|
@@ -3317,11 +3321,11 @@ export declare enum ClientRoleChangeFailedReason {
|
|
|
3317
3321
|
*/
|
|
3318
3322
|
ClientRoleChangeFailedNotAuthorized = 2,
|
|
3319
3323
|
/**
|
|
3320
|
-
* 3: The request is timed out. Agora recommends you prompt the user to check the network connection and try to switch their user role again.
|
|
3324
|
+
* 3: The request is timed out. Agora recommends you prompt the user to check the network connection and try to switch their user role again. Deprecated: This enumerator is deprecated since v4.4.0 and is not recommended for use.
|
|
3321
3325
|
*/
|
|
3322
3326
|
ClientRoleChangeFailedRequestTimeOut = 3,
|
|
3323
3327
|
/**
|
|
3324
|
-
* 4: The SDK
|
|
3328
|
+
* 4: The SDK is disconnected from the Agora edge server. You can troubleshoot the failure through the reason reported by onConnectionStateChanged. Deprecated: This enumerator is deprecated since v4.4.0 and is not recommended for use.
|
|
3325
3329
|
*/
|
|
3326
3330
|
ClientRoleChangeFailedConnectionFailed = 4
|
|
3327
3331
|
}
|
|
@@ -3477,7 +3481,7 @@ export declare class VideoCanvas {
|
|
|
3477
3481
|
*/
|
|
3478
3482
|
cropArea?: Rectangle;
|
|
3479
3483
|
/**
|
|
3480
|
-
* (Optional) Whether
|
|
3484
|
+
* (Optional) Whether to enable alpha mask rendering: true : Enable alpha mask rendering. false : (Default) Disable alpha mask rendering. Alpha mask rendering can create images with transparent effects and extract portraits from videos. When used in combination with other methods, you can implement effects such as portrait-in-picture and watermarking.
|
|
3481
3485
|
* The receiver can render alpha channel information only when the sender enables alpha transmission.
|
|
3482
3486
|
* To enable alpha transmission,.
|
|
3483
3487
|
*/
|
|
@@ -3727,7 +3731,7 @@ export declare class ColorEnhanceOptions {
|
|
|
3727
3731
|
*/
|
|
3728
3732
|
export declare enum BackgroundSourceType {
|
|
3729
3733
|
/**
|
|
3730
|
-
* 0: Process the background as alpha
|
|
3734
|
+
* 0: Process the background as alpha data without replacement, only separating the portrait and the background. After setting this value, you can call startLocalVideoTranscoder to implement the picture-in-picture effect.
|
|
3731
3735
|
*/
|
|
3732
3736
|
BackgroundNone = 0,
|
|
3733
3737
|
/**
|