@byteplus/rtc 4.55.2 → 4.56.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.
package/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  // Generated by dts-bundle-generator v6.13.0
2
2
 
3
+ import { CoreSetParamterInterface } from '@byted/core-lib';
3
4
  import { EventArgs, EventEmitter, EventNames, ValidEventTypes } from 'eventemitter3';
4
5
 
5
6
  /**
@@ -317,11 +318,6 @@ declare enum ErrorCode {
317
318
  */
318
319
  INVALID_TOKEN = "INVALID_TOKEN",
319
320
 
320
- /**
321
- * @brief Token expired.
322
- */
323
- EXPIRED_TOKEN = "EXPIRED_TOKEN",
324
-
325
321
  /**
326
322
  * @brief Failure of joining room
327
323
  */
@@ -718,7 +714,17 @@ declare enum ErrorCode {
718
714
  /**
719
715
  * @brief Unexpected cross-room media stream forwarding API call. For example, calling `stopForwardStreamToRooms` when media forwarding has already stopped.
720
716
  */
721
- UNEXPECTED_INVOKE_FORWARD_STREAM = "UNEXPECTED_INVOKE_FORWARD_STREAM"
717
+ UNEXPECTED_INVOKE_FORWARD_STREAM = "UNEXPECTED_INVOKE_FORWARD_STREAM",
718
+
719
+ /**
720
+ * @brief Failed to enter the room because the room is banned.
721
+ */
722
+ ROOM_FORBIDDEN = "ROOM_FORBIDDEN",
723
+
724
+ /**
725
+ * @brief Failed to enter the room because the user is banned.
726
+ */
727
+ USER_FORBIDDEN = "USER_FORBIDDEN"
722
728
  }
723
729
  declare enum AudioMixingError {
724
730
 
@@ -772,6 +778,11 @@ declare enum AudioMixingError {
772
778
  */
773
779
  AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK = 9
774
780
  }
781
+ export interface IJoinRoomConfig {
782
+ useTcpAfterJoinTimeout: boolean;
783
+ joinWithTcpOnly: boolean;
784
+ joinWithTcpOnlyDelay: number;
785
+ }
775
786
  export declare type RTCExtension = any;
776
787
  declare enum StreamMixingEventType {
777
788
 
@@ -1937,7 +1948,9 @@ declare enum EngineEventsTypes {
1937
1948
  onVendorConnectionStateChanged = "onVendorConnectionStateChanged",
1938
1949
  onForwardStreamError = "onForwardStreamError",
1939
1950
  onRejoinWithTcp = "onRejoinWithTcp",
1940
- onIceConnectWithTcp = "onIceConnectWithTcp"
1951
+ onIceConnectWithTcp = "onIceConnectWithTcp",
1952
+ onPublishRetry = "onPublishRetry",
1953
+ onSubscribeRetry = "onSubscribeRetry"
1941
1954
  }
1942
1955
 
1943
1956
  /**
@@ -2129,7 +2142,7 @@ export interface IEngineEvents {
2129
2142
  [EngineEventsTypes.onAudioDeviceStateChanged]: (event: DeviceInfo) => void;
2130
2143
 
2131
2144
  /**
2132
- * @brief Event of media track ending
2145
+ * @brief Media track ended event. Please restart capture in the callback thread.
2133
2146
  * @param event
2134
2147
  * @group Video Management
2135
2148
  * @order 75
@@ -2432,7 +2445,7 @@ export interface IEngineEvents {
2432
2445
  [EngineEventsTypes.onLiveTranscodingResult]: (event: LiveTranscodingResultEvent) => void;
2433
2446
 
2434
2447
  /**
2435
- * @brief event of error
2448
+ * @brief An error occurred in the SDK.
2436
2449
  * @param event
2437
2450
  * @group Room Management
2438
2451
  * @order 40
@@ -2440,9 +2453,15 @@ export interface IEngineEvents {
2440
2453
  [EngineEventsTypes.onError]: (event: {
2441
2454
 
2442
2455
  /**
2443
- * @brief The reason why the current user has been removed from the room.
2456
+ * @brief See [ErrorCode](104480#errorcode).
2444
2457
  */
2445
- errorCode: ErrorCode.DUPLICATE_LOGIN | ErrorCode.RTM_DUPLICATE_LOGIN | ErrorCode.RTM_TOKEN_ERROR | ErrorCode.EXPIRED_TOKEN | ErrorCode.RECONNECT_FAILED;
2458
+ errorCode: ErrorCode.DUPLICATE_LOGIN | ErrorCode.RTM_DUPLICATE_LOGIN | ErrorCode.RTM_TOKEN_ERROR | ErrorCode.TOKEN_EXPIRED | ErrorCode.RECONNECT_FAILED | ErrorCode.KICKED_OUT | ErrorCode.ROOM_DISMISS;
2459
+
2460
+ /**
2461
+ * @brief The Unix timestamp in milliseconds when the room will be unbanned.
2462
+ * When `forbiddenTime` is 0, it represents that the user can enter the room again.
2463
+ */
2464
+ forbiddenTime?: number;
2446
2465
  }) => void;
