@byteplus/rtc 4.61.2 → 4.62.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
@@ -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
  };
70
72
  declare const _default: VERTC;
71
73
  declare enum AudioMixingError {
@@ -1281,7 +1283,8 @@ export declare enum MirrorMode {
1281
1283
  }
1282
1284
 
1283
1285
  /**
1284
- * @brief The local mirror type. You cannot use mirror effect during transmission and encoding due to the restrictions of web explorer.
1286
+ * @brief Whether to enable the mirror effect when rendering the video.
1287
+ * You cannot use mirror effect during transmission and encoding due to the restrictions of web explorer.
1285
1288
  */
1286
1289
  export declare enum MirrorType {
1287
1290
 
@@ -1291,7 +1294,7 @@ export declare enum MirrorType {
1291
1294
  MIRROR_TYPE_NONE = 0,
1292
1295
 
1293
1296
  /**
1294
- * @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
1297
+ * @brief Enable mirror effect for the videos.
1295
1298
  */
1296
1299
  MIRROR_TYPE_RENDER = 1
1297
1300
  }
@@ -1741,6 +1744,27 @@ export declare enum VideoSourceType {
1741
1744
  }
1742
1745
  export declare type RTCExtension = any;
1743
1746
 
1747
+ /**
1748
+ * @brief Audio frames struct
1749
+ */
1750
+ export interface AudioFrameData {
1751
+
1752
+ /**
1753
+ * @brief Audio data in PCM format
1754
+ */
1755
+ channels: Float32Array[];
1756
+
1757
+ /**
1758
+ * @brief The number of channels
1759
+ */
1760
+ channelCount: number;
1761
+
1762
+ /**
1763
+ * @brief Sample rate in Hz.
1764
+ */
1765
+ sampleRate: number;
1766
+ }
1767
+
1744
1768
  /**
1745
1769
  * Event of the state change of audio mixing
1746
1770
  */
@@ -2167,6 +2191,21 @@ export interface IAudioMixingManager {
2167
2191
  */
2168
2192
  setAudioMixingPosition: (id: number, position: number) => void;
2169
2193
 
2194
+ /**
2195
+ * @brief Toggle the callbacks carrying the mixing audio frames.
2196
+ * @param mixingId Audio from microphone or device audio.
2197
+ * You will get the callback carrying the audio data as soon as the audio mixing starts.
2198
+ * @param callback The callback function to receive the audio frames. An empty value indicates disabling the callback.
2199
+ * When the user disconnects, the audio data is empty.
2200
+ * @param frameSize The number of samples per frame. The interval between callbacks increases as the frameSize gets larger.
2201
+ * 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.
2202
+ * @note + You can call this method after the engine is created. And you will receive the audio frame once mixing audio starts.
2203
+ * + Leave the room will not void the setting.
2204
+ * @group Audio Mixing
2205
+ * @order 45
2206
+ */
2207
+ setAudioFrameCallback: (id: number, callback?: (data: AudioFrameData) => void, frameSize?: number) => void;
2208
+
2170
2209
  /**
2171
2210
  * @brief Start PCM mixing.
2172
2211
  * To mix multiple PCM audio data, call this API multiple times with different ids.
@@ -2545,7 +2584,7 @@ export interface IEngineEvents {
2545
2584
  [EngineEventsTypes.onLocalAudioPropertiesReport]: (event: LocalAudioPropertiesInfo[]) => void;
2546
2585
 
2547
2586
  /**
2548
- * @brief After calling [enableAudioPropertiesReport](docs-104478#enableaudiopropertiesreport), you will periodically receive this callback for the information about the subscribed remote audio streams.
2587
+ * @brief After calling [enableAudioPropertiesReport](docs-104478#enableaudiopropertiesreport), you will receive the cycling callbacks, each providing instant information about the subscribed remote audio streams.
2549
2588
  * The remote audio streams includes the microphone audio and screen audio collected using the RTC SDK internal mechanism/custom mechanism.
2550
2589
  * @param event Information about remote audio.
2551
2590
  * @group Audio Management
@@ -2779,7 +2818,7 @@ export interface IEngineEvents {
2779
2818
  /**
2780
2819
  * @brief Error message.
2781
2820
  */
2782
- message?: String;
2821
+ message?: string;
2783
2822
  }) => void;
2784
2823
 
2785
2824
  /**
@@ -2807,7 +2846,7 @@ export interface IEngineEvents {
2807
2846
  /**
2808
2847
  * @brief Error message.
2809
2848
  */
2810
- message?: String;
2849
+ message?: string;
2811
2850
  }) => void;
