@byteplus/rtc 4.61.4 → 4.62.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
@@ -66,6 +66,8 @@ declare const Config: {
66
66
  SEI_TIME_OUT: number;
67
67
  SEI_COUNT_FPS: number;
68
68
  PRE_ICE: boolean;
69
+ STATS_LOOP_INTERVAL: number;
70
+ HIDDEN_STATS: boolean;
69
71
  UPLOAD_REMOTE_STATS: ExtendMediaType;
70
72
  DISABLE_COMPUTE_PRESSURE: boolean;
71
73
  };
@@ -1286,7 +1288,8 @@ export declare enum MirrorMode {
1286
1288
  }
1287
1289
 
1288
1290
  /**
1289
- * @brief The local mirror type. You cannot use mirror effect during transmission and encoding due to the restrictions of web explorer.
1291
+ * @brief Whether to enable the mirror effect when rendering the video.
1292
+ * You cannot use mirror effect during transmission and encoding due to the restrictions of web explorer.
1290
1293
  */
1291
1294
  export declare enum MirrorType {
1292
1295
 
@@ -1296,7 +1299,7 @@ export declare enum MirrorType {
1296
1299
  MIRROR_TYPE_NONE = 0,
1297
1300
 
1298
1301
  /**
1299
- * @brief Enable mirror effect for the local video only. RTC SDK will not add mirror effect on the video to encode and transmit to the other
1302
+ * @brief Enable mirror effect for the videos.
1300
1303
  */
1301
1304
  MIRROR_TYPE_RENDER = 1
1302
1305
  }
@@ -1746,6 +1749,27 @@ export declare enum VideoSourceType {
1746
1749
  }
1747
1750
  export declare type RTCExtension = any;
1748
1751
 
1752
+ /**
1753
+ * @brief Audio frames struct
1754
+ */
1755
+ export interface AudioFrameData {
1756
+
1757
+ /**
1758
+ * @brief Audio data in PCM format
1759
+ */
1760
+ channels: Float32Array[];
1761
+
1762
+ /**
1763
+ * @brief The number of channels
1764
+ */
1765
+ channelCount: number;
1766
+
1767
+ /**
1768
+ * @brief Sample rate in Hz.
1769
+ */
1770
+ sampleRate: number;
1771
+ }
1772
+
1749
1773
  /**
1750
1774
  * Event of the state change of audio mixing
1751
1775
  */
@@ -2172,6 +2196,21 @@ export interface IAudioMixingManager {
2172
2196
  */
2173
2197
  setAudioMixingPosition: (id: number, position: number) => void;
2174
2198
 
2199
+ /**
2200
+ * @brief Toggle the callbacks carrying the mixing audio frames.
2201
+ * @param mixingId Audio from microphone or device audio.
2202
+ * You will get the callback carrying the audio data as soon as the audio mixing starts.
2203
+ * @param callback The callback function to receive the audio frames. An empty value indicates disabling the callback.
2204
+ * When the user disconnects, the audio data is empty.
2205
+ * @param frameSize The number of samples per frame. The interval between callbacks increases as the frameSize gets larger.
2206
+ * It can be set to 256, 512, 1024, 2048, 4096, 8192, or 16384. It defaults to 4096. We recommend use the default value unless the application where the audio frames to be used requires a specific size.
2207
+ * @note + You can call this method after the engine is created. And you will receive the audio frame once mixing audio starts.
2208
+ * + Leave the room will not void the setting.
2209
+ * @group Audio Mixing
2210
+ * @order 45
2211
+ */
2212
+ setAudioFrameCallback: (id: number, callback?: (data: AudioFrameData) => void, frameSize?: number) => void;
2213
+
2175
2214
  /**
2176
2215
  * @brief Start PCM mixing.
2177
2216
  * To mix multiple PCM audio data, call this API multiple times with different ids.
@@ -2550,7 +2589,7 @@ export interface IEngineEvents {
2550
2589
  [EngineEventsTypes.onLocalAudioPropertiesReport]: (event: LocalAudioPropertiesInfo[]) => void;
2551
2590
 
2552
2591
  /**
2553
- * @brief After calling [enableAudioPropertiesReport](docs-104478#enableaudiopropertiesreport), you will periodically receive this callback for the information about the subscribed remote audio streams.
2592
+ * @brief After calling [enableAudioPropertiesReport](docs-104478#enableaudiopropertiesreport), you will receive the cycling callbacks, each providing instant information about the subscribed remote audio streams.
2554
2593
  * The remote audio streams includes the microphone audio and screen audio collected using the RTC SDK internal mechanism/custom mechanism.
2555
2594
  * @param event Information about remote audio.
2556
2595
  * @group Audio Management
@@ -2784,7 +2823,7 @@ export interface IEngineEvents {
2784
2823
  /**
2785
2824
  * @brief Error message.
2786
2825
  */
2787
- message?: String;
2826
+ message?: string;
2788
2827
  }) => void;