2447
2466
 
2448
2467
  /**
@@ -2708,6 +2727,21 @@ export interface IEngineEvents {
2708
2727
  * @hidden
2709
2728
  */
2710
2729
  [EngineEventsTypes.onIceConnectWithTcp]: () => void;
2730
+
2731
+ /**
2732
+ * @hidden
2733
+ */
2734
+ [EngineEventsTypes.onPublishRetry]: (e: {
2735
+ screen: boolean;
2736
+ }) => void;
2737
+
2738
+ /**
2739
+ * @hidden
2740
+ */
2741
+ [EngineEventsTypes.onSubscribeRetry]: (e: {
2742
+ userId: string;
2743
+ screen: boolean;
2744
+ }) => void;
2711
2745
  }
2712
2746
 
2713
2747
  /**
@@ -2727,7 +2761,8 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
2727
2761
  * @param roomId The Room ID. The string must conform to the regular expression: `[a-zA-Z0-9_@\-\.]{1,128}`.
2728
2762
  * @param userInfo User information.
2729
2763
  * @param roomConfig Room parameter configuration, set the room mode and whether to automatically publish or subscribe to the flow.
2730
- * @return
2764
+ * @return The error code `ErrorCode.ROOM_FORBIDDEN` indicates that the user failed to enter the room because the room has been banned.
2765
+ * The error code `ErrorCode.USER_FORBIDDEN` indicates that the user failed to enter the room because the user has been banned.
2731
2766
  * @notes + In the same room with the same App ID, the user ID of each user must be unique. The user will be kicked out of the room when a user with the same userID joins the room because of the error of `DUPLICATE_LOGIN`.
2732
2767
  * + Remote users will receive [onUserJoined](104479#onuserjoined) callback when a visible user joins the room. Call [setUserVisibility](#setuservisibility) to switch the visibility of the user.
2733
2768
  * + RTC SDK will try reconnect after losing connection to the server caused by a poor network connection. At this point, [onConnectionStateChanged](104479#onconnectionstatechanged) callback will be triggered and the SDK will automatically retry until it successfully reconnects to the server. The remote user will receive [onUserJoined](104479#onuserjoined) if a visible user reconnected successfully.
@@ -2923,10 +2958,56 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
2923
2958
  * @notes + Call [startAudioCapture](#startaudiocapture) to enable the internal audio capture.
2924
2959
  * + Without calling this API the internal audio capture will sustain until you destroy the engine instance.
2925
2960
  * @group Audio Management
2926
- * @order 6
2961
+ * @order 7
2927
2962
  */
2928
2963
  stopAudioCapture: () => Promise<void>;
2929
2964
 
