@byteplus/rtc 4.61.5 → 4.62.0-beta-oc-1000774380.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
@@ -66,8 +66,8 @@ declare const Config: {
66
66
  SEI_TIME_OUT: number;
67
67
  SEI_COUNT_FPS: number;
68
68
  PRE_ICE: boolean;
69
- UPLOAD_REMOTE_STATS: ExtendMediaType;
70
- DISABLE_COMPUTE_PRESSURE: boolean;
69
+ STATS_LOOP_INTERVAL: number;
70
+ HIDDEN_STATS: boolean;
71
71
  };
72
72
  declare const _default: VERTC;
73
73
  declare enum AudioMixingError {
@@ -828,9 +828,6 @@ declare enum ErrorCode {
828
828
  */
829
829
  USER_FORBIDDEN = "USER_FORBIDDEN"
830
830
  }
831
- declare enum ExtendMediaType {
832
- NONE = 0
833
- }
834
831
  declare enum SEIStreamEventType {
835
832
 
836
833
  /**
@@ -1286,7 +1283,8 @@ export declare enum MirrorMode {
1286
1283
  }
1287
1284
 
1288
1285
  /**
1289
- * @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.
1290
1288
  */
1291
1289
  export declare enum MirrorType {
1292
1290
 
@@ -1296,7 +1294,7 @@ export declare enum MirrorType {
1296
1294
  MIRROR_TYPE_NONE = 0,
1297
1295
 
1298
1296
  /**
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
1297
+ * @brief Enable mirror effect for the videos.
1300
1298
  */
1301
1299
  MIRROR_TYPE_RENDER = 1
1302
1300
  }
@@ -1746,6 +1744,27 @@ export declare enum VideoSourceType {
1746
1744
  }
1747
1745
  export declare type RTCExtension = any;
1748
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
+
1749
1768
  /**
1750
1769
  * Event of the state change of audio mixing
1751
1770
  */
@@ -2172,6 +2191,21 @@ export interface IAudioMixingManager {
2172
2191
  */
2173
2192
  setAudioMixingPosition: (id: number, position: number) => void;
2174
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
+
2175
2209
  /**
2176
2210
  * @brief Start PCM mixing.
2177
2211
  * To mix multiple PCM audio data, call this API multiple times with different ids.
@@ -2550,7 +2584,7 @@ export interface IEngineEvents {
2550
2584
  [EngineEventsTypes.onLocalAudioPropertiesReport]: (event: LocalAudioPropertiesInfo[]) => void;
2551
2585
 
2552
2586
  /**
2553
- * @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.
2554
2588
  * The remote audio streams includes the microphone audio and screen audio collected using the RTC SDK internal mechanism/custom mechanism.
2555
2589
  * @param event Information about remote audio.
2556
2590
  * @group Audio Management
@@ -2784,7 +2818,7 @@ export interface IEngineEvents {
2784
2818
  /**
2785
2819
  * @brief Error message.
2786
2820
  */
2787
- message?: String;
2821
+ message?: string;
2788
2822
  }) => void;
2789
2823
 
2790
2824
  /**
@@ -2812,7 +2846,7 @@ export interface IEngineEvents {
2812
2846
  /**
2813
2847
  * @brief Error message.
2814
2848
  */
2815
- message?: String;
2849
+ message?: string;
2816
2850
  }) => void;
2817
2851
 
2818
2852
  /**
@@ -3416,7 +3450,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3416
3450
  * @param streamIndex Video stream properties.
3417
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.
3418
3452
  * 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.
3453
+ * @notes You should bind the view after the user joins a room. This setting will sustain until the user leaves the room.
3420
3454
  * @group Video Management
3421
3455
  * @order 21
3422
3456
  */
@@ -3430,6 +3464,17 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3430
3464
  */
3431
3465
  setLocalVideoMirrorType: (mirrorType: MirrorType) => void;
