dingrtc 3.8.20 → 3.9.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/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
  /**
@@ -2390,8 +2430,14 @@ declare class ServiceManager extends EventEmitter<ChannelEvens> {
2390
2430
  subscribedAudioStream: string;
2391
2431
  micMixedGroups: Set<string>;
2392
2432
  iceConfig: ICEConfig;
2433
+ /**
2434
+ * 正在处理的订阅参数,防止订阅重复
2435
+ */
2436
+ private processingSubParamsMap;
2437
+ private static subAcc;
2393
2438
  constructor(client: DingRTCClient, reporter: Reporter);
2394
- get localTracks(): LocalTrack[];
2439
+ private getSubTraceId;
2440
+ get publishedLocalTracks(): LocalTrack[];
2395
2441
  get groups(): Group[];
2396
2442
  handleStreamEvent(action: StreamEventAction, payload: StreamEventPlayload): void;
2397
2443
  handleGroupEvent(action: GroupEventAction, group: Group | string, extraPayload?: GroupUser | signal_msg.IGroupProperty | string | signal_msg.IGroupAudioInfo): void;
@@ -2403,6 +2449,10 @@ declare class ServiceManager extends EventEmitter<ChannelEvens> {
2403
2449
  private setIceConfig;
2404
2450
  clear(): void;
2405
2451
  leave(): void;
2452
+ /**
2453
+ * @param tracks 必须已经确认track不重复,都可以发布
2454
+ * @returns
2455
+ */
2406
2456
  publish(tracks: LocalTrack[]): Promise<void>;
2407
2457
  unpublish(tracks: LocalTrack[]): Promise<void>;
2408
2458
  private getRemoteTrack;
@@ -3084,7 +3134,7 @@ declare class Track extends EventEmitter<ITrackEvent> {
3084
3134
  cycleStatsTimer: number;
3085
3135
  cycleStatsInterval: number;
3086
3136
  eventTriggedInterval: number;
3087
- readonly securityToken: string;
3137
+ get securityToken(): string;
3088
3138
  stopUpdateToken(): void;
3089
3139
  send(param: any): void;
3090
3140
  sendStats(param: any): void;
@@ -3103,7 +3153,7 @@ declare class Track extends EventEmitter<ITrackEvent> {
3103
3153
  started: boolean;
3104
3154
  start(slsConfig: _dingrtc_shared.SLSClientConfig): void;
3105
3155
  stop(): void;
3106
- readonly securityToken: string;
3156
+ get securityToken(): string;
3107
3157
  updateSecurityToken(securityToken: _dingrtc_shared.SecurityTokenDTO): void;
3108
3158
  sendMetric(param: any): void;
3109
3159
  sendEvent(param: any): void;
@@ -3455,7 +3505,7 @@ declare class LocalTrack extends Track {
3455
3505
  * - true: 启用该轨道。
3456
3506
  * - false: 禁用该轨道。
3457
3507
  */
3458
- setEnabled(enabled: boolean): Promise<void>;
3508
+ setEnabled(enabled: boolean): Promise<any>;
3459
3509
  /**
3460
3510
  * 关闭本地轨道,并释放相关采集设备。
3461
3511
  *
@@ -3478,7 +3528,7 @@ declare class LocalTrack extends Track {
3478
3528
  * 更新设置轨道使用的媒体设备, 移动端时可通过设置为user、environment来切换前置、后置摄像头
3479
3529
  * @param deviceIdOrFacingMode 设备 id
3480
3530
  */
3481
- setDevice(deviceIdOrFacingMode: string): Promise<void>;
3531
+ setDevice(deviceIdOrFacingMode: string): Promise<boolean | void>;
3482
3532
  /**
3483
3533
  * 获取本地轨道的来源描述
3484
3534
  * @returns 音频或视频轨道描述
@@ -3745,6 +3795,12 @@ declare class DingRTC extends EventEmitter<IGlobalEvent> {
3745
3795
  * @returns 如果 config.withAudio 为 'enable',则返回一个数组,第一个元素是屏幕共享的视频轨道,第二个元素是屏幕共享的音频轨道。否则返回一个数组,只有一个元素,即屏幕共享的视频轨道。
3746
3796
  */
3747
3797
  createScreenVideoTrack(config: ScreenVideoTrackConfig): Promise<(LocalVideoTrack | LocalAudioTrack)[]>;
3798
+ /**
3799
+ * 创建用于屏幕共享的视频轨道和音频轨道。
3800
+ * @param config 屏幕共享的视频配置,包括编码配置、采集配置等。
3801
+ * @returns 返回一个数组,第一个元素是屏幕共享的视频轨道,第二个元素是屏幕共享的音频轨道,第二个可能因为用户不勾选音频而返回空。
3802
+ */
3803
+ createScreenVideoAndAudioTrack(config: ScreenVideoTrackConfig): Promise<(LocalVideoTrack | LocalAudioTrack)[]>;
3748
3804
  /**
3749
3805
  * 同时创建麦克风音频轨道和摄像头视频轨道。
3750
3806
  * 通过麦克风采集的音频创建一个音频轨道,同时通过摄像头采集的视频创建一个视频轨道。
@@ -3793,4 +3849,5 @@ declare class DingRTC extends EventEmitter<IGlobalEvent> {
3793
3849
  }
3794
3850
  declare const _default: DingRTC;
3795
3851
 
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 };
3852
+ export { AudioSourceInfo, AudioSourceState, CameraVideoTrack, DingRTCClient, FALLBACK_SUB_VIDEO_PROFILE, LocalAudioTrack, LocalTrack, LocalVideoTrack, MicrophoneAudioTrack, RemoteAudioTrack, RemoteTrack, User as RemoteUser, RemoteVideoTrack, Track, VideoSourceInfo, _default as default };
3853
+ 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 };