2965
+ /**
2966
+ * @brief Enable audio and video capture using the internal capture module. When calling this method, the browser will request microphone and camera permissions simultaneously, and the user only needs to grant permission once.
2967
+ * When calling this method, other users in the room will receive the callback of [onUserStartVideoCapture](104479#onuserstartvideocapture) and [onUserStartAudioCapture](104479#onuserstartaudiocapture).
2968
+ * @param optionsOrAudioDeviceId When using a single parameter, both audio and video device IDs can be set simultaneously. When using two parameters, the audio device's ID can be set.
2969
+ * @param videoDeviceId Video device's ID.
2970
+ * @return The actual audio and video capture parameters that take effect. Refer to [MediaTrackSettings](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings). Pay attention to the properties: `deviceId`, `channelCount`, `sampleRate`, `frameRate`, `height` and `width`.
2971
+ * @notes + The audio and video capture can be published using [publishStream](#publishstream) and unpublished using [unPublishStream](#unpublishstream).
2972
+ * + The method cannot be called simultaneously with [startVideoCapture](#startvideocapture) / [startAudioCapture](#startaudiocapture).
2973
+ * + If either the camera or the microphone fails to complete the capture when calling this method, the audio and video capture will fail.
2974
+ * + To stop audio and video capture, call [stopVideoCapture] (#stopvideocapture) / [stopAudioCapture](#stopaudiocapture).
2975
+ * @group Audio Management
2976
+ * @order 6
2977
+ */
2978
+ startAudioAndVideoCapture: (optionsOrAudioDeviceId?: {
2979
+
2980
+ /**
2981
+ * @brief Audio device's ID.
2982
+ */
2983
+ audioDeviceId?: string;
2984
+
2985
+ /**
2986
+ * @brief Video device's ID.
2987
+ */
2988
+ videoDeviceId?: string;
2989
+ } | string, videoDeviceId?: string) => Promise<{
2990
+ audioTrackSettings: MediaTrackSettings;
2991
+ videoTrackSettings: MediaTrackSettings;
2992
+ }>;
2993
+
2994
+ /**
2995
+ * @hidden
2996
+ * @brief Enable audio and video capture using the internal capture module. When calling this method, the browser will request microphone and camera permissions simultaneously, and the user only needs to grant permission once.
2997
+ * When calling this method, other users in the room will receive the callback of [onUserStartVideoCapture](104479#onuserstartvideocapture) and [onUserStartAudioCapture](104479#onuserstartaudiocapture).
2998
+ * @param videoDeviceId Video device's ID.
2999
+ * @param audioDeviceId Audio device's ID.
3000
+ * @return The actual audio and video capture parameters that take effect. Refer to [MediaTrackSettings](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings). Pay attention to the properties: `deviceId`, `channelCount`, `sampleRate`, `frameRate`, `height` and `width`.
3001
+ * @notes + The audio and video capture can be published using [publishStream](#publishstream) and unpublished using [unPublishStream](#unpublishstream).
3002
+ * + The method cannot be called simultaneously with [startVideoCapture](#startvideocapture) / [startAudioCapture](#startaudiocapture).
3003
+ * + If either the camera or the microphone fails to complete the capture when calling this method, the audio and video capture will fail.
3004
+ * + To stop audio and video capture, call [stopVideoCapture](#stopvideocapture) / [stopAudioCapture](#stopaudiocapture).
3005
+ */
3006
+ startVideoAndAudioCapture: (videoDeviceId?: string, audioDeviceId?: string) => Promise<{
3007
+ audioTrackSettings: MediaTrackSettings;
3008
+ videoTrackSettings: MediaTrackSettings;
3009
+ }>;
3010
+
2930
3011
  /**
2931
3012
  * @brief Use the capture module provided by the RTC SDK to capture the current screen stream for sharing.
2932
3013
  * @param screenConfig Specify properties for the sharing screen.
@@ -2949,22 +3030,22 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
2949
3030
 
2950
3031
  /**
2951
3032
  * @brief Bind a view to the local media stream and set the rendering mode for the rendering of the local stream
2952
- * Listen to `onPlayerEvent` for the state after binding a view to the local video stream.
2953
- * Call this API again with a blank view to unbind the view from the local video stream.
3033
+ * Listen to `onPlayerEvent` for the state after binding a view to the local video stream.
3034
+ * Call this API again with a blank view to unbind the view from the local video stream.
2954
3035
  * @param streamIndex Video stream properties
2955
3036
  * @param videoPlayerOption View information and rendering mode
2956
3037
  * @notes You should bind the view after the user joins a room. This setting will sustain when the user leaves the room.
2957
3038
  * @group Video Management
2958
3039
  * @order 20
2959
3040
  */