2812
2851
 
2813
2852
  /**
@@ -3411,7 +3450,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3411
3450
  * @param streamIndex Video stream properties.
3412
3451
  * @param videoPlayerOption View information and rendering mode. Since V4.61, call this API repeatedly with different playerIds to add the stream to different players.
3413
3452
  * Since V4.56, you can set the rotation of the stream via the `rotation` property.
3414
- * @notes You should bind the view after the user joins a room. This setting will sustain when the user leaves the room.
3453
+ * @notes You should bind the view after the user joins a room. This setting will sustain until the user leaves the room.
3415
3454
  * @group Video Management
3416
3455
  * @order 21
3417
3456
  */
@@ -3425,6 +3464,17 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3425
3464
  */
3426
3465
  setLocalVideoMirrorType: (mirrorType: MirrorType) => void;
3427
3466
 
3467
+ /**
3468
+ * @brief When using internal rendering, enable mirroring for the remote stream.
3469
+ * @param userId ID of the remote user
3470
+ * @param streamIndex Mainstream or screen-sharing stream.
3471
+ * @param mirrorType The mirror type for the remote stream.
3472
+ * @notes + In addition, you must also call [setRemoteVideoPlayer](docs-104478#rtcengine-setremotevideoplayer) to mirror the remote stream in the specified player.
3473
+ * @group Video Management
3474
+ * @order 32
3475
+ */
3476
+ setRemoteVideoMirrorType: (userId: string, streamIndex: StreamIndex, mirrorType: MirrorType) => void;
3477
+
3428
3478
  /**
3429
3479
  * @brief Sets the speaker or the earpiece as the audio playback device. The audio playback device defaults to the speaker.
3430
3480
  * @param deviceId ID of the audio playback device. Call [enumerateDevices](#enumeratedevices) to get device ID.
@@ -3474,17 +3524,17 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3474
3524
  * @param userId The user ID. The empty value indicates the local stream.
3475
3525
  * @return If the specified stream does not exist, the volume values are `0`.
3476
3526
  * + 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>
3477
- * &ensp; - [0, 25]: Silence
3478
- * &ensp; - [26, 75]: Low volume
3479
- * &ensp; - [76, 204]: Medium volume
3480
- * &ensp; - [205, 255]: High volume
3527
+ * &ensp; - \[0, 25]: Silence
3528
+ * &ensp; - \[26, 75]: Low volume
3529
+ * &ensp; - \[76, 204]: Medium volume
3530
+ * &ensp; - \[205, 255]: High volume
3481
3531
  * + 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].
3482
- * &ensp; - [-127, -60]: Silence
3483
- * &ensp; - [-59, -40]: Low volume
3484
- * &ensp; - [-39, -20]: Medium volume
3485
- * &ensp; - [-19, 0]: High volume
3532
+ * &ensp; - \[-127, -60]: Silence
3533
+ * &ensp; - \[-59, -40]: Low volume
3534
+ * &ensp; - \[-39, -20]: Medium volume
3535
+ * &ensp; - \[-19, 0]: High volume
3486
3536
  * @notes + The interval for repeatedly calling this method should be at least 100 milliseconds.
3487
- * + You can also get volume infor via [onLocalAudioPropertiesReport](docs-104479#onlocalaudiopropertiesreport) and [onRemoteAudioPropertiesReport](docs-104479#onremoteaudiopropertiesreport).
3537
+ * + You can also get the audio volume via [onLocalAudioPropertiesReport](docs-104479#onlocalaudiopropertiesreport) and [onRemoteAudioPropertiesReport](docs-104479#onremoteaudiopropertiesreport).
3488
3538
  * @group Audio Management
3489
3539
  * @order 27
3490
3540
  */
@@ -3493,6 +3543,23 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3493
3543
  nonlinearVolume: number;
3494
3544
  };
3495
3545
 
