trtc-sdk-v5 5.4.0-beta.1 → 5.4.0-beta.3
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/index.d.ts +16 -8
- package/package.json +1 -1
- package/trtc.esm.js +20 -20
- package/trtc.js +1 -1
package/index.d.ts
CHANGED
|
@@ -61,6 +61,8 @@
|
|
|
61
61
|
noiseSuppression?: boolean;
|
|
62
62
|
audioTrack?: MediaStreamTrack;
|
|
63
63
|
videoTrack?: MediaStreamTrack;
|
|
64
|
+
captureElement?: HTMLElement;
|
|
65
|
+
preferDisplaySurface?: 'current-tab' | 'tab' | 'window' | 'monitor';
|
|
64
66
|
qosPreference?: typeof TRTCType.QOS_PREFERENCE_SMOOTH | typeof TRTCType.QOS_PREFERENCE_CLEAR;
|
|
65
67
|
};
|
|
66
68
|
}
|
|
@@ -78,6 +80,8 @@
|
|
|
78
80
|
fillMode?: 'contain' | 'cover' | 'fill';
|
|
79
81
|
mirror?: boolean;
|
|
80
82
|
small?: boolean;
|
|
83
|
+
receiveWhenViewVisible?: boolean;
|
|
84
|
+
viewRoot?: HTMLElement;
|
|
81
85
|
};
|
|
82
86
|
}
|
|
83
87
|
declare interface StopRemoteVideoConfig {
|
|
@@ -854,7 +858,7 @@
|
|
|
854
858
|
}
|
|
855
859
|
class TRTC extends EventEmitter<TRTCEventTypes> {
|
|
856
860
|
/**
|
|
857
|
-
* Create a TRTC object for implementing functions such as entering a room, previewing,
|
|
861
|
+
* Create a TRTC object for implementing functions such as entering a room, previewing, publishing, and subscribing streams.<br>
|
|
858
862
|
*
|
|
859
863
|
* **Note:**
|
|
860
864
|
* - You must create a TRTC object first and call its methods and listen to its events to implement various functions required by the business.
|
|
@@ -910,7 +914,7 @@
|
|
|
910
914
|
* - {@link module:TYPE.ROLE_AUDIENCE TRTC.TYPE.ROLE_AUDIENCE} Audience
|
|
911
915
|
* Note: The audience role does not have the permission to publish local audio and video, only the permission to watch remote streams. If the audience wants to interact with the anchor by connecting to the microphone, please switch the role to the anchor through {@link TRTC#switchRole switchRole()} before publishing local audio and video.
|
|
912
916
|
* @param {boolean} [options.autoReceiveAudio=true] Whether to automatically receive audio. When a remote user publishes audio, the SDK automatically plays the remote user's audio.
|
|
913
|
-
* @param {boolean} [options.autoReceiveVideo=true] Whether to automatically receive video. When a remote user publishes video, the SDK automatically
|
|
917
|
+
* @param {boolean} [options.autoReceiveVideo=true] Whether to automatically receive video. When a remote user publishes video, the SDK automatically subscribes and decodes the remote video. You need to call {@link TRTC#startLocalVideo startLocalVideo} to play the remote video.
|
|
914
918
|
* @param {boolean} [options.enableAutoPlayDialog] Whether to enable the SDK's automatic playback failure dialog box, default: true.
|
|
915
919
|
* - Enabled by default. When automatic playback fails, the SDK will pop up a dialog box to guide the user to click the page to restore audio and video playback.
|
|
916
920
|
* - Can be set to false in order to turn off. Refer to {@tutorial 21-advanced-auto-play-policy}.
|
|
@@ -1303,9 +1307,11 @@
|
|
|
1303
1307
|
* - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream (remote user's camera)
|
|
1304
1308
|
* - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream (remote user's screen sharing)
|
|
1305
1309
|
* @param {object} [config.option] - Remote video configuration
|
|
1306
|
-
* @param {boolean} [config.option.small] - Whether to
|
|
1310
|
+
* @param {boolean} [config.option.small] - Whether to subscribe small streams
|
|
1307
1311
|
* @param {boolean} [config.option.mirror] - Whether to enable mirror
|
|
1308
1312
|
* @param {'contain' | 'cover' | 'fill'} [config.option.fillMode] - Video fill mode. Refer to the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit CSS object-fit} property.
|
|
1313
|
+
* @param {boolean} [config.option.receiveWhenViewVisible] - Since v5.4.0 <br>Subscribe video only when view is visible. Refer to: {@tutorial 27-advanced-small-stream}.
|
|
1314
|
+
* @param {HTMLElement} [config.option.viewRoot=document.body] - Since v5.4.0 <br>The root element is the parent element of the view and is used to calculate whether the view is visible relative to the root. The default value is document.body, and it is recommended that you use the first-level parent of the video view list. Refer to: {@tutorial 27-advanced-small-stream}.
|
|
1309
1315
|
* @throws
|
|
1310
1316
|
* - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
|
|
1311
1317
|
* - {@link module:ERROR_CODE.INVALID_OPERATION INVALID_OPERATION}
|
|
@@ -1332,9 +1338,11 @@
|
|
|
1332
1338
|
* - {@link module:TYPE.STREAM_TYPE_MAIN TRTC.TYPE.STREAM_TYPE_MAIN}: Main stream (remote user's camera)
|
|
1333
1339
|
* - {@link module:TYPE.STREAM_TYPE_SUB TRTC.TYPE.STREAM_TYPE_SUB}: Sub stream (remote user's screen sharing)
|
|
1334
1340
|
* @param {object} [config.option] - Remote video configuration
|
|
1335
|
-
* @param {boolean} [config.option.small] - Whether to
|
|
1341
|
+
* @param {boolean} [config.option.small] - Whether to subscribe small streams. Refer to: {@tutorial 27-advanced-small-stream}.
|
|
1336
1342
|
* @param {boolean} [config.option.mirror] - Whether to enable mirror
|
|
1337
1343
|
* @param {'contain' | 'cover' | 'fill'} [config.option.fillMode] - Video fill mode. Refer to the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit CSS object-fit} property.
|
|
1344
|
+
* @param {boolean} [config.option.receiveWhenViewVisible] - Since v5.4.0 <br>Subscribe video only when view is visible. Refer to: {@tutorial 27-advanced-small-stream}.
|
|
1345
|
+
* @param {HTMLElement} [config.option.viewRoot=document.body] - Since v5.4.0 <br>The root element is the parent element of the view and is used to calculate whether the view is visible relative to the root. The default value is document.body, and it is recommended that you use the first-level parent of the video view list. Refer to: {@tutorial 27-advanced-small-stream}.
|
|
1338
1346
|
* @throws
|
|
1339
1347
|
* - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
|
|
1340
1348
|
* - {@link module:ERROR_CODE.INVALID_OPERATION INVALID_OPERATION}
|
|
@@ -1363,13 +1371,13 @@
|
|
|
1363
1371
|
*/
|
|
1364
1372
|
stopRemoteVideo(config: StopRemoteVideoConfig): Promise<void>;
|
|
1365
1373
|
/**
|
|
1366
|
-
* Mute a remote user and stop
|
|
1374
|
+
* Mute a remote user and stop subscribing audio data from that user. Only effective for the current user, other users in the room can still hear the muted user's voice.<br>
|
|
1367
1375
|
*
|
|
1368
1376
|
* Note:
|
|
1369
1377
|
* - By default, after entering the room, the SDK will automatically play remote audio. You can call this interface to mute or unmute remote users.
|
|
1370
1378
|
* - If the parameter autoReceiveAudio = false is passed in when entering the room, remote audio will not be played automatically. When audio playback is required, you need to call this method (mute is passed in false) to play remote audio.
|
|
1371
1379
|
* - This interface is effective before or after entering the room (enterRoom), and the mute state will be reset to false after exiting the room (exitRoom).
|
|
1372
|
-
* - If you want to continue
|
|
1380
|
+
* - If you want to continue subscribing audio data from the user but not play it, you can call setRemoteAudioVolume(userId, 0)
|
|
1373
1381
|
* @param {string} userId - Remote user ID, '*' represents all users.
|
|
1374
1382
|
* @param {boolean} mute - Whether to mute
|
|
1375
1383
|
* @throws
|
|
@@ -1649,7 +1657,7 @@
|
|
|
1649
1657
|
* <br>
|
|
1650
1658
|
* **Note**
|
|
1651
1659
|
* - This interface does not support use under the http protocol, please use the https protocol to deploy your website. {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#Privacy_and_security Privacy and security}
|
|
1652
|
-
* - Calling this method may temporarily open the camera to ensure that the camera list can be normally obtained, and the SDK will automatically
|
|
1660
|
+
* - Calling this method may temporarily open the camera to ensure that the camera list can be normally obtained, and the SDK will automatically stop the camera capture later.
|
|
1653
1661
|
* - You can call the browser's native interface [getCapabilities](https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceInfo/getCapabilities) to get the maximum resolutions supported by the camera, frame rate, mobile devices to distinguish between front and rear cameras, etc. This interface supports Chrome 67+, Edge 79+, Safari 17+, Opera 54+.
|
|
1654
1662
|
* @example
|
|
1655
1663
|
* const cameraList = await TRTC.getCameraList();
|
|
@@ -1672,7 +1680,7 @@
|
|
|
1672
1680
|
* <br>
|
|
1673
1681
|
* **Note**
|
|
1674
1682
|
* - This interface does not support use under the http protocol, please use the https protocol to deploy your website. {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#Privacy_and_security Privacy and security}
|
|
1675
|
-
* - Calling this method may temporarily open the microphone to ensure that the microphone list can be normally obtained, and the SDK will automatically
|
|
1683
|
+
* - Calling this method may temporarily open the microphone to ensure that the microphone list can be normally obtained, and the SDK will automatically stop the microphone capture later.
|
|
1676
1684
|
* - You can call the browser's native interface [getCapabilities](https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceInfo/getCapabilities) to get information about the microphone's capabilities, e.g. the maximum number of channels supported, etc. This interface supports Chrome 67+, Edge 79+, Safari 17+, Opera 54+.
|
|
1677
1685
|
* @example
|
|
1678
1686
|
* const microphoneList = await TRTC.getMicrophoneList();
|