2789
2828
 
2790
2829
  /**
@@ -2812,7 +2851,7 @@ export interface IEngineEvents {
2812
2851
  /**
2813
2852
  * @brief Error message.
2814
2853
  */
2815
- message?: String;
2854
+ message?: string;
2816
2855
  }) => void;
2817
2856
 
2818
2857
  /**
@@ -3416,7 +3455,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3416
3455
  * @param streamIndex Video stream properties.
3417
3456
  * @param videoPlayerOption View information and rendering mode. Since V4.61, call this API repeatedly with different playerIds to add the stream to different players.
3418
3457
  * Since V4.56, you can set the rotation of the stream via the `rotation` property.
3419
- * @notes You should bind the view after the user joins a room. This setting will sustain when the user leaves the room.
3458
+ * @notes You should bind the view after the user joins a room. This setting will sustain until the user leaves the room.
3420
3459
  * @group Video Management
3421
3460
  * @order 21
3422
3461
  */
@@ -3430,6 +3469,17 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3430
3469
  */
3431
3470
  setLocalVideoMirrorType: (mirrorType: MirrorType) => void;
3432
3471
 
3472
+ /**
3473
+ * @brief When using internal rendering, enable mirroring for the remote stream.
3474
+ * @param userId ID of the remote user
3475
+ * @param streamIndex Mainstream or screen-sharing stream.
3476
+ * @param mirrorType The mirror type for the remote stream.
3477
+ * @notes + In addition, you must also call [setRemoteVideoPlayer](docs-104478#rtcengine-setremotevideoplayer) to mirror the remote stream in the specified player.
3478
+ * @group Video Management
3479
+ * @order 32
3480
+ */
3481
+ setRemoteVideoMirrorType: (userId: string, streamIndex: StreamIndex, mirrorType: MirrorType) => void;
3482
+
3433
3483
  /**
3434
3484
  * @brief Sets the speaker or the earpiece as the audio playback device. The audio playback device defaults to the speaker.
3435
3485
  * @param deviceId ID of the audio playback device. Call [enumerateDevices](#enumeratedevices) to get device ID.
@@ -3479,17 +3529,17 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3479
3529
  * @param userId The user ID. The empty value indicates the local stream.
3480
3530
  * @return If the specified stream does not exist, the volume values are `0`.
3481
3531
  * + linear volume. The value is in linear relation to the original volume. The higher the value, the higher the volume. The range is [0,255]. <br>
3482
- * &ensp; - [0, 25]: Silence
3483
- * &ensp; - [26, 75]: Low volume
3484
- * &ensp; - [76, 204]: Medium volume
3485
- * &ensp; - [205, 255]: High volume
3532
+ * &ensp; - \[0, 25]: Silence
3533
+ * &ensp; - \[26, 75]: Low volume
3534
+ * &ensp; - \[76, 204]: Medium volume
3535
+ * &ensp; - \[205, 255]: High volume
3486
3536
  * + non-linear volume in dB. The value is in proportion to the log value of the original volume. You can use the value to recognize the Active Speaker in the room. The range is [-127, 0].
3487
- * &ensp; - [-127, -60]: Silence
3488
- * &ensp; - [-59, -40]: Low volume
3489
- * &ensp; - [-39, -20]: Medium volume
3490
- * &ensp; - [-19, 0]: High volume
3537
+ * &ensp; - \[-127, -60]: Silence
3538
+ * &ensp; - \[-59, -40]: Low volume
3539
+ * &ensp; - \[-39, -20]: Medium volume
3540
+ * &ensp; - \[-19, 0]: High volume
3491
3541
  * @notes + The interval for repeatedly calling this method should be at least 100 milliseconds.
3492
- * + You can also get volume infor via [onLocalAudioPropertiesReport](docs-104479#onlocalaudiopropertiesreport) and [onRemoteAudioPropertiesReport](docs-104479#onremoteaudiopropertiesreport).
3542
+ * + You can also get the audio volume via [onLocalAudioPropertiesReport](docs-104479#onlocalaudiopropertiesreport) and [onRemoteAudioPropertiesReport](docs-104479#onremoteaudiopropertiesreport).
3493
3543
  * @group Audio Management
3494
3544
  * @order 27
3495
3545
  */
@@ -3498,6 +3548,23 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3498
3548
  nonlinearVolume: number;
3499
3549
  };
3500
3550
 