3546
+ /**
3547
+ * @brief Toggle the callbacks carrying the audio frames.
3548
+ * @param streamIndex Audio from microphone or device audio.
3549
+ * @param userId ID of the remote user who published the audio. An empty value indicates the local audio.
3550
+ * When the Audio seclection enabled, only the local audio frames are available.
3551
+ * You will get the callback carrying the audio data as soon as the user starts publish audio.
3552
+ * @param callback The callback function to receive the audio frames. An empty value indicates disabling the callback.
3553
+ * When the user disconnects, the audio data is zero amplitude.
3554
+ * @param frameSize The number of samples per frame. The interval between callbacks increases as the frameSize gets larger.
3555
+ * 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.
3556
+ * @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.
3557
+ * + Neither rejoining the room nor republishing the stream will void the setting.
3558
+ * * @group Custom Stream Processing
3559
+ * @order 40
3560
+ */
3561
+ setAudioFrameCallback: (streamIndex: StreamIndex, userId?: string, callback?: (data: AudioFrameData) => void, frameSize?: number) => void;
3562
+
3496
3563
  /**
3497
3564
  * @brief Pause receiving remote media streams.
3498
3565
  * @param mediaType Media stream type subscribed to.
@@ -3669,7 +3736,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3669
3736
  * @brief Starts pushing media streams to CDN and sets the relevant configurations.
3670
3737
  * @param transcode Configurations to be set when pushing media streams to CDN.
3671
3738
  * @return
3672
- * @notes + After calling this API, you will receive the pushing a mixed stream to CDN events via [onStreamMixingEvent](104479#onstreammixingevent).
3739
+ * @notes + After calling this API, you will receive the pushing a mixed stream to CDN events via [onStreamMixingEvent](docs-104479#onstreammixingevent).
3673
3740
  * + 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.
3674
3741
  * + Call [stopLiveTranscoding](#stoplivetranscoding) to stop pushing mixed streams to CDN.
3675
3742
  * @group Push to CDN
@@ -4190,7 +4257,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
4190
4257
  * @brief Take a snapshot of the local video.
4191
4258
  * @param streamIndex The specified video stream.
4192
4259
  * @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.
4193
- * @notes + The snapshot is taken with all video effects on, including rotation, mirroring, virtual background.
4260
+ * @notes + The snapshot is taken with all video effects on, including the beauty effect, virtual background and mirroring.
4194
4261
  * + You can take the snapshot either using SDK internal video capture or customized capture.
4195
4262
  * @return `INVOKED_BEFORE_CAPTURE`: No such stream. Please make sure that the specified stream has been published.
4196
4263
  * @group Video Snapshot
@@ -4275,7 +4342,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
4275
4342
 
4276
4343
  /**
4277
4344
  * @hidden
4278
- */
4345
+ */
4279
4346
  connect: () => Promise<void>;
4280
4347
 
4281
4348
  /**
@@ -4396,6 +4463,52 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
4396
4463
  * @order 12
4397
4464
  */
4398
4465
  setAudioSelectionConfig: (audioSelectionPriority: AudioSelectionPriority) => Promise<void>;
4466
+
4467
+ /**
4468
+ * @brief Gets the statistics of subscribed video streams and network states.
4469
+ * @return Include the camera video and the screen recording.
4470
+ * @notes The statistics obtained through this method within 1 second remain unchanged.
4471
+ * @group Audio & Video Transport
4472
+ * @order 66
4473
+ */
4474
+ getRemoteVideoStats: () => Record<string, RemoteUserVideoStats[]>;
4475
+
4476
+ /**
4477
+ * @brief Gets the statistics of subscribed audio streams and network states.
4478
+ * @return Include the microphone audio and the device audio.
4479
+ * @notes The statistics obtained through this method within 1 second remain unchanged.
4480
+ * @group Audio & Video Transport
4481
+ * @order 67
4482
+ */
4483
+ getRemoteAudioStats: () => Record<string, RemoteUserAudioStats[]>;
4484
+
4485
+ /**
4486
+ * @brief Gets the statistics of local video streams and network states.
4487
+ * @return Include the camera video and the screen recording.
4488
+ * @notes The statistics obtained through this method within 1 second remain unchanged.
4489
+ * @group Audio & Video Transport
4490
+ * @order 68
4491
+ */
4492
+ getLocalVideoStats: () => LocalUserVideoStats;
4493
+
4494
+ /**
4495
+ * @brief Gets the statistics of local audio streams and network states.
4496
+ * @return Include the microphone audio and the device audio.
4497
+ * @notes The statistics obtained through this method within 1 second remain unchanged.
4498
+ * @group Audio & Video Transport
4499
+ * @order 69
4500
+ */
4501
+ getLocalAudioStats: () => LocalUserAudioStats;
4502
+
4503
+ /**
4504
+ * @hidden for internal use
4505
+ */
4506
+ getPublicVideoStats: () => Record<string, RemoteVideoStats>;
4507
+
4508
+ /**
4509
+ * @hidden for internal use
4510
+ */
4511
+ getPublicAudioStats: () => Record<string, RemoteAudioStats>;
4399
4512
  }
