@byteplus/rtc 4.53.1 → 4.54.1

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
@@ -694,7 +694,12 @@ declare enum ErrorCode {
694
694
  /**
695
695
  * @brief The client side failed to identity error codes sent by cloud media processing. Please contact the technical support.
696
696
  */
697
- SUBTITLE_ERR_UNKNOWN = "SUBTITLE_ERR_UNKNOWN"
697
+ SUBTITLE_ERR_UNKNOWN = "SUBTITLE_ERR_UNKNOWN",
698
+
699
+ /**
700
+ * @brief Unexpected cross-room media stream forwarding API call. For example, calling `stopForwardStreamToRooms` when media forwarding has already stopped.
701
+ */
702
+ UNEXPECTED_INVOKE_FORWARD_STREAM = "UNEXPECTED_INVOKE_FORWARD_STREAM"
698
703
  }
699
704
  declare enum AudioMixingError {
700
705
 
@@ -1909,7 +1914,11 @@ declare enum EngineEventsTypes {
1909
1914
  onSubtitleStateChanged = "onSubtitleStateChanged",
1910
1915
  onSubtitleMessageReceived = "onSubtitleMessageReceived",
1911
1916
  onServerParamsSetResult = "onServerParamsSetResult",
1912
- onVendorConnectionStateChanged = "onVendorConnectionStateChanged"
1917
+ onLocalStreamTrackChangedByExtension = "onLocalStreamTrackChangedByExtension",
1918
+ onVendorConnectionStateChanged = "onVendorConnectionStateChanged",
1919
+ onForwardStreamError = "onForwardStreamError",
1920
+ onRejoinWithTcp = "onRejoinWithTcp",
1921
+ onIceConnectWithTcp = "onIceConnectWithTcp"
1913
1922
  }
1914
1923
 
1915
1924
  /**
@@ -2589,6 +2598,30 @@ export interface IEngineEvents {
2589
2598
  * + If the client losts connection after the call of [setServerParams](104478#setserverparams) this event notifies once the client reconnects.
2590
2599
  */
2591
2600
  [EngineEventsTypes.onServerParamsSetResult]: (error?: ErrorCode) => void;
2601
+
2602
+ /**
2603
+ * @hidden
2604
+ */
2605
+ [EngineEventsTypes.onLocalStreamTrackChangedByExtension]: (e: {
2606
+ streamIndex: StreamIndex;
2607
+ type: "video" | "audio";
2608
+ }) => void;
2609
+
2610
+ /**
2611
+ * @brief Event of failing to forward stream across rooms.
2612
+ * @param e Status information for forwarding media stream across rooms.
2613
+ */
2614
+ [EngineEventsTypes.onForwardStreamError]: (e: ForwardStreamStateInfo) => void;
2615
+
2616
+ /**
2617
+ * @hidden
2618
+ */
2619
+ [EngineEventsTypes.onRejoinWithTcp]: () => void;
2620
+
2621
+ /**
2622
+ * @hidden
2623
+ */
2624
+ [EngineEventsTypes.onIceConnectWithTcp]: () => void;
2592
2625
  }
2593
2626
 
2594
2627
  /**
@@ -2605,12 +2638,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
2605
2638
  * You need to bring Token to enter the room. When testing, you can use the console to generate temporary tokens. The official launch requires the use of the key SDK to generate and issue tokens at your server level. See [Use Token to complete authentication](70121) for token validity and generation method.
2606
2639
  * Apps with different AppIDs are not interoperable.
2607
2640
  * Make sure that the AppID used to generate the Token is the same as the AppID used to create the engine, otherwise it will cause the join room to fail.
2608
- * @param roomId The ID of the room to be added.
2609
- * The room ID is a non-empty string with a length of less than 128 bytes, and the following character set ranges are supported:
2610
- * 1. 26 capital letters A~ Z.
2611
- * 2. 26 lowercase letters a~ z.
2612
- * 3. 10 numbers 0~ 9.
2613
- * 4. Underscore "_", the at sign "@", and the minus sign "-".
2641
+ * @param roomId The Room ID. The string must conform to the regular expression: `[a-zA-Z0-9_@\-\.]{1,128}`.
2614
2642
  * @param userInfo User information.
2615
2643
  * @param roomConfig Room parameter configuration, set the room mode and whether to automatically publish or subscribe to the flow.
2616
2644
  * @return
@@ -3517,6 +3545,51 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3517
3545
  * + If the playing has not yet started when you call this API, the setting will take effect after it starts.
3518
3546
  */
