@byteplus/rtc 4.46.3 → 4.47.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
@@ -138,6 +138,10 @@ declare enum ErrorCode {
138
138
  * @brief The user has been removed from the room because the same user joined the room on the other client.
139
139
  */
140
140
  DUPLICATE_LOGIN = "DUPLICATE_LOGIN",
141
+
142
+ /**
143
+ * @brief The specified video stream doesn't exist when you take the snapshot.
144
+ */
141
145
  INVOKED_BEFORE_CAPTURE = "INVOKED_BEFORE_CAPTURE",
142
146
 
143
147
  /**
@@ -423,10 +427,12 @@ declare enum AudioMixingError {
423
427
  AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK = 9
424
428
  }
425
429
  /**
430
+ * @id AudioMixingManager
426
431
  * @list 104477
427
432
  * @detail 104478
428
433
  */
429
434
  /**
435
+ * @id AudioMixingManager
430
436
  * @list 104477
431
437
  * @detail 104478
432
438
  */
@@ -676,13 +682,14 @@ export interface DeviceInfo {
676
682
  */
677
683
  deviceState: "active" | "inactive";
678
684
  }
685
+ /**
686
+ * {zh}
687
+ * 音频编码参数细节
688
+ */
679
689
  export interface AudioCodecProfile {
680
690
  chn: number;
681
691
  sr: number;
682
692
  }
683
- /**
684
- * 音频采集参数下发,定义参考文档:https://bytedance.feishu.cn/sheets/shtcnu2nj9ghFLWiANQb6A1snxh?sheet=7d720e
685
- */
686
693
  export interface IEngineBAC {
687
694
  codec?: {
688
695
  enc_fs?: number;
@@ -695,9 +702,6 @@ export interface IEngineBAC {
695
702
  aec?: any;
696
703
  ans?: any;
697
704
  }
698
- /**
699
- * 音频编码参数下发,定义参考文档:https://bytedance.feishu.cn/sheets/shtcnu2nj9ghFLWiANQb6A1snxh?sheet=7d720e
700
- */
701
705
  export interface IEngineANM {
702
706
  enc_param?: {
703
707
  bitrate: number;
@@ -707,9 +711,11 @@ export interface IEngineANM {
707
711
  }
708
712
  export interface IAudioConfig {
709
713
  bitrate?: number;
714
+ encChannel?: number;
710
715
  channel?: number;
711
716
  playChannel?: number;
712
717
  sampleRate?: number;
718
+ encSampleRate?: number;
713
719
  playbackRate?: number;
714
720
  agc?: boolean;
715
721
  aec?: boolean;
@@ -728,10 +734,6 @@ declare class AudioProfileManager {
728
734
  private _init;
729
735
  updateEngineBAC(newProfile?: IEngineBAC): void;
730
736
  updateEngineANM(newProfile?: IEngineANM): void;
731
- /**
732
- * 通过setAudioProfile设置进来的预设编码参数
733
- * @param profile AudioProfile
734
- */
735
737
  setAudioProfile(profile: AudioProfileType): void;
736
738
  setBitrate(bitrate: number): void;
737
739
  setAEC(enable: boolean): void;
@@ -740,6 +742,42 @@ declare class AudioProfileManager {
740
742
  getOpusConfigStr(): string;
741
743
  get config(): IAudioConfig;
742
744
  }
745
+ /**
746
+ * @brief Cloud proxy informatio
747
+ */
748
+ export interface CloudProxyInfo {
749
+
750
+ /**
751
+ * @brief The cloud proxy IP of log report
752
+ */
753
+ logProxy: string;
754
+
755
+ /**
756
+ * @brief The cloud proxy IP of the access
757
+ */
758
+ accessProxy: string;
759
+
760
+ /**
761
+ * @brief The cloud proxy IP of RTC admin control
762
+ */
763
+ configProxy: string;
764
+ }
765
+ export interface RTCContext {
766
+ audioProfileManager?: AudioProfileManager;
767
+ serverConfig?: {
768
+ videoCodec?: string;
769
+ audioRed: boolean;
770
+ muteReplaceUnsub: boolean;
771
+ simulcastOnDemand: boolean;
772
+ };
773
+ streamRTT?: {
774
+ [streamId: string]: {
775
+ audio: number;
776
+ video: number;
777
+ };
778
+ };
779
+ }
780
+ export declare type RTCExtension = any;
743
781
  declare enum StreamMixingEventType {
744
782
 
745
783
  /**
@@ -787,29 +825,6 @@ declare enum StreamMixingEventType {
787
825
  */
788
826
  STOP_FAILED = 9
789
827
  }
790
- /**
791
- * @brief Cloud proxy informatio
792
- */
793
- export interface CloudProxyInfo {
794
-
795
- /**
796
- * @brief The cloud proxy IP of log report
797
- */
798
- logProxy: string;
799
-
800
- /**
801
- * @brief The cloud proxy IP of the access
802
- */
803
- accessProxy: string;
804
-
805
- /**
806
- * @brief The cloud proxy IP of RTC admin control
807
- */
808
- configProxy: string;
809
- }
810
- export interface RTCContext {
811
- audioProfileManager: AudioProfileManager;
812
- }
813
828
 
814
829
  /**
815
830
  * A user joins the room
@@ -895,6 +910,11 @@ export interface onVideoFirstFrameRenderedEvent {
895
910
  * @brief Width
896
911
  */
897
912
  width: number;
913
+
914
+ /**
915
+ * @brief If this event comes from a screen video stream
916
+ */
917
+ isScreen: boolean;
898
918
  }
899
919
 
900
920
  /**
@@ -943,6 +963,11 @@ export interface onAudioFirstFrameDecodedEvent {
943
963
  * @brief userId of the user published the video stream
944
964
  */
945
965
  userId: string;
966
+
967
+ /**
968
+ * @brief is this event comes from screen sharing
969
+ */
970
+ isScreen: boolean;
946
971
  }
947
972
 
948
973
  /**
@@ -1461,19 +1486,32 @@ declare enum EngineEventsTypes {
1461
1486
 
1462
1487
  /**
1463
1488
  * @brief The first video frame has been rendered successfully.
1489
+ * @deprecated
1464
1490
  */
1465
1491
  onVideoFirstFrameRendered = "onVideoFirstFrameRendered",
1466
1492
 
1467
1493
  /**
1468
1494
  * @brief The first video frame has been decoded successfully.
1495
+ * @deprecated
1469
1496
  */
1470
1497
  onVideoFirstFrameDecoded = "onVideoFirstFrameDecoded",
1471
1498
 
1472
1499
  /**
1500
+ * @brief The first remote video frame has been rendered successfully.
1501
+ */
1502
+ onRemoteVideoFirstFrame = "onRemoteVideoFirstFrame",
1503
+
1504
+ /**
1505
+ * @deprecated
1473
1506
  * @brief The first audio frame has been decoded successfully.
1474
1507
  */
1475
1508
  onAudioFirstFrameDecoded = "onAudioFirstFrameDecoded",
1476
1509
 
1510
+ /**
1511
+ * @brief The first audio frame has been decoded successfully.
1512
+ */
1513
+ onRemoteAudioFirstFrame = "onRemoteAudioFirstFrame",
1514
+
1477
1515
  /**
1478
1516
  * The first video frame has been rendered successfully.
1479
1517
  */
@@ -1873,6 +1911,7 @@ declare enum StreamMixingEventErrorCode {
1873
1911
  }
1874
1912
 
1875
1913
  /**
1914
+ * @id EngineEvents
1876
1915
  * @list 104477
1877
1916
  * @detail 104479
1878
1917
  */
@@ -1992,12 +2031,19 @@ export interface IEngineEvents {
1992
2031
  [EngineEventsTypes.onVideoFirstFrameRendered]: (event: onVideoFirstFrameRenderedEvent) => void;
1993
2032
 
1994
2033
  /**
1995
- * @brief Decoding of the first video frame
2034
+ * @brief Rendering of the first video frame
1996
2035
  * @param event
1997
2036
  * @region Video Management Event
1998
2037
  */
1999
2038
  [EngineEventsTypes.onVideoFirstFrameDecoded]: (event: onVideoFirstFrameDecodedEvent) => void;
2000
2039
 
2040
+ /**
2041
+ * @brief Decoding of the first video frame
2042
+ * @param event
2043
+ * @region Video Management Event
2044
+ */
2045
+ [EngineEventsTypes.onRemoteVideoFirstFrame]: (event: onVideoFirstFrameRenderedEvent) => void;
2046
+
2001
2047
  /**
2002
2048
  * @brief Decoding of the first audio frame
2003
2049
  * @param event
@@ -2005,6 +2051,13 @@ export interface IEngineEvents {
2005
2051
  */
2006
2052
  [EngineEventsTypes.onAudioFirstFrameDecoded]: (event: onAudioFirstFrameDecodedEvent) => void;
2007
2053
 
2054
+ /**
2055
+ * @brief first remote audio frame Received
2056
+ * @param event
2057
+ * @region Audio Management Event
2058
+ */
2059
+ [EngineEventsTypes.onRemoteAudioFirstFrame]: (event: onAudioFirstFrameDecodedEvent) => void;
2060
+
2008
2061
  /**
2009
2062
  * @brief Event of video device state changing.
2010
2063
  * @param event Information and state of a media device.
@@ -2464,6 +2517,7 @@ export interface IEngineEvents {
2464
2517
  }
2465
2518
 
2466
2519
  /**
2520
+ * @id RTCEngine
2467
2521
  * @list 104477
2468
2522
  * @detail 104478
2469
2523
  */
@@ -2557,7 +2611,8 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
2557
2611
  * You can call this API in both automatic subscription mode and manual subscription mode.
2558
2612
  * @param userId The ID of the remote user who published the target audio/video stream.
2559
2613
  * @param mediaType Media stream type, used for specifying whether to subscribe to the audio stream or the video stream.
2560
- * @notes You must first get the remote stream information through onUserPublishStream{@link #IRTCRoomEventHandler#onUserPublishStream} before calling this API to subscribe to streams accordingly.
2614
+ * @notes You must first get the remote stream
2615
+ * information through onUserPublishStream{@link #IRTCRoomEventHandler#onUserPublishStream} before calling this API to subscribe to streams accordingly.
2561
2616
  * @region Room Management
2562
2617
  */
2563
2618
  subscribeStream: (userId: string, mediaType: MediaType) => Promise<void>;
@@ -2814,7 +2869,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
2814
2869
  * @brief Sets the video encoder configuration of the publishing streams.
2815
2870
  * @param descriptions List of configurations for multiple streams. You should note that the resolution you set is the maximum resolution of each stream.
2816
2871
  * You can set parameters for up to 3 streams, SDK will always take the value of the first 3 streams when parameters for more streams are set.
2817
- * The code rate of the parameters must be in descending order.
2872
+ * The resolutions and the frame rates must be in descending order.
2818
2873
  * When the resolution of the max stream is in [540P, 1080P], you can simulcast 3 streams; when in [270P, 450P], you can simulcast 2 streams; when in [0, 180P], you can not enable simulcast.
2819
2874
  * @notes + For the video stream captured by the camera, the default value is 360P, 15FPS; for the screen-sharing stream, the default value is 1080P, 15FPS.
2820
2875
  * + Before calling this API to set parameters for multiple video streams, the largest resolution of published streams is 640px × 360px with a frame rate of 15fps by default.
@@ -3034,7 +3089,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3034
3089
  /**
3035
3090
  * @brief Send point-to-point (P2P) text message to a user.
3036
3091
  * @param userId ID of the recipient
3037
- * @param message Text message within 62 KB.
3092
+ * @param message Text message within 64 KB.
3038
3093
  * @return
3039
3094
  * @notes + Call [login](104478@#login) before calling this API.
3040
3095
  * + The recipient must be logged into the server and will receive the text message via [EngineEventsTypes.onUserMessageReceivedOutsideRoom](104479#onUserMessageReceivedOutsideRoom) if the message has been sent successfully.
@@ -3044,7 +3099,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3044
3099
  /**
3045
3100
  * @brief Send point-to-point (P2P) binary message to a user.
3046
3101
  * @param userId ID of the recipient
3047
- * @param message Binary message within 46 KB
3102
+ * @param message Binary message within 64 KB
3048
3103
  * @return + Call [login](#login) before calling this API.
3049
3104
  * + The recipient must be logged into the server and will receive the text message via [EngineEventsTypes.onUserBinaryMessageReceivedOutsideRoom](104479#onuserbinarymessagereceivedoutsideroom) if the message has been sent successfully.
3050
3105
  * @notes
@@ -3062,7 +3117,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3062
3117
 
3063
3118
  /**
3064
3119
  * @brief Send point-to-point (P2P) text message to the server.
3065
- * @param message Text message within 62 KB.
3120
+ * @param message Text message within 64 KB.
3066
3121
  * @return
3067
3122
  * @notes
3068
3123
  */
@@ -3070,7 +3125,7 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3070
3125
 
3071
3126
  /**
3072
3127
  * @brief Send point-to-point (P2P) binary message to the server.
3073
- * @param message Binary message within 46 KB.
3128
+ * @param message Binary message within 64 KB.
3074
3129
  * @return
3075
3130
  * @notes
3076
3131
  */
@@ -3243,8 +3298,73 @@ export interface IRTCEngine extends EnhancedEventEmitter<IEngineEvents> {
3243
3298
  * @notes We recommend to call this API before the audio capture starts.
3244
3299
  */
3245
3300
  setAudioProfile: (profile: AudioProfileType) => void;
3301
+
3302
+ /**
3303
+ * @brief Get the [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) of the local audios or videos.
3304
+ * @param streamIndex Mainstream or screen-sharing stream.
3305
+ * @param type Video or audio
3306
+ * Audio: Track of the sounds collected from the microphone, customized audio track, audio files, and the sound card.
3307
+ * Video: Track of the videos collected from the camera, customized video track and screen-sharings.
3308
+ * @return `undefined` for the MediaStreamTrack does not exist. For example, the local media capturing has not started.
3309
+ * @notes + Call this API after you start the local media capture or designate a customized MediaStreamTrack.
3310
+ * + Callback of the MediaStreamTrack will inform you by the event of `ended` that the local media capture stops, probably caused either by an API call or the removal of devices.
3311
+ * + You can get the following info from the MediaStreamTrack: video resolution, device ID, and volume. You can manage the track actions by the method of `stop` or `mute`. You can also change the properties of the stream, such as audio volume.
3312
+ * + We recommend to call RTC APIs to enable your app with the following capabilities instead of using mediaStreamTrack.
3313
+ * 1. Get the video resolution or audio volume of the local streams: [onLocalStreamStats](70081#onlocalstreamstats)
3314
+ * 2. Get device IDs: [`enumerateDevices`](#enumeratedevices)
3315
+ * 3. stop: [`stopAudioCapture`](#stopaudiocapture), [`stopVideoCapture`](#stopvideocapture)
3316
+ */
3317
+ getLocalStreamTrack: (streamIndex: StreamIndex, type: "video" | "audio") => MediaStreamTrack | undefined;
3318
+
3319
+ /**
3320
+ * @brief Get the [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) of the remote audios or videos.
3321
+ * @param userId ID of the remote user
3322
+ * @param streamIndex Mainstream or screen-sharing stream.
3323
+ * @param type Video or audio
3324
+ * @return `undefined` for the MediaStreamTrack does not exist. For example, the local user has not subscribed to the remote stream.
3325
+ * @notes + Call this API after the local user subscribe to the remote media stream.
3326
+ * + Callback of the MediaStreamTrack will inform you by the event of `ended` that the remote media stream stops, probably caused by the API call of [`unsubscribeStream`](#unsubscribestream) or [`unsubscribeScreen`](#unsubscribescreen).
3327
+ * + You can get video resolution and audio volume from the MediaStreamTrack. You can manage the track actions by the method of `stop` or `mute`. You can also change the properties of the stream, such as audio volume.
3328
+ * + We recommend to call RTC APIs to enable your app with the following capabilities instead of using mediaStreamTrack.
3329
+ * 1. Get the video resolution or audio volume of the remote streams: [`onRemoteStreamStats`](70081#onremotestreamstats)
3330
+ * 2. stop: [`unsubscribeStream`](#unsubscribeStream), [`unsubscribeScreen`](#unsubscribescreen)
3331
+ */
3332
+ getRemoteStreamTrack: (userId: string, streamIndex: StreamIndex, type: "video" | "audio") => MediaStreamTrack | undefined;
3333
+
3334
+ /**
3335
+ * @brief Get the [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) of the audios or videos from the subscribed public stream.
3336
+ * @param id ID of the public stream
3337
+ * @param type Video or audio
3338
+ * @return `undefined` for the MediaStreamTrack does not exist. For example, the public stream does not exist.
3339
+ * @notes + Call this API after you start playing the public stream by calling [`stopPlayPublicStream`](#stopplaypublicstream).
3340
+ * + Callback of the MediaStreamTrack will inform you the event of `ended` that the public stream stops, probably caused by the API call of [`stopPlayPublicStream`](#stopplaypublicstream).
3341
+ */
3342
+ getPublicStreamTrack: (id: string, type: "video" | "audio") => MediaStreamTrack | undefined;
3343
+
3344
+ /**
3345
+ * @brief Take a snapshot of the local video.
3346
+ * @param streamIndex The specified video stream.
3347
+ * @notes + The snapshot is taken with all video effects on, like rotation, and mirroring.
3348
+ * + You can take the snapshot either using SDK internal video capture or customized capture.
3349
+ */
3246
3350
  takeLocalSnapshot: (streamIndex: StreamIndex) => Promise<ImageData>;
3351
+
3352
+ /**
3353
+ * @brief Take a snapshot of the remote video.
3354
+ * @param id The index of the user's stream or the index of the public stream.
3355
+ * @param streamIndex The specified video stream.
3356
+ */
3247
3357
  takeRemoteSnapshot: (id: string, streamIndex: StreamIndex) => Promise<ImageData>;
3358
+
3359
+ /**
3360
+ * @brief Registers an extension.
3361
+ * @param extension The extension instance.
3362
+ * @return
3363
+ * @notes You can use the following extensions.
3364
+ * • [Beauty Effects Extension](https://docs.byteplus.com/byteplus-rtc/docs/148646).
3365
+ * • [AI Noise-Cancelling Extension](https://docs.byteplus.com/byteplus-rtc/docs/148647).
3366
+ */
3367
+ registerExtension: (extension: RTCExtension) => Promise<void>;
3248
3368
  }
3249
3369
 
3250
3370
  /**
@@ -4484,6 +4604,12 @@ export interface EngineConfig {
4484
4604
  * @brief Auto-play policy
4485
4605
  */
4486
4606
  autoPlayPolicy: RTCAutoPlayPolicy;
4607
+
4608
+ /**
4609
+ * @hidden
4610
+ * @brief A private parameter which is used to designate the edge server to access
4611
+ */
4612
+ expectedIDC: string;
4487
4613
  }
4488
4614
 
4489
4615
  /**
@@ -4556,20 +4682,24 @@ export interface CloudProxyConnectedEvent {
4556
4682
  declare const Config: {
4557
4683
  VERSION: string;
4558
4684
  ICE_CONFIG_REQUEST_URLS_INTERNAL: string[];
4559
- ICE_CONFIG_REQUEST_URLS: any[];
4685
+ ICE_CONFIG_REQUEST_URLS: never[];
4560
4686
  EXPECTED_ADDR: string;
4561
4687
  LOG_SERVER_URL: string;
4562
4688
  CONFIG_REQUEST_DOMAINS: string[];
4563
4689
  DEVICE_ID: string;
4564
4690
  OVERSEA: boolean;
4691
+ PLATFORM: string;
4692
+ PRODUCT: string;
4565
4693
  };
4566
4694
  declare function setParameter(key: keyof typeof Config, value: any): void;
4567
- declare function getParameter(key: keyof typeof Config): string | boolean | any[];
4695
+ declare function getParameter(key: keyof typeof Config): string | boolean | string[];
4568
4696
  /**
4697
+ * @id VERTC
4569
4698
  * @list 104477
4570
4699
  * @detail 104478
4571
4700
  */
4572
4701
  /**
4702
+ * @id VERTC
4573
4703
  * @list 104477
4574
4704
  * @detail 104478
4575
4705
  */
@@ -4678,7 +4808,7 @@ export interface IVERTC {
4678
4808
  }
4679
4809
  declare class VERTC implements IVERTC {
4680
4810
  getSdkVersion: () => string;
4681
- createEngine: (appId: string, config?: EngineConfig) => IRTCEngine;
4811
+ createEngine: (appId: string, config?: EngineConfig | undefined) => IRTCEngine;
4682
4812
  destroyEngine: (engine: IRTCEngine) => void;
4683
4813
  enumerateDevices: () => Promise<MediaDeviceInfo[]>;
4684
4814
  enableDevices: (options?: {