3551
+ /**
3552
+ * @brief Toggle the callbacks carrying the audio frames.
3553
+ * @param streamIndex Audio from microphone or device audio.
3554
+ * @param userId ID of the remote user who published the audio. An empty value indicates the local audio.
3555
+ * When the Audio seclection enabled, only the local audio frames are available.
3556
+ * You will get the callback carrying the audio data as soon as the user starts publish audio.
3557
+ * @param callback The callback function to receive the audio frames. An empty value indicates disabling the callback.
3558
+ * When the user disconnects, the audio data is zero amplitude.
3559
+ * @param frameSize The number of samples per frame. The interval between callbacks increases as the frameSize gets larger.
3560
+ * It can be set to 256, 512, 1024, 2048, 4096, 8192, or 16384. It defaults to 4096. We recommend use the default value unless the application where the audio frames to be used requires a specific size.
3561
+ * @note + You can call this method after the engine is created. And you will receive the audio frame once the local audio starts capture, or the remote audio arrives.
3562
+ * + Neither rejoining the room nor republishing the stream will void the setting.
3563
+ * * @group Custom Stream Processing
3564
+ * @order 40
3565
+ */
3566
+ setAudioFrameCallback: (streamIndex: StreamIndex, userId?: string, callback?: (data: AudioFrameData) => void, frameSize?: number) => void;
3567
+
3501
3568
  /**
3502
3569
  * @brief Pause receiving remote media streams.
3503
3570
  * @param mediaType Media stream type subscribed to.
@@ -3674,7 +3741,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3674
3741
  * @brief Starts pushing media streams to CDN and sets the relevant configurations.
3675
3742
  * @param transcode Configurations to be set when pushing media streams to CDN.
3676
3743
  * @return
3677
- * @notes + After calling this API, you will receive the pushing a mixed stream to CDN events via [onStreamMixingEvent](104479#onstreammixingevent).
3744
+ * @notes + After calling this API, you will receive the pushing a mixed stream to CDN events via [onStreamMixingEvent](docs-104479#onstreammixingevent).
3678
3745
  * + If you have subscribed to the push-to-CDN server callback in the [console](https://console.byteplus.com/rtc/cloudRTC?tab=callback), calling this API will receive a [TranscodeStarted](https://docs.byteplus.com/en/byteplus-rtc/docs/75125#transcodestarted) server callback notification. When calling this API repeatedly, subsequent calls to this API will trigger both [TranscodeStarted](https://docs.byteplus.com/en/byteplus-rtc/docs/75125#transcodestarted) and [TranscodeUpdated](https://docs.byteplus.com/en/byteplus-rtc/docs/75125#transcodeupdated) callbacks.
3679
3746
  * + Call [stopLiveTranscoding](#stoplivetranscoding) to stop pushing mixed streams to CDN.
3680
3747
  * @group Push to CDN
@@ -4195,7 +4262,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
4195
4262
  * @brief Take a snapshot of the local video.
4196
4263
  * @param streamIndex The specified video stream.
4197
4264
  * @param playerId Player ID. An empty value indicates the default player. If the default player does not exist by then, the call will not take effect.
4198
- * @notes + The snapshot is taken with all video effects on, including rotation, mirroring, virtual background.
4265
+ * @notes + The snapshot is taken with all video effects on, including the beauty effect, virtual background and mirroring.
4199
4266
  * + You can take the snapshot either using SDK internal video capture or customized capture.
4200
4267
  * @return `INVOKED_BEFORE_CAPTURE`: No such stream. Please make sure that the specified stream has been published.
4201
4268
  * @group Video Snapshot
@@ -4280,7 +4347,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
4280
4347
 
4281
4348
  /**
4282
4349
  * @hidden
4283
- */
4350
+ */
4284
4351
  connect: () => Promise<void>;
4285
4352
 
4286
4353
  /**
@@ -4401,6 +4468,52 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
4401
4468
  * @order 12
4402
4469
  */
4403
4470
  setAudioSelectionConfig: (audioSelectionPriority: AudioSelectionPriority) => Promise<void>;
4471
+
4472
+ /**
4473
+ * @brief Gets the statistics of subscribed video streams and network states.
4474
+ * @return Include the camera video and the screen recording.
4475
+ * @notes The statistics obtained through this method within 1 second remain unchanged.
4476
+ * @group Audio & Video Transport
4477
+ * @order 66
4478
+ */
4479
+ getRemoteVideoStats: () => Record<string, RemoteUserVideoStats[]>;
4480
+
4481
+ /**
4482
+ * @brief Gets the statistics of subscribed audio streams and network states.
4483
+ * @return Include the microphone audio and the device audio.
4484
+ * @notes The statistics obtained through this method within 1 second remain unchanged.
4485
+ * @group Audio & Video Transport
4486
+ * @order 67
4487
+ */
4488
+ getRemoteAudioStats: () => Record<string, RemoteUserAudioStats[]>;
4489
+
4490
+ /**
4491
+ * @brief Gets the statistics of local video streams and network states.
4492
+ * @return Include the camera video and the screen recording.
4493
+ * @notes The statistics obtained through this method within 1 second remain unchanged.
4494
+ * @group Audio & Video Transport
4495
+ * @order 68
4496
+ */
4497
+ getLocalVideoStats: () => LocalUserVideoStats;
4498
+
4499
+ /**
4500
+ * @brief Gets the statistics of local audio streams and network states.
4501
+ * @return Include the microphone audio and the device audio.
4502
+ * @notes The statistics obtained through this method within 1 second remain unchanged.
4503
+ * @group Audio & Video Transport
4504
+ * @order 69
4505
+ */
4506
+ getLocalAudioStats: () => LocalUserAudioStats;
4507
+
4508
+ /**
4509
+ * @hidden for internal use
4510
+ */
4511
+ getPublicVideoStats: () => Record<string, RemoteVideoStats>;
4512
+
4513
+ /**
4514
+ * @hidden for internal use
4515
+ */
4516
+ getPublicAudioStats: () => Record<string, RemoteAudioStats>;
4404
4517
  }