3519
3547
  setPublicStreamVolume: (publicStreamId: string, volume: number) => void;
3548
+
3549
+ /**
3550
+ * @brief Start forwarding media stream across rooms. See [Forward media stream across rooms](https://docs.byteplus.com/en/byteplus-rtc/docs/104398) for details.
3551
+ * After calling [joinRoom]({{api}}#RTCEngine.joinRoom), you can call this API to publish the media stream to multiple rooms. This feature is suitable for scenarios such as co-host PK and online karaoke.
3552
+ * @param forwardStreamInfos Information of the target rooms where the stream will be forwarded.
3553
+ * @return Status information for forwarding media stream across rooms.
3554
+ * @notes + Once the forwarding begins, other users in the target room will receive [onUserJoined]({{callback}}#EngineEvents.onUserJoined) and [onUserPublishStream]({{callback}}#EngineEvents.onUserPublishStream)/[onUserPublishScreen]({{callback}}#EngineEvents.onUserPublishScreen).
3555
+ * + Call [updateForwardStreamToRooms]({{api}}#RTCEngine.updateForwardStreamToRooms) to add or remove the target room(s).
3556
+ * + Call [stopForwardStreamToRooms]({{api}}#RTCEngine.stopForwardStreamToRooms) to stop forwarding media stream to all rooms.
3557
+ * + Call [pauseForwardStreamToAllRooms]({{api}}#RTCEngine.pauseForwardStreamToAllRooms) to pause forwarding media stream to all rooms.
3558
+ */
3559
+ startForwardStreamToRooms: (forwardStreamInfos: ForwardStreamInfo[]) => Promise<ForwardStreamStateInfo[]>;
3560
+
3561
+ /**
3562
+ * @brief Update information of the rooms where the stream will be forwarded after calling [startForwardStreamToRooms]({{api}}#RTCEngine.startForwardStreamToRooms).
3563
+ * @param forwardStreamInfos Information of the target rooms where the stream will be forwarded.
3564
+ * @return Status information for forwarding media stream across rooms.
3565
+ * @notes + Users in the added room will receive [onUserJoined]({{callback}}#EngineEvents.onUserJoined) and [onUserPublishStream]({{callback}}#EngineEvents.onUserPublishStream)/[onUserPublishScreen]({{callback}}#EngineEvents.onUserPublishScreen).
3566
+ * + Users in the removed room will receive [onUserUnpublishStream]({{callback}}#EngineEvents.onUserUnpublishStream)/[onUserUnpublishScreen]({{callback}}#EngineEvents.onUserUnpublishScreen) and [onUserLeave]({{callback}}#EngineEvents.onUserLeave).
3567
+ */
3568
+ updateForwardStreamToRooms: (forwardStreamInfos: ForwardStreamInfo[]) => Promise<ForwardStreamStateInfo[]>;
3569
+
3570
+ /**
3571
+ * @brief Stop forwarding media stream to all rooms.
3572
+ * @return Status information for forwarding media stream across rooms.
3573
+ * @notes + Users in the former target rooms will receive [onUserUnpublishStream]({{callback}}#EngineEvents.onUserUnpublishStream)/[onUserUnpublishScreen]({{callback}}#EngineEvents.onUserUnpublishScreen) and [onUserLeave]({{callback}}#EngineEvents.onUserLeave).
3574
+ * + Call [updateForwardStreamToRooms]({{api}}#RTCEngine.updateForwardStreamToRooms) to stop forwarding media stream to specific rooms.
3575
+ * + Call [pauseForwardStreamToAllRooms]({{api}}#RTCEngine.pauseForwardStreamToAllRooms) and [resumeForwardStreamToAllRooms]({{api}}#RTCEngine.resumeForwardStreamToAllRooms) to pause and resume fowarding media stream to all rooms.
3576
+ */
3577
+ stopForwardStreamToRooms: () => Promise<ForwardStreamStateInfo[]>;
3578
+
3579
+ /**
3580
+ * @brief Pause forwarding media stream to all rooms.
3581
+ * After calling this API, call [resumeForwardStreamToAllRooms]({{api}}#RTCEngine.resumeForwardStreamToAllRooms) to resume.
3582
+ * @return Status information for forwarding media stream across rooms.
3583
+ * @notes Users in the target rooms will receive [onUserUnpublishStream]({{callback}}#EngineEvents.onUserUnpublishStream)/[onUserUnpublishScreen]({{callback}}#EngineEvents.onUserUnpublishScreen) and [onUserLeave]({{callback}}#EngineEvents.onUserLeave).
3584
+ */
3585
+ pauseForwardStreamToAllRooms: () => Promise<ForwardStreamStateInfo[]>;
3586
+
3587
+ /**
3588
+ * @brief Resume forwarding media stream to all rooms.
3589
+ * @return Status information for forwarding media stream across rooms.
3590
+ * @notes Users in the target room will receive [onUserJoined]({{callback}}#EngineEvents.onUserJoined) and [onUserPublishStream]({{callback}}#EngineEvents.onUserPublishStream)/[onUserPublishScreen]({{callback}}#EngineEvents.onUserPublishScreen).
3591
+ */
3592
+ resumeForwardStreamToAllRooms: () => Promise<ForwardStreamStateInfo[]>;
3520
3593
  }