4400
4513
 
4401
4514
  /**
@@ -4578,7 +4691,7 @@ export interface InitPublishState {
4578
4691
  video: boolean;
4579
4692
 
4580
4693
  /**
4581
- * @brief Computer audio
4694
+ * @brief Device audio
4582
4695
  */
4583
4696
  screenAudio: boolean;
4584
4697
 
@@ -4890,6 +5003,38 @@ export interface LocalStreamStats {
4890
5003
  rxQuality?: number;
4891
5004
  }
4892
5005
 
5006
+ /**
5007
+ * State of the local media stream
5008
+ */
5009
+ export interface LocalUserAudioStats {
5010
+
5011
+ /**
5012
+ * @brief State of the microphone audio stream
5013
+ */
5014
+ mainAudioStats: LocalAudioStats;
5015
+
5016
+ /**
5017
+ * @brief State of the device audio stream
5018
+ */
5019
+ screenAudioStats: LocalAudioStats;
5020
+ }
5021
+
5022
+ /**
5023
+ * Statistics of local video streams and network states in the cycle of 1s.
5024
+ */
5025
+ export interface LocalUserVideoStats {
5026
+
5027
+ /**
5028
+ * @brief State of the camera video stream.
5029
+ */
5030
+ mainVideoStats: LocalVideoStats;
5031
+
5032
+ /**
5033
+ * @brief State of the screen recording stream.
5034
+ */
5035
+ screenVideoStats: LocalVideoStats;
5036
+ }
5037
+
4893
5038
  /**
4894
5039
  * Local video states
4895
5040
  */
@@ -5431,6 +5576,38 @@ export interface RemoteStreamSwitch {
5431
5576
  reason: FallbackOrRecoverReason;
5432
5577
  }
5433
5578
 
5579
+ /**
5580
+ * Statistics of subscribed audio streams and network states in the cycle of 1s.
5581
+ */
5582
+ export interface RemoteUserAudioStats {
5583
+
5584
+ /**
5585
+ * @brief State of the microphone audio stream
5586
+ */
5587
+ mainAudioStats: RemoteAudioStats;
5588
+
5589
+ /**
5590
+ * @brief State of the device audio stream
5591
+ */
5592
+ screenAudioStats: RemoteAudioStats;
5593
+ }
5594
+
5595
+ /**
5596
+ * Statistics of subscribed video streams and network states in the cycle of 1s.
5597
+ */
5598
+ export interface RemoteUserVideoStats {
5599
+
5600
+ /**
5601
+ * @brief State of the camera video stream.
5602
+ */
5603
+ mainVideoStats: RemoteVideoStats;
5604
+
5605
+ /**
5606
+ * @brief State of the screen recording stream.
5607
+ */
5608
+ screenVideoStats: RemoteVideoStats;
5609
+ }
5610
+
5434
5611
  /**
5435
5612
  * @brief Configuration of remote video stream
5436
5613
  */
@@ -5697,6 +5874,7 @@ export interface SetParamInterface {
5697
5874
  SEI_COUNT_FPS: number;
5698
5875
  /** 是否开启提前建连 */
5699
5876
  PRE_ICE: boolean;
5877
+ STATS_LOOP_INTERVAL: number;
5700
5878
  }
5701
5879
 
5702
5880
  /**
@@ -5973,7 +6151,7 @@ export interface VideoEncoderConfig {
5973
6151
  export interface VideoPlayerOption {
5974
6152
 
5975
6153
  /**
5976
- * @brief DOM
6154
+ * @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.
5977
6155
  */
5978
6156
  renderDom?: string | HTMLElement;
5979
6157