4405
4518
 
4406
4519
  /**
@@ -4583,7 +4696,7 @@ export interface InitPublishState {
4583
4696
  video: boolean;
4584
4697
 
4585
4698
  /**
4586
- * @brief Computer audio
4699
+ * @brief Device audio
4587
4700
  */
4588
4701
  screenAudio: boolean;
4589
4702
 
@@ -4895,6 +5008,38 @@ export interface LocalStreamStats {
4895
5008
  rxQuality?: number;
4896
5009
  }
4897
5010
 
5011
+ /**
5012
+ * State of the local media stream
5013
+ */
5014
+ export interface LocalUserAudioStats {
5015
+
5016
+ /**
5017
+ * @brief State of the microphone audio stream
5018
+ */
5019
+ mainAudioStats: LocalAudioStats;
5020
+
5021
+ /**
5022
+ * @brief State of the device audio stream
5023
+ */
5024
+ screenAudioStats: LocalAudioStats;
5025
+ }
5026
+
5027
+ /**
5028
+ * Statistics of local video streams and network states in the cycle of 1s.
5029
+ */
5030
+ export interface LocalUserVideoStats {
5031
+
5032
+ /**
5033
+ * @brief State of the camera video stream.
5034
+ */
5035
+ mainVideoStats: LocalVideoStats;
5036
+
5037
+ /**
5038
+ * @brief State of the screen recording stream.
5039
+ */
5040
+ screenVideoStats: LocalVideoStats;
5041
+ }
5042
+
4898
5043
  /**
4899
5044
  * Local video states
4900
5045
  */
@@ -5436,6 +5581,38 @@ export interface RemoteStreamSwitch {
5436
5581
  reason: FallbackOrRecoverReason;
5437
5582
  }
5438
5583
 
5584
+ /**
5585
+ * Statistics of subscribed audio streams and network states in the cycle of 1s.
5586
+ */
5587
+ export interface RemoteUserAudioStats {
5588
+
5589
+ /**
5590
+ * @brief State of the microphone audio stream
5591
+ */
5592
+ mainAudioStats: RemoteAudioStats;
5593
+
5594
+ /**
5595
+ * @brief State of the device audio stream
5596
+ */
5597
+ screenAudioStats: RemoteAudioStats;
5598
+ }
5599
+
5600
+ /**
5601
+ * Statistics of subscribed video streams and network states in the cycle of 1s.
5602
+ */
5603
+ export interface RemoteUserVideoStats {
5604
+
5605
+ /**
5606
+ * @brief State of the camera video stream.
5607
+ */
5608
+ mainVideoStats: RemoteVideoStats;
5609
+
5610
+ /**
5611
+ * @brief State of the screen recording stream.
5612
+ */
5613
+ screenVideoStats: RemoteVideoStats;
5614
+ }
5615
+
5439
5616
  /**
5440
5617
  * @brief Configuration of remote video stream
5441
5618
  */
@@ -5702,6 +5879,7 @@ export interface SetParamInterface {
5702
5879
  SEI_COUNT_FPS: number;
5703
5880
  /** 是否开启提前建连 */
5704
5881
  PRE_ICE: boolean;
5882
+ STATS_LOOP_INTERVAL: number;
5705
5883
  UPLOAD_REMOTE_STATS: string;
5706
5884
  }
5707
5885
 
@@ -5979,7 +6157,7 @@ export interface VideoEncoderConfig {
5979
6157
  export interface VideoPlayerOption {
5980
6158
 
5981
6159
  /**
5982
- * @brief DOM
6160
+ * @brief Render window, as the parent element for video rendering. Video's `htmlVideoElement` will be attached under this parent element for rendering, and the width and height of the rendered video will be based on `renderDom`, and is determined whether to completely fill the entire area of the parent element depending on the rendering mode.
5983
6161
  */
5984
6162
  renderDom?: string | HTMLElement;
5985
6163