3521
3594
 
3522
3595
  /**
@@ -4009,19 +4082,19 @@ export interface ScreenConfig {
4009
4082
  export interface VideoEncoderConfig {
4010
4083
 
4011
4084
  /**
4012
- * @brief Video width in pixels. The default value is 640 px。
4085
+ * @brief Video width in pixels. The default value is 640 px.
4013
4086
  * The input can be a number or a [ConstrainULong](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#constrainulong).
4014
4087
  */
4015
4088
  width: ConstrainULong;
4016
4089
 
4017
4090
  /**
4018
- * @brief Video height in pixels. The default value is 480 px。
4091
+ * @brief Video height in pixels. The default value is 480 px.
4019
4092
  * The input can be a number or a [ConstrainULong](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#constrainulong).
4020
4093
  */
4021
4094
  height: ConstrainULong;
4022
4095
 
4023
4096
  /**
4024
- * @brief Video framerate in FPS. The default value is 15 FPS。
4097
+ * @brief Video framerate in FPS. The default value is 15 FPS.
4025
4098
  * The input can be a number or a [ConstrainDouble](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#constraindouble).
4026
4099
  */
4027
4100
  frameRate: ConstrainDouble;
@@ -4038,19 +4111,19 @@ export interface VideoEncoderConfig {
4038
4111
  export interface ScreenEncoderConfig {
4039
4112
 
4040
4113
  /**
4041
- * @brief Video width in pixels. The default value is 1920 px。
4114
+ * @brief Video width in pixels. The default value is 1920 px.
4042
4115
  * The input can be a number or a [ConstrainULong](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#constrainulong).
4043
4116
  */
4044
4117
  width: ConstrainULong;
4045
4118
 
4046
4119
  /**
4047
- * @brief Video height in pixels. The default value is 1080 px。
4120
+ * @brief Video height in pixels. The default value is 1080 px.
4048
4121
  * The input can be a number or a [ConstrainULong](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#constrainulong).
4049
4122
  */
4050
4123
  height: ConstrainULong;
4051
4124
 
4052
4125
  /**
4053
- * @brief Video framerate in FPS. The default value is 15 FPS。
4126
+ * @brief Video framerate in FPS. The default value is 15 FPS.
4054
4127
  * The input can be a number or a [ConstrainDouble](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#constraindouble).
4055
4128
  */
4056
4129
  frameRate: ConstrainDouble;
@@ -4526,7 +4599,7 @@ export declare enum SubscribeFallbackOption {
4526
4599
  DISABLE = 0,
4527
4600
 
4528
4601
  /**
4529
- * @brief When the downstream network quality is bad, the video stream fallbacks to stream of lower resolution and then to voice only. See [Media Stream Fallback](https://www.volcengine.com/docs/6348/70137) for fallback rules.
4602
+ * @brief When the downstream network quality is bad, the video stream fallbacks to stream of lower resolution and then to voice only. See [Media Stream Fallback](https://docs.byteplus.com/en/byteplus-rtc/docs/70137) for fallback rules.
4530
4603
  * This setting takes effect only when the publisher enables simulcast mode through [EnableSimulcastMode](104478#enablesimulcastmode).
4531
4604
  */
4532
4605
  VIDEO_STREAM_LOW = 1,
@@ -4943,6 +5016,90 @@ export interface CloudProxyInfo {
4943
5016
  configProxy: string;
4944
5017
  }
4945
5018
 
5019
+ /**
5020
+ * @brief Information of the target rooms where the stream will be forwarded.
5021
+ */
5022
+ export interface ForwardStreamInfo {
5023
+
5024
+ /**
5025
+ * @brief The target room ID for forwarding media streams.
5026
+ */
5027
+ roomId: string;
5028
+
5029
+ /**
5030
+ * @brief Tokens generated using the target room's roomId and userId.
5031
+ * You can use the temporary token generated on the [console](https://console.byteplus.com/rtc/workplaceRTC) for testing purposes only. The official launch requires token generated by your server.
5032
+ */
5033
+ token: string;
5034
+ }
5035
+
5036
+ /**
5037
+ * @brief Status information for forwarding media stream across rooms.
5038
+ */
5039
+ export interface ForwardStreamStateInfo {
5040
+
5041
+ /**
5042
+ * @brief The target room ID for forwarding media streams.
5043
+ */
5044
+ roomId: string;
5045
+
5046
+ /**
5047
+ * @brief Status information for forwarding media stream across rooms.
5048
+ */
5049
+ state: ForwardStreamState;
5050
+
5051
+ /**
5052
+ * @brief Forward stream error code.
5053
+ */
5054
+ error: ForwardStreamError;
5055
+ }
5056
+
5057
+ /**
5058
+ * @brief Status information for forwarding media stream across rooms.
5059
+ */
5060
+ export declare enum ForwardStreamState {
5061
+
5062
+ /**
5063
+ * @brief Success.
5064
+ */
5065
+ FORWARD_STREAM_STATE_SUCCESS = 0,
5066
+
5067
+ /**
5068
+ * @brief Failure.
5069
+ */
5070
+ FORWARD_STREAM_STATE_FAILURE = 1
5071
+ }
5072
+
5073
+ /**
5074
+ * @brief Forward stream error code.
5075
+ */
5076
+ export declare enum ForwardStreamError {
5077
+
5078
+ /**
5079
+ * @brief Success.
5080
+ */
5081
+ FORWARD_STREAM_ERROR_OK = 0,
5082
+
5083
+ /**
5084
+ * @brief Target room's token is invalid.
5085
+ */
5086
+ FORWARD_STREAM_ERROR_INVALID_TOKEN = 1202,
5087
+
5088
+ /**
5089
+ * @brief Server side error.
5090
+ */
5091
+ FORWARD_STREAM_ERROR_RESPONSE = 1203,
5092
+
5093
+ /**
5094
+ * @brief The source room is set as the target room.
5095
+ */
5096
+ FORWARD_STREAM_ERROR_REMOTE_KICKED = 1204,
5097
+ /**
5098
+ * @hidden
5099
+ */
5100
+ FORWARD_STREAM_ERROR_NOT_SUPPORT = 1205
5101
+ }
5102
+
4946
5103
  /**
4947
5104
  * @brief Point-to-point text message
4948
5105
  */
@@ -5027,7 +5184,11 @@ export interface CloudProxyConnectedEvent {
5027
5184
  declare const Config: {
5028
5185
  [key: string]: any;
5029
5186
  };
5030
- declare function setParameter(key: keyof typeof Config, value: any): void;
5187
+ declare function setParameter(key: keyof typeof Config, value: any): {
5188
+ useTcpAfterJoinTimeout: boolean;
5189
+ joinWithTcpOnly: boolean;
5190
+ joinWithTcpOnlyDelay: number;
5191
+ } | undefined;
5031
5192
  declare function getParameter(key: keyof typeof Config): any;
5032
5193
 
5033
5194
  /**