@byteplus/rtc 4.42.2 → 4.42.4

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 CHANGED
@@ -15,28 +15,16 @@ declare enum ErrorCode {
15
15
  INVALID_PARAMS = "INVALID_PARAMS",
16
16
 
17
17
  /**
18
- * @brief Invalid Token
18
+ * @brief Token is invalid or has expired.
19
19
  */
20
20
  INVALID_TOKEN = "INVALID_TOKEN",
21
-
22
- /**
23
- * @brief Token expired.
24
- */
25
21
  EXPIRED_TOKEN = "EXPIRED_TOKEN",
26
22
 
27
23
  /**
28
24
  * @brief Failure of joining room
29
25
  */
30
26
  JOIN_ROOM_FAILED = "JOIN_ROOM_FAILED",
31
-
32
- /**
33
- * @brief Fail to update Token failed because the Token is invalid.
34
- */
35
27
  UPDATE_TOKEN_WITH_INVALID_TOKEN = "UPDATE_TOKEN_WITH_INVALID_TOKEN",
36
-
37
- /**
38
- * @brief Fail to update Token failed because the user has not joined any room.
39
- */
40
28
  UPDATE_TOKEN_BEFORE_JOIN = "UPDATE_TOKEN_BEFORE_JOIN",
41
29
 
42
30
  /**
@@ -258,15 +246,7 @@ declare enum ErrorCode {
258
246
  * @brief Unknown error
259
247
  */
260
248
  UNEXPECTED_ERROR = "UNEXPECTED_ERROR",
261
-
262
- /**
263
- * @brief You have started another device test while the current one is still ongoing.
264
- */
265
249
  REPEAT_DEVICE_TEST = "REPEAT_DEVICE_TEST",
266
-
267
- /**
268
- * @brief The audio device test failed.
269
- */
270
250
  AUDIO_DEVICE_TEST_FAILED = "AUDIO_DEVICE_RECORD_FAILED",
271
251
 
272
252
  /**
@@ -1958,11 +1938,6 @@ export interface IEngineEvents {
1958
1938
  * @region Message Event
1959
1939
  */
1960
1940
  [EngineEventsTypes.onUserBinaryMessageReceivedOutsideRoom]: (event: UserBinaryMessageEvent) => void;
1961
-
1962
- /**
1963
- * @brief You will receive this callback 30 s before the Token expires.
1964
- * Call [updateToken](104478#updatetoken) to submit a new Token。The user will be removed from the room when the Token expires.
1965
- */
1966
1941
  [EngineEventsTypes.onTokenWillExpire]: () => void;
1967
1942
 
1968
1943
  /**
@@ -1973,7 +1948,7 @@ export interface IEngineEvents {
1973
1948
 
1974
1949
  /**
1975
1950
  * @brief Callback of the result of publishing the public stream.
1976
- * After calling [startPushPublicStream](104478#startpushpublicstream), you will be informed of the result through this callback.
1951
+ * After calling [startPushPublicStream](#startpushpublicstream), you will be informed of the result through this callback.
1977
1952
  * @param event
1978
1953
  */
1979
1954
  [EngineEventsTypes.onPushPublicStreamResult]: (event: PublicStreamResultEvent) => void;
@@ -1981,7 +1956,7 @@ export interface IEngineEvents {
1981
1956
  /**
1982
1957
  * @hidden
1983
1958
  * @brief Callback of the SEI carried by the public video stream.
1984
- * You will receive SEI by this callback if the public stream you subscribed to by calling [startPlayPublicStream](104478#startplaypublicstream) is carrying SEI.
1959
+ * You will receive SEI by this callback if the public stream you subscribed to by calling [startPlayPublicStream](#startplaypublicstream) is carrying SEI.
1985
1960
  * @param event
1986
1961
  * @notes When multiple streams in the public stream contain SEI:
1987
1962
  * + You will receive SEI from all the video frames if the SEI do not have conflicts.
@@ -1991,14 +1966,14 @@ export interface IEngineEvents {
1991
1966
 
1992
1967
  /**
1993
1968
  * @brief Callback of the successful decoding of the first video frame of the public stream.
1994
- * Refer to [startPlayPublicStream](104478#startplaypublicstream) for details about subscribing to a public stream.
1969
+ * Refer to [startPlayPublicStream](#startplaypublicstream) for details about subsribing to a public stream.
1995
1970
  * @param event
1996
1971
  */
1997
1972
  [EngineEventsTypes.onFirstPublicStreamVideoFrameDecoded]: (event: PublicStreamVideoFirstFrameDecodedEvent) => void;
1998
1973
 
1999
1974
  /**
2000
1975
  * @brief Callback of the successful decoding of the first audio frame of the public stream.
2001
- * Refer to [startPlayPublicStream](104478#startplaypublicstream) for details about subscribing to a public stream.
1976
+ * Refer to [startPlayPublicStream](#startplaypublicstream) for details about subsribing to a public stream.
2002
1977
  * @param event
2003
1978
  */
2004
1979
  [EngineEventsTypes.onFirstPublicStreamAudioFrameDecoded]: (event: PublicStreamAudioFirstFrameDecodedEvent) => void;
@@ -2008,12 +1983,6 @@ export interface IEngineEvents {
2008
1983
  * @param event
2009
1984
  */
2010
1985
  [EngineEventsTypes.onFirstPublicStreamVideoFrameRendered]: (event: PublicStreamAudioFirstFrameDecodedEvent) => void;
2011
-
2012
- /**
2013
- * @brief Notification on the playing volume during the test for the local audio devices
2014
- * @param volume playing volume during the test for the local audio devices in milliseconds. We recommend to set it to 200 ms.The range is [0,255].
2015
- * @notes Start an audio-device test by calling [startAudioPlaybackDeviceTest](104478#startaudioplaybackdevicetest) or [startAudioDeviceRecordTest](104478#startaudiodevicerecordtest) will register this callback for regular notification on playing volume. You can set the time interval between each callback by passing a proper value when calling the API above.
2016
- */
2017
1986
  [EngineEventsTypes.onAudioPlaybackDeviceTestVolume]: (volume: number) => void;
2018
1987
  }
2019
1988
 
@@ -2066,6 +2035,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
2066
2035
  * @region Room Management
2067
2036
  */
2068
2037
  joinRoom(token: string | null, roomId: string, userInfo: UserInfo, roomConfig: RoomConfig): Promise<void>;
2038
+ setConnectionMode(mode: ConnectionMode): void;
2069
2039
 
2070
2040
  /**
2071
2041
  * @brief Leave the room. <br>
@@ -2134,11 +2104,11 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
2134
2104
 
2135
2105
  /**
2136
2106
  * @brief Update Token. <br>
2137
- * You will receive [onTokenWillExpire](104479#ontokenwillexpire) 30 s before the Token expires. Call this API to submit a new Token.
2107
+ * Call this API to update the Token information of the room when the Token expires <br>
2138
2108
  * @param token A valid token <br>
2139
2109
  * @notes + If you call [joinRoom](#joinroom) with an expired token, the joining will fail with an error code `INVALID_TOKEN`. And you need to obtain a valid token and call this API to update the token. <br>
2140
2110
  * + If joining a room failed because the token expired, call this API with an updated token. And then RTC SDK will automatically rejoin the room without calling [joinRoom](#joinroom) again. <br>
2141
- * + The user will be removed from the room when the Token expires.
2111
+ * + You have no need to worry about the token expiration after the user joining successfully. Because RTC SDK only verifies the token when the user joins.
2142
2112
  * @region Room Management
2143
2113
  */
2144
2114
  updateToken(token: string): void;
@@ -2162,11 +2132,11 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
2162
2132
  switchCamera(deviceId: string): Promise<void>;
2163
2133
 
2164
2134
  /**
2165
- * @brief Enable internal video capture. The default state is off.
2135
+ * @brief Enable internal video capture. The default state is off. <br>
2166
2136
  * Internal video capture refers to: capturing video using the built-in module.
2167
- * The remote clients in the room will be informed of the state change via [onUserStartVideoCapture](104479#onuserstartvideocapture) after the publisher starts video capture by calling this API.
2137
+ * The remote clients in the room will be informed of the state change via [onUserStartVideoCapture](104479#onuserstartvideocapture) after the publisher starts video capture by calling this API.<br>
2168
2138
  * @param deviceId ID of the device need to enable which you can call [getDevices](#getdevices) to obtain.
2169
- * @return The actual effective video capture parameters. See [MediaTrackSettings](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints). Pay attention to the properties: `frameRate`, `height`, and `width`.
2139
+ * @return
2170
2140
  * @notes + Call [stopVideoCapture](#stopvideocapture) to stop the internal video capture. Otherwise, the internal video capture will sustain until you destroy the engine instance.<br>
2171
2141
  * + Once you create the engine instance, you can start internal video capture regardless of the video publishing state. The video stream will start publishing only after the video capture starts. <br>
2172
2142
  * + Call [switchCamera](#switchcamera) to switch the camera used by the internal video capture module.<br>
@@ -2191,7 +2161,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
2191
2161
  * The remote clients in the room will be informed of the state change via [onUserStartAudioCapture](104479#onuserstartaudiocapture) after the publisher starts audio capture by calling this API.
2192
2162
  * @param deviceId ID of the device need to enable which you can call [getDevices](#getdevices) to obtain.
2193
2163
  * @return
2194
- * @notes + Call [stopAudioCapture](#stopaudiocapture) to stop the internal audio capture. Otherwise, the internal audio capture will sustain until you destroy the engine instance. <br>
2164
+ * @notes + Call [stopVideoCapture](#stopvideocapture) to stop the internal audio capture. Otherwise, the internal audio capture will sustain until you destroy the engine instance. <br>
2195
2165
  * + Once you create the engine instance, you can start internal audio capture regardless of the audio publishing state. The audio stream will start publishing only after the audio capture starts. <br>
2196
2166
  * @region Audio Management
2197
2167
  */
@@ -2392,23 +2362,15 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
2392
2362
  sendSEIMessage(streamIndex: StreamIndex, message: Uint8Array | string, repeatCount: number): void;
2393
2363
 
2394
2364
  /**
2395
- * @region Video Management
2396
- * @brief Sets the video encoder configuration of the publishing streams.
2365
+ * @brief Sets the video encoder configuration of each individual stream for simulcasting, including resolution, frame rate, bitrate, scale mode, fallback strategy under poor network conditions.
2397
2366
  * @param streamIndex
2398
- * @param descriptions The max parameters of the video stream.
2399
- * When you call [enableSimulcastMode](#enableSimulcastMode) and enable simulcasting, you can call this API to set the parameters of the multiple video streams. The length of `descriptions` is no more than 3. The code rate of the parameters must be in descending order.
2400
- * When the resolution of the max stream is in [540P, 1080P], you can simulcast 3 streams; when in [270P, 450P], you can simulcast 2 streams; when in [0, 180P], you can not enable simulcast.
2401
- * @notes For the video stream captured by the camera, the default value is 360P, 15FPS; for the screen-sharing stream, the default value is 1080P, 15FPS.
2367
+ * @param descriptions Video parameters of each individual stream for simulcasting.
2368
+ * The length of `VideoEncoderConfig` is no more than 3. The resolutions must be in descending sort.
2369
+ * @notes + The video streams are encoded by default with a bitrate of 500bps. <br>
2370
+ * + The screen stream takes the first set of parameters. <br>
2371
+ * @region Media Transmission
2402
2372
  */
2403
2373
  setVideoEncoderConfig(streamIndex: StreamIndex, descriptions: VideoEncoderConfig | VideoEncoderConfig[]): Promise<void>;
2404
-
2405
- /**
2406
- * @region Video Management
2407
- * @brief Enables the simulcast mode of the video stream captured by the camera at the publishing end.imulcasting, including resolution, frame rate, bitrate, scale mode, fallback strategy under poor network conditions.
2408
- * @param enabled
2409
- * @param + You must call this API before publishing the video streams. <br>
2410
- * + After enabling the simulcast mode, SDK automatically sets the encoding parameters for the video streams. For manual setting, call [setVideoEncoderConfig](#setVideoEncoderConfig).
2411
- */
2412
2374
  enableSimulcastMode(enabled: boolean): boolean;
2413
2375
 
2414
2376
  /**
@@ -2708,17 +2670,6 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
2708
2670
  * @param videoPlayerOption Player information and rendering mode.
2709
2671
  */
2710
2672
  setPublicStreamVideoPlayer(publicStreamId: string, videoPlayerOption: Omit<VideoPlayerOption, "userId">): void;
2711
-
2712
- /**
2713
- * @region Video Management
2714
- * @brief Set the placeholder image during local video capture pause
2715
- * @param index
2716
- * @param filePath Image path in Http protocal; or Blob object.
2717
- * The format of the image can be: JPG, PNG, or BMP.
2718
- * When the ratio of the image is not the same as the video encoder configuration, the image will be resized with fixed ratio until the width and the height are no more than that of the encoder configuration.
2719
- * @return + It's recommended to call this API before stopping video capture to avoid blank frame in video recording. <br>
2720
- * + You cannot see the image during local preview.
2721
- */
2722
2673
  setDummyCaptureImagePath(index: StreamIndex, filePath: string): Promise<void>;
2723
2674
 
2724
2675
  /**
@@ -2726,46 +2677,10 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
2726
2677
  * @return The default parameters of `LiveTranscodeConfig`
2727
2678
  */
2728
2679
  defaultTranscoding(): Required<LiveTranscodeConfig>;
2729
-
2730
- /**
2731
- * @brief Start the playback test for the local audio device. RTC will start playing the audio file specified. And RTC will notify the audio volume via the [onAudioPlaybackDeviceTestVolume](104479#onaudioplaybackdevicetestvolume) periodically.
2732
- * @param filePath Specify the path of the audio file for the playback test, including *.wav and *.mp3.
2733
- * @param indicationInterval The time interval between each callback in milliseconds. We recommend setting it to 200 ms. The minimal value is 100 ms.
2734
- * @return Resolve when the test ends.
2735
- * @notes + You can call this API whether the user is in the room.
2736
- * + Call [stopAudioPlaybackDeviceTest](#stopaudioplaybackdevicetest) to stop the playback test before moving on to the other device tests.
2737
- */
2738
2680
  startAudioPlaybackDeviceTest(filePath: string, indicationInterval: number): Promise<void>;
2739
-
2740
- /**
2741
- * @brief Stop the playback test for the local audio device.
2742
- * @notes Call this API to stop the playback test started by calling [startAudioPlaybackDeviceTest](#startaudioplaybackdevicetest) before moving on to the other device tests.
2743
- */
2744
2681
  stopAudioPlaybackDeviceTest(): void;
2745
-
2746
- /**
2747
- * @brief Start the capture and playback test for local audio devices.
2748
- * We recommend to register [onLocalAudioPropertiesReport](104479#onlocalaudiopropertiesreport) callback via [enableAudioPropertiesReport](enableaudiopropertiesreport). Once the test starts, you can get the volume of the capturing audio by this callback.
2749
- * @param indicationInterval The time interval between each callback of [onAudioPlaybackDeviceTestVolume](104479#onaudioplaybackdevicetestvolume) via which you get informed of the playback volume during the test. We recommend setting it to 200 ms. The minimal value is 100 ms.
2750
- * @return Resolve when the test ends.
2751
- * @notes + You can call this API whether the user is in a room.
2752
- * + The audio capturing will stop and begins to play the recording in 30 s after calling this API. Before that, call [stopAudioDeviceRecordAndPlayTest](#stopaudiodevicerecordandplayTest) to stop capturing and start playing the recording.
2753
- * + You must stop the test before starting another test for audio devices.
2754
- * + Call [stopAudioDeviceRecordTest](#stopaudiodevicerecordtest) to stop the test, including capturing and playing the recording.
2755
- * + This test performs locally and does not involve network connection testing.
2756
- */
2757
2682
  startAudioDeviceRecordTest(indicationInterval: number): Promise<void>;
2758
-
2759
- /**
2760
- * @brief Call this API to stop recording in the test and start to play the recording.
2761
- * @notes After calling this API, the recording starts playing during which you can call [stopAudioDeviceRecordTest](#stopaudiodevicerecordtest) to stop playing.
2762
- */
2763
2683
  stopAudioDeviceRecordAndPlayTest(): void;
2764
-
2765
- /**
2766
- * @brief Stop the capture and playback test for local audio devices which is started by calling [startAudioDeviceRecordTest](#startaudiodevicerecordtest).
2767
- * Before the test ends by itself, you can call this API to stop the recording or playing.
2768
- */
2769
2684
  stopAudioDevicePlayTest(): void;
2770
2685
  }
2771
2686
 
@@ -2863,7 +2778,6 @@ export interface RoomConfig {
2863
2778
 
2864
2779
  /**
2865
2780
  * @brief Enable/disable auto-subscribe audio. Enable by default.
2866
- * Call publish[104481#publish] to publish media streams if you disable `isAutoPublish`.
2867
2781
  */
2868
2782
  isAutoPublish: boolean;
2869
2783
 
@@ -3013,7 +2927,7 @@ export interface VideoPlayerOption {
3013
2927
  renderDom?: string | HTMLElement;
3014
2928
 
3015
2929
  /**
3016
- * @brief Rendering modes: optional `RENDER_MODE_HIDDEN` and `RENDER_MODE_FIT` .
2930
+ * @brief Rendering modes: optional `RENDER_MODE_HIDDEN`, `RENDER_MODE_FIT` and `RENDER_MODE_ADAPTIVE`.
3017
2931
  */
3018
2932
  renderMode?: VideoRenderMode;
3019
2933
 
@@ -3277,20 +3191,8 @@ export interface ScreenConfig {
3277
3191
  * @brief Video encoding configuration
3278
3192
  */
3279
3193
  export interface VideoEncoderConfig {
3280
-
3281
- /**
3282
- * @brief width in px
3283
- */
3284
3194
  width: number;
3285
-
3286
- /**
3287
- * @brief height in px
3288
- */
3289
3195
  height: number;
3290
-
3291
- /**
3292
- * @brief frame rate
3293
- */
3294
3196
  frameRate: number;
3295
3197
 
3296
3198
  /**
@@ -3720,6 +3622,15 @@ export interface PublicStreamConfig {
3720
3622
  };
3721
3623
  }
3722
3624
 
3625
+ /**
3626
+ * @brief Configurations of the public stream.
3627
+ */
3628
+ export declare enum ConnectionMode {
3629
+ AUTO = "auto",
3630
+ FORCE_TCP = "forceTCP",
3631
+ FORCE_UDP = "forceUDP"
3632
+ }
3633
+
3723
3634
  /**
3724
3635
  * @brief Point-to-point text message
3725
3636
  */
@@ -3793,6 +3704,7 @@ declare const Config: {
3793
3704
  EXPECTED_ADDR: string;
3794
3705
  LOG_SERVER_URL: string;
3795
3706
  CONFIG_REQUEST_DOMAINS: string[];
3707
+ CONNECTION_MODE: ConnectionMode;
3796
3708
  };
3797
3709
  declare function setParameter(key: keyof typeof Config, value: any): void;
3798
3710
  declare function getParameter(key: keyof typeof Config): string | string[] | never[];
@@ -3918,6 +3830,7 @@ declare class VERTC implements IVERTC {
3918
3830
  setParameter: typeof setParameter;
3919
3831
  isSupported: () => Promise<boolean>;
3920
3832
  getSupportedCodecs: () => Promise<string[]>;
3833
+ ConnectionMode: typeof ConnectionMode;
3921
3834
  events: typeof EngineEventsTypes;
3922
3835
  ErrorCode: typeof ErrorCode;
3923
3836
  platform: string;