2960
- setLocalVideoPlayer: (streamIndex: StreamIndex, videoPlayerOption?: Partial<VideoPlayerOption>) => HTMLVideoElement | undefined;
3041
+ setLocalVideoPlayer: (streamIndex: StreamIndex, videoPlayerOption?: Partial<Omit<VideoPlayerOption, "rotation">>) => HTMLVideoElement | undefined;
2961
3042
 
2962
3043
  /**
2963
3044
  * @brief Bind a view to the remote media stream and set the rendering mode for the rendering of the remote stream
2964
3045
  * It's recommended to call this API and bind a view once the event of [onUserPublishStream](104479#onuserpublishstream)/[onUserPublishScreen](104479#onuserpublishscreen) is triggered.
2965
3046
  * Call this API again with a blank view to unbind the view from the remote video stream.
2966
3047
  * @param streamIndex Video stream properties
2967
- * @param videoPlayer View information and rendering mode
3048
+ * @param videoPlayerOption View information and rendering mode. Starting from version 4.56, you can set the rotation angle of the remote video rendering using `rotation`.
2968
3049
  * @notes You should bind the view after the user joins a room. This setting will sustain when the user leaves the room.
2969
3050
  * @group Video Management
2970
3051
  * @order 21
@@ -4036,8 +4117,8 @@ export declare enum MirrorMode {
4036
4117
  */
4037
4118
  export interface VideoPlayerOption {
4038
4119
 
4039
- /** Dom
4040
- *
4120
+ /**
4121
+ * @brief DOM
4041
4122
  */
4042
4123
  renderDom?: string | HTMLElement;
4043
4124
 
@@ -4054,6 +4135,12 @@ export interface VideoPlayerOption {
4054
4135
  * + underscore "_", at character "@", minus, number "-"
4055
4136
  */
4056
4137
  userId: string;
4138
+
4139
+ /**
4140
+ * @brief The clockwise rotation angle of the video frame, which can be set to 0, 90, 180, 270. The default value is 0, which means no rotation is applied.<br>
4141
+ * This parameter only applies to remote video. Setting this parameter will not take effect when calling [setLocalVideoPlayer](104478#setlocalvideoplayer).
4142
+ */
4143
+ rotation?: number;
4057
4144
  }
4058
4145
 
4059
4146
  /**
@@ -4329,6 +4416,15 @@ export interface VideoEncoderConfig {
4329
4416
  * @brief The maximum bitrate in Kbps (>0). The default value is 600 Kbps.
4330
4417
  */
4331
4418
  maxKbps: number;
4419
+
4420
+ /**
4421
+ * @brief The type of content the track contains.
4422
+ * `'text'`:The track should be treated as if video details are extra important, and that significant sharp edges and areas of consistent color can occur frequently. For example, presentations or web pages with text content.
4423
+ * `'motion'`:The track should be treated as if it contains video where motion is important. For example, webcam video, movies or video games.
4424
+ * `'detail'`:The track should be treated as if video details are extra important. For example, presentations or web pages with text content, painting or line art.
4425
+ * @notes This property is not supported on Firefox. See [contentHint browser compatibility](https://caniuse.com/?search=contentHint).
4426
+ */
4427
+ contentHint?: "text" | "motion" | "detail";
4332
4428
  }
4333
4429
 
4334
4430
  /**
@@ -4360,11 +4456,11 @@ export interface ScreenEncoderConfig {
4360
4456
  maxKbps: number;
4361
4457
 
4362
4458
  /**
4363
- * @brief Content types of the shared video.
4364
- * - 'detail' [Default setting]:clarity first, for video content containing a mix of images and text.
4365
- * - 'text':clarity first, for video content containing only a large amount of text.
4366
- * - 'motion':fluency first, applicable to scenarios when video content is camera captured source, movies, videos, games.
4367
- * @notes Only Chrome browser is supported to set the configuration.
4459
+ * @brief The type of content the track contains.
4460
+ * `'text'`:The track should be treated as if video details are extra important, and that significant sharp edges and areas of consistent color can occur frequently. For example, presentations or web pages with text content.
4461
+ * `'motion'`:The track should be treated as if it contains video where motion is important. For example, webcam video, movies or video games.
4462
+ * `'detail'`:The track should be treated as if video details are extra important. For example, presentations or web pages with text content, painting or line art.
4463
+ * @notes This property is not supported on Firefox. See [contentHint browser compatibility](https://caniuse.com/?search=contentHint).
4368
4464
  */
