dingrtc 3.8.20 → 3.9.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/dist/index.d.ts CHANGED
@@ -1660,6 +1660,31 @@ declare class PeerConnectionMonitor extends Monitor {
1660
1660
  getStats(): Promise<PeerConnectionMetrics>;
1661
1661
  }
1662
1662
 
1663
+ declare class MixedLocalAudioTrack extends EventEmitter<ITrackEvent> {
1664
+ private audioContext;
1665
+ private _micAudioTrack;
1666
+ private _screenAudioTrack;
1667
+ private mixedAudioTrackResult;
1668
+ private publication;
1669
+ private _trackId;
1670
+ private logger;
1671
+ trackMediaType: string;
1672
+ constructor(reporter: Reporter);
1673
+ getTrackId(): string;
1674
+ getScreenAudioTrack(): LocalAudioTrack;
1675
+ setScreenAudioTrack(newScreenAudioTrack: LocalAudioTrack): void;
1676
+ getMicAudioTrack(): LocalAudioTrack;
1677
+ setMicAudioTrack(newMicAudioTrack: LocalAudioTrack): void;
1678
+ isPublished: () => boolean;
1679
+ setPublication: (publication?: Publication) => void;
1680
+ getPublication: () => Publication;
1681
+ private updateMicTrackHandler;
1682
+ updateMixedAudioTrackToPub: () => void;
1683
+ private mixAudioTracks;
1684
+ clear: () => void;
1685
+ getMediaStreamTrack: () => MediaStreamTrack;
1686
+ }
1687
+
1663
1688
  interface IPublishEvents {
1664
1689
  ended(): void;
1665
1690
  exception(error: DingRTCError): void;
@@ -1670,6 +1695,8 @@ interface PublicationOptions {
1670
1695
  connection: PeerConnection;
1671
1696
  uid?: string;
1672
1697
  labels?: string[];
1698
+ existedPublications?: Publication[];
1699
+ mixedLocalAudioTrack?: MixedLocalAudioTrack;
1673
1700
  }
1674
1701
  /**
1675
1702
  * @internal
@@ -1723,6 +1750,7 @@ declare class SessionManager extends EventEmitter<SessionManagerEvent> {
1723
1750
  serviceManager: ServiceManager;
1724
1751
  reporter: Reporter;
1725
1752
  logger: ILogger;
1753
+ mixedLocalAudioTrack: MixedLocalAudioTrack;
1726
1754
  constructor(client: DingRTCClient, serviceManager: ServiceManager);
1727
1755
  private getOrCreatePeerConnection;
1728
1756
  /**
@@ -1888,6 +1916,10 @@ declare class Subscription extends EventEmitter<ISubscribeEvents> {
1888
1916
  reset(): void;
1889
1917
  clear(): void;
1890
1918
  addTransceiver(transceiver: RTCRtpTransceiver): void;
1919
+ updateTransceiverListeners: () => void;
1920
+ private _onDtlsError;
1921
+ private _onDtlsStateChange;
1922
+ private _onSelectedCandidatePairChange;
1891
1923
  addTransceivers(transceivers: RTCRtpTransceiver[]): void;
1892
1924
  handleVideoFirstFrame(): void;
1893
1925
  private handleMetrics;
@@ -2275,6 +2307,14 @@ declare class DingRTCClient extends EventEmitter<IClientEvents> {
2275
2307
  unsubscribeGroup(groupId: string): Promise<void>;
2276
2308
  /**
2277
2309
  * 混音音频轨道到指定分组
2310
+ *
2311
+ */
2312
+ /**
2313
+ * 混音音频轨道到指定分组
2314
+ * @param track 当有mic audio和 screen audio的时候,任意一个都可以生效,表示对两个audio track 的混流操作
2315
+ * @param mixed true表示混流到group,false表示不再混流到group
2316
+ * @param groupId 目标group
2317
+ * @returns
2278
2318
  */
2279
2319
  mixAudioToGroup(track: LocalAudioTrack, mixed: boolean, groupId?: string): Promise<void>;
2280
2320
  /**
@@ -2391,7 +2431,7 @@ declare class ServiceManager extends EventEmitter<ChannelEvens> {
2391
2431
  micMixedGroups: Set<string>;
2392
2432
  iceConfig: ICEConfig;
2393
2433
  constructor(client: DingRTCClient, reporter: Reporter);
2394
- get localTracks(): LocalTrack[];
2434
+ get publishedLocalTracks(): LocalTrack[];
2395
2435
  get groups(): Group[];
2396
2436
  handleStreamEvent(action: StreamEventAction, payload: StreamEventPlayload): void;
2397
2437
  handleGroupEvent(action: GroupEventAction, group: Group | string, extraPayload?: GroupUser | signal_msg.IGroupProperty | string | signal_msg.IGroupAudioInfo): void;
@@ -2403,6 +2443,10 @@ declare class ServiceManager extends EventEmitter<ChannelEvens> {
2403
2443
  private setIceConfig;
2404
2444
  clear(): void;
2405
2445
  leave(): void;
2446
+ /**
2447
+ * @param tracks 必须已经确认track不重复,都可以发布
2448
+ * @returns
2449
+ */
2406
2450
  publish(tracks: LocalTrack[]): Promise<void>;
2407
2451
  unpublish(tracks: LocalTrack[]): Promise<void>;
2408
2452
  private getRemoteTrack;
@@ -3084,7 +3128,7 @@ declare class Track extends EventEmitter<ITrackEvent> {
3084
3128
  cycleStatsTimer: number;
3085
3129
  cycleStatsInterval: number;
3086
3130
  eventTriggedInterval: number;
3087
- readonly securityToken: string;
3131
+ get securityToken(): string;
3088
3132
  stopUpdateToken(): void;
3089
3133
  send(param: any): void;
3090
3134
  sendStats(param: any): void;
@@ -3103,7 +3147,7 @@ declare class Track extends EventEmitter<ITrackEvent> {
3103
3147
  started: boolean;
3104
3148
  start(slsConfig: _dingrtc_shared.SLSClientConfig): void;
3105
3149
  stop(): void;
3106
- readonly securityToken: string;
3150
+ get securityToken(): string;
3107
3151
  updateSecurityToken(securityToken: _dingrtc_shared.SecurityTokenDTO): void;
3108
3152
  sendMetric(param: any): void;
3109
3153
  sendEvent(param: any): void;
@@ -3455,7 +3499,7 @@ declare class LocalTrack extends Track {
3455
3499
  * - true: 启用该轨道。
3456
3500
  * - false: 禁用该轨道。
3457
3501
  */
3458
- setEnabled(enabled: boolean): Promise<void>;
3502
+ setEnabled(enabled: boolean): Promise<any>;
3459
3503
  /**
3460
3504
  * 关闭本地轨道,并释放相关采集设备。
3461
3505
  *
@@ -3478,7 +3522,7 @@ declare class LocalTrack extends Track {
3478
3522
  * 更新设置轨道使用的媒体设备, 移动端时可通过设置为user、environment来切换前置、后置摄像头
3479
3523
  * @param deviceIdOrFacingMode 设备 id
3480
3524
  */
3481
- setDevice(deviceIdOrFacingMode: string): Promise<void>;
3525
+ setDevice(deviceIdOrFacingMode: string): Promise<boolean | void>;
3482
3526
  /**
3483
3527
  * 获取本地轨道的来源描述
3484
3528
  * @returns 音频或视频轨道描述
@@ -3745,6 +3789,12 @@ declare class DingRTC extends EventEmitter<IGlobalEvent> {
3745
3789
  * @returns 如果 config.withAudio 为 'enable',则返回一个数组,第一个元素是屏幕共享的视频轨道,第二个元素是屏幕共享的音频轨道。否则返回一个数组,只有一个元素,即屏幕共享的视频轨道。
3746
3790
  */
3747
3791
  createScreenVideoTrack(config: ScreenVideoTrackConfig): Promise<(LocalVideoTrack | LocalAudioTrack)[]>;
3792
+ /**
3793
+ * 创建用于屏幕共享的视频轨道和音频轨道。
3794
+ * @param config 屏幕共享的视频配置,包括编码配置、采集配置等。
3795
+ * @returns 返回一个数组,第一个元素是屏幕共享的视频轨道,第二个元素是屏幕共享的音频轨道,第二个可能因为用户不勾选音频而返回空。
3796
+ */
3797
+ createScreenVideoAndAudioTrack(config: ScreenVideoTrackConfig): Promise<(LocalVideoTrack | LocalAudioTrack)[]>;
3748
3798
  /**
3749
3799
  * 同时创建麦克风音频轨道和摄像头视频轨道。
3750
3800
  * 通过麦克风采集的音频创建一个音频轨道,同时通过摄像头采集的视频创建一个视频轨道。
@@ -3793,4 +3843,5 @@ declare class DingRTC extends EventEmitter<IGlobalEvent> {
3793
3843
  }
3794
3844
  declare const _default: DingRTC;
3795
3845
 
3796
- export { AudioSourceInfo, AudioSourceState, type BufferSourceAudioTrackConfig, CameraVideoTrack, type CameraVideoTrackConfig, type ChannelEvens, type ConnectionState, type CustomAudioTrackConfig, type CustomVideoTrackConfig, type DeviceInfo, DingRTCClient, type DisconnectedReason, FALLBACK_SUB_VIDEO_PROFILE, type GlobalClientConfigInfo, type Group, type GroupAudioRoute, type GroupPropertyUpdateTypes, type GroupUser, type IClientEvents, type ICommonExceptionEvent, type IGlobalEvent, type ISharedChannelInstance, type JoinGroupConfig, type JoinParam, type LeaveGroupConfig, type LocalAudioStates, LocalAudioTrack, LocalTrack, type LocalVideoStates, type LocalVideoStatesMap, LocalVideoTrack, type LogLevel, MicrophoneAudioTrack, type MicrophoneAudioTrackConfig, type NetworkQuality, type OptimizationMode, type RemoteAudioStates, RemoteAudioTrack, type RemoteStreamType, RemoteTrack, User as RemoteUser, type RemoteVideoStates, type RemoteVideoStatesMap, RemoteVideoTrack, type ScreenVideoTrackConfig, type SubscribeParam, type SubscribeResult, Track, type TrackMediaType, type UnsubscribeParam, type VideoDimension, type VideoEncoderConfiguration, type VideoPlayerConfig, VideoSourceInfo, _default as default };
3846
+ export { AudioSourceInfo, AudioSourceState, CameraVideoTrack, DingRTCClient, FALLBACK_SUB_VIDEO_PROFILE, LocalAudioTrack, LocalTrack, LocalVideoTrack, MicrophoneAudioTrack, RemoteAudioTrack, RemoteTrack, User as RemoteUser, RemoteVideoTrack, Track, VideoSourceInfo, _default as default };
3847
+ export type { BufferSourceAudioTrackConfig, CameraVideoTrackConfig, ChannelEvens, ConnectionState, CustomAudioTrackConfig, CustomVideoTrackConfig, DeviceInfo, DisconnectedReason, GlobalClientConfigInfo, Group, GroupAudioRoute, GroupPropertyUpdateTypes, GroupUser, IClientEvents, ICommonExceptionEvent, IGlobalEvent, ISharedChannelInstance, JoinGroupConfig, JoinParam, LeaveGroupConfig, LocalAudioStates, LocalVideoStates, LocalVideoStatesMap, LogLevel, MicrophoneAudioTrackConfig, NetworkQuality, OptimizationMode, RemoteAudioStates, RemoteStreamType, RemoteVideoStates, RemoteVideoStatesMap, ScreenVideoTrackConfig, SubscribeParam, SubscribeResult, TrackMediaType, UnsubscribeParam, VideoDimension, VideoEncoderConfiguration, VideoPlayerConfig };