3432
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
+
3433
3478
  /**
3434
3479
  * @brief Sets the speaker or the earpiece as the audio playback device. The audio playback device defaults to the speaker.
3435
3480
  * @param deviceId ID of the audio playback device. Call [enumerateDevices](#enumeratedevices) to get device ID.
@@ -3479,17 +3524,17 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3479
3524
  * @param userId The user ID. The empty value indicates the local stream.
3480
3525
  * @return If the specified stream does not exist, the volume values are `0`.
3481
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>
3482
- * &ensp; - [0, 25]: Silence
3483
- * &ensp; - [26, 75]: Low volume
3484
- * &ensp; - [76, 204]: Medium volume
3485
- * &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
3486
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].
3487
- * &ensp; - [-127, -60]: Silence
3488
- * &ensp; - [-59, -40]: Low volume
3489
- * &ensp; - [-39, -20]: Medium volume
3490
- * &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
3491
3536
  * @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).
3537
+ * + You can also get the audio volume via [onLocalAudioPropertiesReport](docs-104479#onlocalaudiopropertiesreport) and [onRemoteAudioPropertiesReport](docs-104479#onremoteaudiopropertiesreport).
3493
3538
  * @group Audio Management
3494
3539
  * @order 27
3495
3540
  */
@@ -3498,6 +3543,23 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3498
3543
  nonlinearVolume: number;
3499
3544
  };
3500
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
+
3501
3563
  /**
3502
3564
  * @brief Pause receiving remote media streams.
3503
3565
  * @param mediaType Media stream type subscribed to.
@@ -3674,7 +3736,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3674
3736
  * @brief Starts pushing media streams to CDN and sets the relevant configurations.
3675
3737
  * @param transcode Configurations to be set when pushing media streams to CDN.
3676
3738
  * @return
3677
- * @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).
3678
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.
3679
3741
  * + Call [stopLiveTranscoding](#stoplivetranscoding) to stop pushing mixed streams to CDN.
3680
3742
  * @group Push to CDN
@@ -4195,7 +4257,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
4195
4257
  * @brief Take a snapshot of the local video.
4196
4258
  * @param streamIndex The specified video stream.
4197
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.
4198
- * @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.
4199
4261
  * + You can take the snapshot either using SDK internal video capture or customized capture.
4200
4262
  * @return `INVOKED_BEFORE_CAPTURE`: No such stream. Please make sure that the specified stream has been published.
4201
4263
  * @group Video Snapshot
@@ -4280,7 +4342,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
4280
4342
 
4281
4343
  /**
4282
4344
  * @hidden
4283
- */
4345
+ */
4284
4346
  connect: () => Promise<void>;
4285
4347
 
4286
4348
  /**
@@ -4401,6 +4463,52 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
4401
4463
  * @order 12
4402
4464
  */
4403
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>;
4404
4512
  }
4405
4513
 
4406
4514
  /**
@@ -4583,7 +4691,7 @@ export interface InitPublishState {
4583
4691
  video: boolean;
4584
4692
 
4585
4693
  /**
4586
- * @brief Computer audio
4694
+ * @brief Device audio
4587
4695
  */
4588
4696
  screenAudio: boolean;
4589
4697
 
@@ -4895,6 +5003,38 @@ export interface LocalStreamStats {
4895
5003
  rxQuality?: number;
4896
5004
  }
4897
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
+
4898
5038
  /**
4899
5039
  * Local video states
4900
5040
  */
@@ -5436,6 +5576,38 @@ export interface RemoteStreamSwitch {
5436
5576
  reason: FallbackOrRecoverReason;
5437
5577
  }
5438
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
+
5439
5611
  /**
5440
5612
  * @brief Configuration of remote video stream
5441
5613
  */
@@ -5702,7 +5874,7 @@ export interface SetParamInterface {
5702
5874
  SEI_COUNT_FPS: number;
5703
5875
  /** 是否开启提前建连 */
5704
5876
  PRE_ICE: boolean;
5705
- UPLOAD_REMOTE_STATS: string;
5877
+ STATS_LOOP_INTERVAL: number;
5706
5878
  }
5707
5879
 
5708
5880
  /**
@@ -5979,7 +6151,7 @@ export interface VideoEncoderConfig {
5979
6151
  export interface VideoPlayerOption {
5980
6152
 
5981
6153
  /**
5982
- * @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.
5983
6155
  */
5984
6156
  renderDom?: string | HTMLElement;
5985
6157