4369
4465
  contentHint?: "text" | "motion" | "detail";
4370
4466
  }
@@ -4409,6 +4505,55 @@ export interface AudioPropertiesConfig {
4409
4505
  * + false: Disable the prompt
4410
4506
  */
4411
4507
  enableInBackground?: boolean;
4508
+
4509
+ /**
4510
+ * @brief Audio callback mode of local main stream.
4511
+ */
4512
+ localMainReportMode?: LocalMainReportMode;
4513
+
4514
+ /**
4515
+ * @brief The data range of the local main stream audio callback. It controls whether the callback includes mixed audio.
4516
+ */
4517
+ audioReportMode?: AudioReportMode;
4518
+ }
4519
+
4520
+ /**
4521
+ * @brief Audio callback mode of local main stream.
4522
+ * This feature affects the callback [onActiveSpeaker](104479#onactivespeaker). For example, if [LocalMainReportMode](#localmainreportmode) is set to `RESET` when the local main stream is unpublished, the callback will never include the local user's main stream audio.
4523
+ */
4524
+ export declare enum LocalMainReportMode {
4525
+
4526
+ /**
4527
+ * @brief (Default) When the local main stream exists, the callback is always enabled.
4528
+ */
4529
+ NORMAL = 0,
4530
+
4531
+ /**
4532
+ * @brief When the local main stream is unpublished, the callback is disabled. However, once it is published, the callback function will return the actual volume value.
4533
+ */
4534
+ DISCONNECT = 1,
4535
+
4536
+ /**
4537
+ * @brief When the local main stream is unpublished, the callback function will return a fixed volume value of 0. However, once it is published, the callback function will return the actual volume value.
4538
+ */
4539
+ RESET = 2
4540
+ }
4541
+
4542
+ /**
4543
+ * @brief The data range of the local main stream audio callback. It controls whether the callback includes mixed audio.
4544
+ * This feature affects the callback [onActiveSpeaker](104479#onactivespeaker). For example, if [AudioReportMode](#audioreportmode) is set to `AUDIOMIXING`, the callback may still include the local user's main stream audio even with zero microphone volume.
4545
+ */
4546
+ export declare enum AudioReportMode {
4547
+
4548
+ /**
4549
+ * @brief (Default) The microphone audio or the audio before mixing.
4550
+ */
4551
+ MICROPHONE = 0,
4552
+
4553
+ /**
4554
+ * @brief The audio after mixing.
4555
+ */
4556
+ AUDIOMIXING = 1
4412
4557
  }
4413
4558
 
4414
4559
  /**
@@ -5428,15 +5573,51 @@ export interface CloudProxyConnectedEvent {
5428
5573
  */
5429
5574
  interval: number;
5430
5575
  }
5576
+ export interface SetParamInterface {
5577
+ VERSION: string;
5578
+ ICE_CONFIG_REQUEST_URLS_INTERNAL: string[];
5579
+ ICE_CONFIG_REQUEST_URLS: string[] | string;
5580
+ EXPECTED_ADDR: string;
5581
+ LOG_SERVER_URL: string;
5582
+ CONFIG_REQUEST_DOMAINS: string[];
5583
+ DEVICE_ID: string;
5584
+ OVERSEA: boolean;
5585
+ PLATFORM: string;
5586
+ PRODUCT: string;
5587
+ FORCE_ENABLED_REPORT_CALLBACKS: string[];
5588
+ SKIP_WEB_AUDIO_IN_TRACK: boolean;
5589
+ AUDIO_STALL: boolean;
5590
+ VIDEO_STALL: boolean;
5591
+ STATS_SCALLBACK_SUPPORT: boolean;
5592
+ JOIN_ROOM_CONFIG: IJoinRoomConfig;
5593
+ ENABLE_REPORT_IDB_BUFFER: boolean;
5594
+ SIGNAL_COMPRESSION: boolean;
5595
+ SIGNAL_CROP_JOINROOM: boolean;
5596
+ }
5597
+ export declare type SetParamKey = keyof (SetParamInterface & CoreSetParamterInterface);
5431
5598
  declare const Config: {
5432
- [key: string]: any;
5599
+ VERSION: string;
5600
+ ICE_CONFIG_REQUEST_URLS_INTERNAL: string[];
5601
+ ICE_CONFIG_REQUEST_URLS: string[];
5602
+ EXPECTED_ADDR: string;
5603
+ LOG_SERVER_URL: string;
5604
+ CONFIG_REQUEST_DOMAINS: string[];
5605
+ DEVICE_ID: string;
5606
+ OVERSEA: boolean;
5607
+ PLATFORM: string;
5608
+ PRODUCT: string;
5609
+ FORCE_ENABLED_REPORT_CALLBACKS: string[];
5610
+ SKIP_WEB_AUDIO_IN_TRACK: boolean;
5611
+ AUDIO_STALL: boolean;
5612
+ VIDEO_STALL: boolean;
5613
+ STATS_SCALLBACK_SUPPORT: boolean;
5614
+ JOIN_ROOM_CONFIG: IJoinRoomConfig;
5615
+ SIGNAL_COMPRESSION: boolean;
5616
+ SIGNAL_CROP_JOINROOM: boolean;
5617
+ IOS_SAFARI_ORIENTATION: boolean;
5433
5618
  };
5434
- declare function setParameter(key: keyof typeof Config, value: any): {
5435
- useTcpAfterJoinTimeout: boolean;
5436
- joinWithTcpOnly: boolean;
5437
- joinWithTcpOnlyDelay: number;
5438
- } | undefined;
5439
- declare function getParameter(key: keyof typeof Config): any;
5619
+ declare function setParameter<T extends SetParamKey>(key: T, value: (SetParamInterface & CoreSetParamterInterface)[T]): IJoinRoomConfig | undefined;
5620
+ declare function getParameter(key: keyof typeof Config): string | boolean | string[] | IJoinRoomConfig;
5440
5621
 
5441
5622
  /**
5442
5623
  * @id BytePlusRTC
@@ -5460,6 +5641,11 @@ export interface IVERTC {
5460
5641
  */
5461
5642
  createEngine: (appId: string, config?: EngineConfig) => IRTCEngine;
5462
5643
 
5644
+ /**
5645
+ * @hidden
5646
+ */
5647
+ createBLWEngine: (appId: string, config?: EngineConfig) => IRTCEngine;
5648
+
5463
5649
  /**
5464
5650
  * @brief Call this API to destroy the IRTCEngine instance created by [createEngine](104478#createengine).
5465
5651
  * @param engine By calling this API, this `IRTCEngine` instance and resource related will be wiped from memory. And any interaction with the media server will end.
@@ -5592,9 +5778,17 @@ export interface IVERTC {
5592
5778
  */
5593
5779
  downloadLog: (key?: string) => void;
5594
5780
  }
5781
+ /**
5782
+ * @hidden
5783
+ */
5784
+ export interface IBLWRTCEngine extends IRTCEngine {
5785
+
5786
+ setRemoteScreenVideoStreamIndex: (streamIndex: StreamIndex) => boolean;
5787
+ }
5595
5788
  declare class VERTC implements IVERTC {
5596
- getSdkVersion: () => any;
5789
+ getSdkVersion: () => string;
5597
5790
  createEngine: (appId: string, config?: EngineConfig | undefined) => IRTCEngine;
5791
+ createBLWEngine: (appId: string, config?: EngineConfig | undefined) => IBLWRTCEngine;
5598
5792
  destroyEngine: (engine: IRTCEngine) => void;
5599
5793
  enumerateDevices: () => Promise<MediaDeviceInfo[]>;
5600
5794
  enableDevices: (options?: {