|
|
@@ -0,0 +1,4509 @@
|
|
|
+/// <reference types="https://esm.d8d.fun/@types/dom-mediacapture-transform@0.1.11/index.d.ts" />
|
|
|
+
|
|
|
+import { default as default_2 } from 'https://esm.d8d.fun/eventemitter3@5.0.1/index.d.ts';
|
|
|
+import { default as default_3 } from 'https://esm.d8d.fun/@aliyun-sls/web-track-browser@0.3.9/dist/web-track-browser.d.ts';
|
|
|
+import { IAudioConstraints } from 'https://esm.d8d.fun/media-device@1.3.0/dist/index.d.ts';
|
|
|
+import { IProfile } from 'https://esm.d8d.fun/aliyun-rts-sdk@2.12.3/dist/index.d.ts';
|
|
|
+import { IStreamConfig } from 'https://esm.d8d.fun/aliyun-rts-sdk@2.12.3/dist/index.d.ts';
|
|
|
+import { IVideoConstraints } from 'https://esm.d8d.fun/media-device@1.3.0/dist/index.d.ts';
|
|
|
+import { LocalStream } from 'https://esm.d8d.fun/aliyun-rts-sdk@2.12.3/dist/index.d.ts';
|
|
|
+import { RemoteStream } from 'https://esm.d8d.fun/aliyun-rts-sdk@2.12.3/dist/index.d.ts';
|
|
|
+
|
|
|
+declare interface AliEngineCameraCapturerConfiguration {
|
|
|
+ width?: number;
|
|
|
+ height?: number;
|
|
|
+ frameRate?: number;
|
|
|
+ maxSendFrameRate?: number;
|
|
|
+ bitrate?: number;
|
|
|
+ cameraDirection?: AliRtcCameraDirection;
|
|
|
+ deviceId?: string;
|
|
|
+}
|
|
|
+
|
|
|
+declare enum AliRtcAudioTrack {
|
|
|
+ /** 无麦克风 */
|
|
|
+ AliRtcAudioTrackNo = 0,
|
|
|
+ /** 麦克风 */
|
|
|
+ AliRtcAudioTrackMic = 1,
|
|
|
+ /** 第二音频流 */
|
|
|
+ AliRtcAudioTrackDual = 2
|
|
|
+}
|
|
|
+
|
|
|
+export declare interface AliRtcAuthInfo {
|
|
|
+ /** 频道ID */
|
|
|
+ channelId: string;
|
|
|
+ /** 用户ID */
|
|
|
+ userId: string;
|
|
|
+ /** 应用ID */
|
|
|
+ appId: string;
|
|
|
+ /** 随机串 */
|
|
|
+ nonce?: string;
|
|
|
+ /** 时间戳 */
|
|
|
+ timestamp: number;
|
|
|
+ /** 令牌 */
|
|
|
+ token: string;
|
|
|
+ /** 会议id */
|
|
|
+ sessionId?: string;
|
|
|
+ /** 角色鉴权值 */
|
|
|
+ role?: AliRtcSdkTokenRole;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface AliRtcBeautyConfig {
|
|
|
+ whiteningLevel: number;
|
|
|
+ /*! 磨皮等级[0-1.0] */
|
|
|
+ smoothnessLevel: number;
|
|
|
+}
|
|
|
+
|
|
|
+declare enum AliRtcCameraDirection {
|
|
|
+ /** 无效 */
|
|
|
+ CAMERA_INVALID = -1,
|
|
|
+ /** 后置 */
|
|
|
+ CAMERA_REAR = 0,
|
|
|
+ /** 前置 */
|
|
|
+ CAMERA_FRONT = 1
|
|
|
+}
|
|
|
+
|
|
|
+export declare interface AliRtcCheckResult {
|
|
|
+ support: boolean;
|
|
|
+ detail: {
|
|
|
+ isWebRTCSupported: boolean;
|
|
|
+ isH264EncodeSupported: boolean;
|
|
|
+ isH264DecodeSupported: boolean;
|
|
|
+ isBrowserSupported: boolean;
|
|
|
+ isScreenShareSupported: boolean;
|
|
|
+ isSendMediaExtensionMsgSupported: boolean;
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcConnectionStatus {
|
|
|
+ /** 初始化完成 */
|
|
|
+ AliRtcConnectionStatusInit = 0,
|
|
|
+ /** 网络连接断开 */
|
|
|
+ AliRtcConnectionStatusDisconnected = 1,
|
|
|
+ /** 建立网络连接中 */
|
|
|
+ AliRtcConnectionStatusConnecting = 2,
|
|
|
+ /** 网络已连接 */
|
|
|
+ AliRtcConnectionStatusConnected = 3,
|
|
|
+ /** 重新建立网络连接中 */
|
|
|
+ AliRtcConnectionStatusReconnecting = 4,
|
|
|
+ /** 网络连接失败 */
|
|
|
+ AliRtcConnectionStatusFailed = 5
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcConnectionStatusChangeReason {
|
|
|
+ /** 未知原因 */
|
|
|
+ AliRtcConnectionChangedDummyReason = 0,
|
|
|
+ /** 媒体通道变更 */
|
|
|
+ AliRtcConnectionMediaPathChanged = 1,
|
|
|
+ /** 心跳超时 */
|
|
|
+ AliRtcConnectionSignalingHeartbeatTimeout = 2,
|
|
|
+ /** 心跳恢复 */
|
|
|
+ AliRtcConnectionSignalingHeartbeatAlive = 3,
|
|
|
+ /** DNS解析成功 */
|
|
|
+ AliRtcConnectionSignalingHttpDnsResolved = 4,
|
|
|
+ /** DNS解析失败 */
|
|
|
+ AliRtcConnectionSignalingHttpDnsFailure = 5,
|
|
|
+ /** GSLB请求失败 */
|
|
|
+ AliRtcConnectionSignalingGslbFailure = 6,
|
|
|
+ /** GSLB请求成功 */
|
|
|
+ AliRtcConnectionSignalingGslbSuccess = 7,
|
|
|
+ /** 加入频道失败 */
|
|
|
+ AliRtcConnectionSignalingJoinRoomFailure = 8,
|
|
|
+ /** 加入频道成功 */
|
|
|
+ AliRtcConnectionSignalingJoinRoomSuccess = 9,
|
|
|
+ /** 离开频道 */
|
|
|
+ AliRtcConnectionSignalingLeaveRoom = 10,
|
|
|
+ /** 信令建立连接 */
|
|
|
+ AliRtcConnectionSignalingConnecting = 11,
|
|
|
+ /** 网络连接中断 */
|
|
|
+ AliRtcConnectionChangedNetworkInterrupted = 12
|
|
|
+}
|
|
|
+
|
|
|
+export declare class AliRtcDataChannelMsg {
|
|
|
+ data: ArrayBuffer;
|
|
|
+ networkTime: number;
|
|
|
+ futureOrProgress: number;
|
|
|
+ type: AliRtcDataMsgType;
|
|
|
+ constructor(data: ArrayBuffer, type?: AliRtcDataMsgType, networkTime?: number, progress?: number);
|
|
|
+ toBuffer(): ArrayBuffer;
|
|
|
+ static parse(buffer: ArrayBuffer): AliRtcDataChannelMsg | undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcDataMsgType {
|
|
|
+ AliEngineDataMsgNone = 0,
|
|
|
+ AliEngineDataMsgMusicProgress = 1,
|
|
|
+ AliEngineDataMsgCustom = 2
|
|
|
+}
|
|
|
+
|
|
|
+declare type AliRtcDualVideoPluginOptions = VideoScalerOptions;
|
|
|
+
|
|
|
+declare class AliRtcEngine_2 extends default_2<AliRtcEngineEventListener> {
|
|
|
+ /**
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
+ static logName: string;
|
|
|
+ /**
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
+ static logError: boolean;
|
|
|
+ /**
|
|
|
+ * 检查浏览器是否支持 WebRTC
|
|
|
+ * @param {string} direction
|
|
|
+ * @returns {Promise<AliRtcCheckResult>}
|
|
|
+ */
|
|
|
+ static isSupported: (direction?: "sendonly" | "recvonly" | "sendrecv" | undefined) => Promise<AliRtcCheckResult>;
|
|
|
+ /**
|
|
|
+ * 检查浏览器是否支持开启大小流
|
|
|
+ * @returns {boolean}
|
|
|
+ */
|
|
|
+ static isDualVideoStreamSupported: typeof VideoScalerFactory.isSupport;
|
|
|
+ /**
|
|
|
+ * 获取摄像头列表
|
|
|
+ * @returns {Promise<string[]>}
|
|
|
+ */
|
|
|
+ static getCameraList: () => Promise<MediaDeviceInfo[]>;
|
|
|
+ static getMicrophoneList: () => Promise<MediaDeviceInfo[]>;
|
|
|
+ static getSpeakerList: () => Promise<MediaDeviceInfo[]>;
|
|
|
+ static getSdkVersion(): string;
|
|
|
+ /**
|
|
|
+ * 设置日志等级
|
|
|
+ * @param level
|
|
|
+ */
|
|
|
+ static setLogLevel(level: AliRtcLogLevel): void;
|
|
|
+ private static _instance?;
|
|
|
+ /**
|
|
|
+ * @brief 获取AliRtcEngine实例
|
|
|
+ * @param key key 可选参与,用于创建多个实例
|
|
|
+ * @details 该方法为同步调用,以单例的形式提供对象创建。
|
|
|
+ */
|
|
|
+ static getInstance(config?: AliRtcEngineConfig): AliRtcEngine_2;
|
|
|
+ static AliRtcSdkChannelProfile: typeof AliRtcSdkChannelProfile;
|
|
|
+ static AliRtcSdkClientRole: typeof AliRtcSdkClientRole;
|
|
|
+ static AliRtcVideoStreamType: typeof AliRtcVideoStreamType;
|
|
|
+ static AliRtcVideoTrack: typeof AliRtcVideoTrack;
|
|
|
+ static AliRtcAudioTrack: typeof AliRtcAudioTrack;
|
|
|
+ static AliRtcPublishState: typeof AliRtcPublishState;
|
|
|
+ static AliRtcSubscribeState: typeof AliRtcSubscribeState;
|
|
|
+ static AliRtcRawDataStreamType: typeof AliRtcRawDataStreamType;
|
|
|
+ static AliRtcLogLevel: typeof AliRtcLogLevel;
|
|
|
+ static AliRtcEngineLocalDeviceType: typeof AliRtcEngineLocalDeviceType;
|
|
|
+ static AliRtcEngineLocalDeviceExceptionType: typeof AliRtcEngineLocalDeviceExceptionType;
|
|
|
+ static AliRtcConnectionStatus: typeof AliRtcConnectionStatus;
|
|
|
+ static AliRtcConnectionStatusChangeReason: typeof AliRtcConnectionStatusChangeReason;
|
|
|
+ static AliRtcPlugin: typeof AliRtcPlugin;
|
|
|
+ static AliRtcPluginTrackType: typeof AliRtcPluginTrackType;
|
|
|
+ static AliRtcLiveTranscodingParam: typeof AliRtcLiveTranscodingParam;
|
|
|
+ static AliRtcLiveTranscodingEncodeParam: typeof AliRtcLiveTranscodingEncodeParam;
|
|
|
+ static AliRtcLiveTranscodingMixParam: typeof AliRtcLiveTranscodingMixParam;
|
|
|
+ static AliRtcLiveTranscodingSingleParam: typeof AliRtcLiveTranscodingSingleParam;
|
|
|
+ static AliRtcTranscodingClockWidget: typeof AliRtcTranscodingClockWidget;
|
|
|
+ static AliRtcTranscodingImage: typeof AliRtcTranscodingImage;
|
|
|
+ static AliRtcTranscodingText: typeof AliRtcTranscodingText;
|
|
|
+ static AliRtcTranscodingUser: typeof AliRtcTranscodingUser;
|
|
|
+ static AliRtcLiveTranscodingMixMode: typeof AliRtcLiveTranscodingMixMode;
|
|
|
+ static AliRtcLiveTranscodingStreamType: typeof AliRtcLiveTranscodingStreamType;
|
|
|
+ static AliRtcLiveTranscodingSourceType: typeof AliRtcLiveTranscodingSourceType;
|
|
|
+ static AliRtcLiveTranscodingTaskProfile: typeof AliRtcLiveTranscodingTaskProfile;
|
|
|
+ static AliRtcLiveTranscodingAudioSampleRate: typeof AliRtcLiveTranscodingAudioSampleRate;
|
|
|
+ static AliRtcLiveTranscodingSegmentType: typeof AliRtcLiveTranscodingSegmentType;
|
|
|
+ static AliRtcLiveTranscodingFontType: typeof AliRtcLiveTranscodingFontType;
|
|
|
+ static AliRtcLiveTranscodingCropMode: typeof AliRtcLiveTranscodingCropMode;
|
|
|
+ static AliRtcLiveTranscodingMediaProcessMode: typeof AliRtcLiveTranscodingMediaProcessMode;
|
|
|
+ static AliRtcLiveTranscodingState: typeof AliRtcLiveTranscodingState;
|
|
|
+ static AliRtcLiveTranscodingErrorCode: typeof AliRtcLiveTranscodingErrorCode;
|
|
|
+ static AliRtcTrascodingPublishTaskStatus: typeof AliRtcTrascodingPublishTaskStatus;
|
|
|
+ static AliRtcDataChannelMsg: typeof AliRtcDataChannelMsg;
|
|
|
+ static AliRtcDataMsgType: typeof AliRtcDataMsgType;
|
|
|
+ /**
|
|
|
+ * @brief 销毁 {@link AliRtcEngine}实例
|
|
|
+ * @details 调用该方法将会释放所有内部使用的资源,当完成音视频通信之后都建议调用该方法释放实例.调用该方法后,你将不能再使用 {@link AliRtcEngine} 的其他方法和任何回调,如需要再次使用需要重新调用 {@link AliRtcEngine.getInstance} 方法创建一个新的实例。
|
|
|
+ * @note 该方法为同步调用,需要等待内部资源释放之后才能执行其他方法
|
|
|
+ */
|
|
|
+ destroy(): Promise<void>;
|
|
|
+ protected channelProfile: AliRtcSdkChannelProfile;
|
|
|
+ protected clientRole: AliRtcSdkClientRole;
|
|
|
+ protected signalingManager: SignalingManager;
|
|
|
+ protected bizControl: BizControl;
|
|
|
+ protected liveTranscoding: AliRtcLiveTranscoding;
|
|
|
+ protected maxSignalingConnectRetryCount?: number;
|
|
|
+ protected slsReporter: SLSReporter;
|
|
|
+ protected connectState: AliRtcConnectionStatus;
|
|
|
+ protected networkError: boolean;
|
|
|
+ private _audioOnlyMode;
|
|
|
+ private _authInfoWillExpireTimer;
|
|
|
+ private _authInfoExpiredTimer;
|
|
|
+ private _serverCheckAuthInfoTimestamp;
|
|
|
+ private _localCheckAuthInfoTimestamp;
|
|
|
+ constructor(config?: AliRtcEngineConfig);
|
|
|
+ /**
|
|
|
+ * 获取当前频道号,已经入会成功返回频道号,否则返回undefined
|
|
|
+ */
|
|
|
+ get channel(): string | undefined;
|
|
|
+ /**
|
|
|
+ * 获取当前用户的 userId,已经入会成功返回自己的 userId,否则返回 undefined
|
|
|
+ */
|
|
|
+ get userId(): string | undefined;
|
|
|
+ get remoteUsers(): RemoteUser[];
|
|
|
+ get publisher(): LocalUser | undefined;
|
|
|
+ get publishAudioStream(): LocalStream | undefined;
|
|
|
+ get isPublishing(): boolean;
|
|
|
+ private get currentRoleCanPublish();
|
|
|
+ /**
|
|
|
+ * 监听 Publisher 事件
|
|
|
+ */
|
|
|
+ private addPublisherListeners;
|
|
|
+ private occurError;
|
|
|
+ /**
|
|
|
+ * 监听 UM 事件
|
|
|
+ */
|
|
|
+ private addBizControlListeners;
|
|
|
+ /**
|
|
|
+ * 添加信令处理
|
|
|
+ * @returns {void}
|
|
|
+ */
|
|
|
+ private addSignalingManagerListeners;
|
|
|
+ private backToUnpublishStatus;
|
|
|
+ /**
|
|
|
+ * 处理入会远程的用户
|
|
|
+ * @param {JoinInfo[]} users
|
|
|
+ * @returns {void}
|
|
|
+ */
|
|
|
+ private handleUsersJoin;
|
|
|
+ /**
|
|
|
+ * 本地用户设备状态变化,通过信令发送给其他人
|
|
|
+ * @param {string} status
|
|
|
+ * @returns {void}
|
|
|
+ */
|
|
|
+ protected onLocalDeviceStatusChange(status: string): void;
|
|
|
+ /**
|
|
|
+ * 网络恢复后,重推;
|
|
|
+ */
|
|
|
+ private resumePublishForNetworkRecovery;
|
|
|
+ /**
|
|
|
+ * 处理房间信令重连成功/心跳恢复
|
|
|
+ * @returns {void}
|
|
|
+ */
|
|
|
+ protected onNetworkRecovery(users?: JoinInfo[]): Promise<void>;
|
|
|
+ private resumeSubList;
|
|
|
+ /**
|
|
|
+ * 重新订阅远端用户
|
|
|
+ * @param {string} userId
|
|
|
+ * @returns {Promise<void>}
|
|
|
+ */
|
|
|
+ retrySubscribe(userId: string): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 处理网络异常
|
|
|
+ * @param {AliRtcError} err
|
|
|
+ * @returns {void}
|
|
|
+ */
|
|
|
+ protected onNetworkError(): void;
|
|
|
+ /**
|
|
|
+ * 处理错误
|
|
|
+ * @param {AliRtcError} err
|
|
|
+ * @returns {void}
|
|
|
+ */
|
|
|
+ protected onError(err: AliRtcError): void;
|
|
|
+ /**
|
|
|
+ * 是否开启大小流
|
|
|
+ * @param {boolean} enabled
|
|
|
+ * @param {AliRtcDualVideoPluginOptions} [options]
|
|
|
+ */
|
|
|
+ setEnableDualVideoStream(enabled: boolean, options?: AliRtcDualVideoPluginOptions): void;
|
|
|
+ /**
|
|
|
+ * 对本地流的操作预检查
|
|
|
+ */
|
|
|
+ private hadPushStream;
|
|
|
+ /**
|
|
|
+ * 获取当前使用的麦克风 deviceId
|
|
|
+ * @returns {string | undefined}
|
|
|
+ */
|
|
|
+ getCurrentMicDeviceId(): string | undefined;
|
|
|
+ /**
|
|
|
+ * 设置频道模式
|
|
|
+ * @param {AliRtcSdkChannelProfile} channelProfile 频道类型,默认值为 AliEngineCommunication
|
|
|
+ * @note 该接口只可以在加入频道之前调用,会议中不可以重新设置,离开频道后可以重新设置
|
|
|
+ */
|
|
|
+ setChannelProfile(channelProfile: AliRtcSdkChannelProfile): void;
|
|
|
+ private startAndPublishDefaultDevices;
|
|
|
+ /**
|
|
|
+ * 设置用户角色
|
|
|
+ * @param {AliRtcSdkClientRole} clientRole 用户角色类型,默认值为 {@link AliRtcSdkClientRole.AliRtcSdkLive}(观众角色)
|
|
|
+ * @note 非通信模式下角色类型才有效
|
|
|
+ */
|
|
|
+ setClientRole(clientRole: AliRtcSdkClientRole): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 获取用户角色
|
|
|
+ * @returns {AliRtcSdkClientRole}
|
|
|
+ */
|
|
|
+ getCurrentClientRole(): AliRtcSdkClientRole;
|
|
|
+ /**
|
|
|
+ * 是否开启纯音频模式
|
|
|
+ * @param {boolean} audioOnly
|
|
|
+ * - true:只有音频推流和拉流
|
|
|
+ * - false(默认值):音视频都支持
|
|
|
+ * @note 只可以在 {@link joinChannel} 之前设置
|
|
|
+ */
|
|
|
+ setAudioOnlyMode(audioOnly: boolean): void;
|
|
|
+ setAudioRedEnabled(audioRedEnabled: boolean): void;
|
|
|
+ /**
|
|
|
+ * 设定鉴权信息过期事件定时器
|
|
|
+ * @param expireTimestamp 鉴权信息过期时间
|
|
|
+ * @param serverTimestamp 入会时服务端时间
|
|
|
+ */
|
|
|
+ private setCheckAuthInfoTimer;
|
|
|
+ /**
|
|
|
+ * 清除鉴权信息过期事件定时器
|
|
|
+ */
|
|
|
+ private clearCheckAuthInfoTimer;
|
|
|
+ /**
|
|
|
+ * @brief 加入频道
|
|
|
+ * @details 该方法让用户加入频道,一个频道内可以加入多个用户进行互相通话。
|
|
|
+ * @details 一般在调用该方法前会根据场景先选择频道模式,通过调用 {@link setChannelProfile} 实现,默认频道模式为通信模式 {@link AliRtcSdkChannelProfile.AliRtcSdkCommunication}
|
|
|
+ * ``` javascript
|
|
|
+ * // 设置频道为互动模式
|
|
|
+ * engine.setChannelProfile(AliRtcSdkChannelProfile.AliRtcInteractivelive);
|
|
|
+ * // 设置角色为主播角色
|
|
|
+ * engine.setClientRole(AliRtcSdkClientRole.AliRtcSdkInteractive);
|
|
|
+ * ```
|
|
|
+ * @param {AliRtcAuthInfo | string} authInfoOrToken (多参数/单参数) 认证信息,从App Server获取。
|
|
|
+ * @param {string} userName 任意用于显示的用户名称。不是User ID
|
|
|
+ * @note
|
|
|
+ * - 异步接口,方法执行成功则为成功入会
|
|
|
+ * - 正常情况一个Appid对应一个App,只有同一个AppId的应用可进行互相童话,不同AppId和channelID不同都不能互通
|
|
|
+ * - 当入会成功后,会触发远端用户收到 {@link AliRtcEngineEventListener.remoteUserOnLineNotify} 回调
|
|
|
+ * - 如果已在会中想重新入会,需要先调用 {@link leaveChannel} 离会,且确保方法执行成功
|
|
|
+ * - 用户加入频道后,默认订阅频道内所有其他用户的音视频流,默认推送音视频流到远端,因此将会产生计费,如果想要取消默认订阅可以 {@link joinChannel} 前调用 {@link setDefaultSubscribeAllRemoteAudioStreams} 和 {@link setDefaultSubscribeAllRemoteVideoStreams}
|
|
|
+ */
|
|
|
+ joinChannel(authInfoOrToken: AliRtcAuthInfo | string, userName?: string): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 离开频道
|
|
|
+ * @note 如果当前不在频道内,调用 leaveChannel 不会对实例产生任何影响,但会产生消息,通知频道内其他用户
|
|
|
+ */
|
|
|
+ leaveChannel(): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 检查当前是否在频道中
|
|
|
+ * @returns {boolean}
|
|
|
+ * - true:在频道中
|
|
|
+ * - false:不在频道中
|
|
|
+ */
|
|
|
+ isInCall(): boolean;
|
|
|
+ /**
|
|
|
+ * 刷新鉴权信息
|
|
|
+ * @param {AliRtcRefreshAuthInfo | string} authInfoOrToken
|
|
|
+ */
|
|
|
+ refreshAuthInfo(authInfoOrToken: AliRtcRefreshAuthInfo | string): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 检查当前是否纯音频模式
|
|
|
+ * @returns {boolean}
|
|
|
+ * - true:纯音频模式
|
|
|
+ * - false:音视频模式
|
|
|
+ */
|
|
|
+ isAudioOnly(): boolean;
|
|
|
+ /**
|
|
|
+ * @brief 是否推送音频流
|
|
|
+ * @param enabled 是否开启/关闭本地音频流推送
|
|
|
+ * - true: 开启音频流推送
|
|
|
+ * - false: 关闭音频流推送
|
|
|
+ * @note SDK默认设置推送音频流,在加入频道前也可以调用此接口修改默认值,并在加入频道成功时生效
|
|
|
+ * @note 加入频道后调用不会停止本地音频采集
|
|
|
+ */
|
|
|
+ publishLocalAudioStream(enabled: boolean): Promise<void>;
|
|
|
+ /**
|
|
|
+ * @brief 查询是否设置推送音频流
|
|
|
+ * @return
|
|
|
+ * - true: 已设置推送
|
|
|
+ * - false: 未设置推送
|
|
|
+ * @note SDK默认设置推送音频流,如果需要取消推送音频流,可以通过 {@link publishLocalAudioStream}方法设置为不推送
|
|
|
+ */
|
|
|
+ isLocalAudioStreamPublished(): boolean;
|
|
|
+ /**
|
|
|
+ * 设置是否默认接收音频流
|
|
|
+ * @param sub
|
|
|
+ * - true: 接收用户的音频流
|
|
|
+ * - false: 停止接收用户的音频流
|
|
|
+ * @note 入会前入会后均可调用。如果在加入频道后调用 setDefaultSubscribeAllRemoteAudioStreams(false),会接收不到设置后加入频道的用户的音频流。
|
|
|
+ * @note 停止接收音频流后,如果想要恢复接收,请调用 {@link subscribeRemoteAudioStream},并指定你想要接收的远端用户ID;
|
|
|
+ * @note 如果想恢复接收多个用户的音频流,则需要多次调用 {@link subscribeRemoteAudioStream}。setDefaultSubscribeAllRemoteAudioStreams(true) 只能恢复接收后面加入频道的用户的音频流。
|
|
|
+ */
|
|
|
+ setDefaultSubscribeAllRemoteAudioStreams(sub: boolean): void;
|
|
|
+ /**
|
|
|
+ * 停止/恢复接收所有远端音频流
|
|
|
+ * @param sub
|
|
|
+ * - true: 接收所有用户的音频流
|
|
|
+ * - false: 停止接收所有用户的音频流
|
|
|
+ * @note 该接口作为订阅远端音频流的总开关,如果设置为false,则不仅当前会议中所有远端音频流都会停止订阅,后续入会的新用户也将不再订阅(即使设置了setDefaultSubscribeAllRemoteAudioStreams(true))
|
|
|
+ */
|
|
|
+ subscribeAllRemoteAudioStreams(sub: boolean): void;
|
|
|
+ /**
|
|
|
+ * 手动拉音频流
|
|
|
+ * @param uid uid
|
|
|
+ * @param sub,默认为 true
|
|
|
+ * - true: 接收指定用户的音频流
|
|
|
+ * - false: 停止接收指定用户的音频流
|
|
|
+ * @note 如果之前有调用过 subscribeAllRemoteAudioStreams(false) 对所有远端音频进行静音,在调用本 API 之前请确保你已调用 subscribeAllRemoteAudioStreams(true)。
|
|
|
+ * @note {@link subscribeAllRemoteAudioStreams} 是全局控制,{@link subscribeRemoteAudioStream} 是精细控制。
|
|
|
+ */
|
|
|
+ subscribeRemoteAudioStream(uid: string, sub: boolean): void;
|
|
|
+ /**
|
|
|
+ * 手动恢复远端用户音频流
|
|
|
+ * @param uid
|
|
|
+ * 用于在自动播放失败等场景恢复播放
|
|
|
+ */
|
|
|
+ resumeRemoteAudioStream(uid: string): void;
|
|
|
+ stopRemoteAudioPlay(uid: string): void;
|
|
|
+ /**
|
|
|
+ * @brief 是否推送本地视频流
|
|
|
+ * @param enabled 是否开启/关闭本地视频流推送
|
|
|
+ * - true: 开启视频流推送
|
|
|
+ * - false: 关闭视频流推送
|
|
|
+ * @note SDK默认设置推送视频流,在加入频道前也可以调用此接口修改默认值,并在加入频道成功时生效
|
|
|
+ * @note 加入频道后调用不会停止本地视频采集
|
|
|
+ */
|
|
|
+ publishLocalVideoStream(enabled: boolean): Promise<void>;
|
|
|
+ /**
|
|
|
+ * @brief 查询是否设置推送视频流
|
|
|
+ * @return
|
|
|
+ * - true: 已设置推送
|
|
|
+ * - false: 未设置推送
|
|
|
+ * @note SDK默认设置推送视频流,如果需要取消推送视频流,可以通过 {@link publishLocalVideoStream} 方法设置为不推送
|
|
|
+ */
|
|
|
+ isLocalVideoStreamPublished(): boolean;
|
|
|
+ /**
|
|
|
+ * 设置默认订阅的相机流格式,大流或小流,会覆盖单人的大小流设置
|
|
|
+ * @param {AliRtcVideoStreamType} streamType 流类型
|
|
|
+ * @note 仅支持传入 1 (默认大流)、2(默认小流),传入其他无效
|
|
|
+ * @note 当无默认类型的相机流,但有另一个,将拉取另一个
|
|
|
+ */
|
|
|
+ setRemoteDefaultVideoStreamType(streamType: AliRtcVideoStreamType): void;
|
|
|
+ /**
|
|
|
+ * 设置某一用户默认订阅的相机流格式,大流或小流
|
|
|
+ * @param userId 远端用户ID
|
|
|
+ * @param {AliRtcVideoStreamType} streamType 流类型
|
|
|
+ * @note 仅支持传入 1 (默认大流)、2(默认小流),传入其他无效
|
|
|
+ * @note 当无默认类型的相机流,但有另一个,将拉取另一个
|
|
|
+ */
|
|
|
+ setRemoteUserVideoStreamType(userId: string, streamType: AliRtcVideoStreamType): void;
|
|
|
+ /**
|
|
|
+ * 设置是否默认接收视频流
|
|
|
+ * @param sub
|
|
|
+ * - true: 接收用户的视频流
|
|
|
+ * - false: 不接收用户的视频流
|
|
|
+ * @note 入会前入会后均可调用。如果在加入频道后调用 setDefaultSubscribeAllRemoteVideoStreams(false),会接收不到设置后加入频道的用户的视频流。
|
|
|
+ * @note 停止接收视频流后,如果想要恢复接收,请调用 {@link subscribeRemoteVideoStream},并指定你想要接收的远端用户ID;
|
|
|
+ * @note 如果想恢复接收多个用户的视频流,则需要多次调用 {@link subscribeRemoteVideoStream};setDefaultSubscribeAllRemoteVideoStreams(true) 只能恢复接收后面加入频道的用户的视频流。
|
|
|
+ */
|
|
|
+ setDefaultSubscribeAllRemoteVideoStreams(sub: boolean): void;
|
|
|
+ /**
|
|
|
+ * 停止/恢复接收所有远端视频流
|
|
|
+ * @param sub
|
|
|
+ * - true: 接收所有用户的视频流
|
|
|
+ * - false: 停止接收所有用户的视频流
|
|
|
+ * @note 该接口作为订阅远端视频流的总开关,如果设置为false,则不仅当前会议中所有远端视频流都会停止订阅,后续入会的新用户也将不再订阅(即使设置了setDefaultSubscribeAllRemoteVideoStreams(true))
|
|
|
+ */
|
|
|
+ subscribeAllRemoteVideoStreams(sub: boolean): void;
|
|
|
+ /**
|
|
|
+ * 合并订阅远端音视频流
|
|
|
+ * @param uid uid
|
|
|
+ * @param videoTrack 视频流类型
|
|
|
+ * @param subVideo 是否订阅视频
|
|
|
+ * @param subAudio 是否订阅音频
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ subscribeRemoteMediaStream(uid: string, videoTrack: AliRtcVideoTrack, subVideo: boolean, subAudio: boolean): void;
|
|
|
+ /**
|
|
|
+ * @brief 手动恢复远端用户视频流
|
|
|
+ * @param uid
|
|
|
+ * @param videoTrack
|
|
|
+ * 用于在自动播放失败等场景恢复播放
|
|
|
+ */
|
|
|
+ resumeRemoteMediaStream(uid: string, videoTrack: AliRtcVideoTrack): void;
|
|
|
+ /**
|
|
|
+ * @brief 订阅目标频道,指定用户的流
|
|
|
+ * @param channelId 目标频道
|
|
|
+ * @param uid 用户ID,从App server分配的唯一标示符
|
|
|
+ * @param track 订阅的视频流类型
|
|
|
+ * @param sub_audio 是否订阅远端用户的音频流
|
|
|
+ * - true:订阅指定用户的音频流
|
|
|
+ * - false:停止订阅指定用户的音频流
|
|
|
+ * @param sub 是否订阅远端用户的流
|
|
|
+ * - true:订阅指定用户的流
|
|
|
+ * - false:停止订阅指定用户的流
|
|
|
+ */
|
|
|
+ /**
|
|
|
+ * @brief 获取远端在线用户列表
|
|
|
+ * @return 当前频道内所有在线用户userid列表
|
|
|
+ * @note 若当前频道ChannelProfile设置为 {@link AliRtcSdkChannelProfile.AliRtcSdkInteractiveLive} 模式,只有设置角色为 {@link AliRtcSdkClientRole.AliRtcSdkInteractive} 的用户为在线用户,本方法不返回角色为 {@link AliRtcSdkClientRole.AliRtcSdkLive} 的用户
|
|
|
+ */
|
|
|
+ getOnlineRemoteUsers(): string[];
|
|
|
+ /**
|
|
|
+ * @brief 查询远端用户状态
|
|
|
+ * @details 通过 uid 查询指定远端用户的状态信息.
|
|
|
+ * @param uid 用户ID。从App server分配的唯一标示符
|
|
|
+ * @return 返回一个远端用户对象。详见{@link RemoteUser}
|
|
|
+ */
|
|
|
+ getUserInfo(uid: string): AliRtcRemoteUserInfo | undefined;
|
|
|
+ /**
|
|
|
+ * @brief 查询用户是否在线
|
|
|
+ * @param uid 用户ID,从App server分配的唯一标示符。不可为NULL
|
|
|
+ * @return
|
|
|
+ * - true: 用户在线
|
|
|
+ * - false: 用户不在线
|
|
|
+ * @note 根据特定的UserID,查询该用户是否在线。
|
|
|
+ */
|
|
|
+ isUserOnline(uid: string): boolean;
|
|
|
+ /**
|
|
|
+ * @brief 开始屏幕共享
|
|
|
+ * @param config 开启屏幕共享的配置
|
|
|
+ * @note 可以通过 config 选择是否开启音频或使用外部自定义 MediaStream
|
|
|
+ * @note 自定义 MediaStream 仅支持一个视频流和一个音频流
|
|
|
+ */
|
|
|
+ startScreenShare(config?: AliRtcScreenShareStartConfig): Promise<void>;
|
|
|
+ /**
|
|
|
+ * @brief 停止屏幕共享
|
|
|
+ */
|
|
|
+ stopScreenShare(): Promise<void>;
|
|
|
+ /**
|
|
|
+ * @brief 设置屏幕流视频编码属性
|
|
|
+ * @details 该方法用于设置屏幕流视频编码属性对应的视频参数,如分辨率、帧率、码率、等 所有设置的参数都有相应的范围限制,如果设置的参数不在有效范围内,SDK会自动调节
|
|
|
+ * @param config 预定义的屏幕共享编码属性,
|
|
|
+ * @note
|
|
|
+ * - 该方法在入会前和入会后都可以调用,如果每次入会只需要设置一次屏幕流视频编码属性,建议在入会前调用
|
|
|
+ */
|
|
|
+ setScreenShareConfiguration(config: AliRtcScreenShareConfiguration): Promise<void>;
|
|
|
+ /**
|
|
|
+ * @breif 设置屏幕流采集内容提示
|
|
|
+ * @param contentHint 设置屏幕流内容提示,用于提升在不同内容场景下的视频编码质量 [参考文档](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/contentHint)
|
|
|
+ */
|
|
|
+ setScreenShareContentHint(contentHint: string): Promise<void>;
|
|
|
+ /**
|
|
|
+ * @brief 是否推送屏幕分享
|
|
|
+ * @param enabled 是否开启/关闭本地屏幕分享推送
|
|
|
+ * - true: 开启屏幕分享推送
|
|
|
+ * - false: 关闭屏幕分享推送
|
|
|
+ * @param config 开启屏幕共享的配置
|
|
|
+ * @note SDK默认设置推送屏幕分享,在加入频道前也可以调用此接口修改默认值,并在加入频道成功时生效
|
|
|
+ * @note 加入频道后调用不会停止本地屏幕采集
|
|
|
+ */
|
|
|
+ publishLocalScreenShareStream(enabled: boolean, config?: AliRtcScreenShareStartConfig): Promise<void>;
|
|
|
+ /**
|
|
|
+ * @brief 查询是否设置推送屏幕分享
|
|
|
+ * @return
|
|
|
+ - true: 已设置推送
|
|
|
+ - false: 未设置推送
|
|
|
+ * @note SDK默认设置不推送屏幕分享,如果需要推送屏幕共享,可以通过{@link startScreenShare}方法开启屏幕共享推送
|
|
|
+ */
|
|
|
+ isScreenSharePublished(): boolean;
|
|
|
+ /**
|
|
|
+ * @brief 设置共享音频的音量大小
|
|
|
+ * @param volume 共享音频音量大小,取值范围[0, 100]
|
|
|
+ */
|
|
|
+ setAudioShareVolume(volume: number): void;
|
|
|
+ /**
|
|
|
+ * 开启音量检测功能
|
|
|
+ * @param {number} interval 检测间隔,单位: ms
|
|
|
+ * @note 建议设置为300ms~500ms,取值 ≤0 表示不启用音量检测功能
|
|
|
+ */
|
|
|
+ enableAudioVolumeIndication(interval: number): void;
|
|
|
+ /**
|
|
|
+ * 停止/恢复本地音频数据发送
|
|
|
+ * @param {boolean} mute 停止或恢复本地音频数据发送
|
|
|
+ * - true:静音本地音频
|
|
|
+ * - false(默认值):取消静音
|
|
|
+ */
|
|
|
+ muteLocalMic(mute?: boolean): void;
|
|
|
+ /**
|
|
|
+ * 停止/恢复远端指定用户的音频流的播放
|
|
|
+ * @param {string} uid 用户ID, 从 App server 分配的唯一标示符
|
|
|
+ * @param {boolean} mute 停止或恢复远端的音频播放
|
|
|
+ * - true:停止播放
|
|
|
+ * - false(默认值):恢复播放
|
|
|
+ * @note 拉流和解码不受影响,支持 {@link joinChannel} 之前和之后设置
|
|
|
+ */
|
|
|
+ muteRemoteAudioPlaying(uid: string, mute?: boolean): void;
|
|
|
+ /**
|
|
|
+ * 停止/恢复远端的所有音频流的播放
|
|
|
+ * @param {boolean} mute 停止或恢复远端的音频播放
|
|
|
+ * - true:停止播放
|
|
|
+ * - false(默认值):恢复播放
|
|
|
+ * @note 拉流和解码不受影响,支持 {@link joinChannel} 之前和之后设置
|
|
|
+ */
|
|
|
+ muteAllRemoteAudioPlaying(mute?: boolean): void;
|
|
|
+ /**
|
|
|
+ * @brief 开启音频采集
|
|
|
+ * @details 此接口可以控制提前打开音频采集,如果不设置,则SDK会自动控制音频采集设备:
|
|
|
+ * - 如果打开推送音频流{@link publishLocalAudioStream},SDK在入会后会打开音频采集
|
|
|
+ * - 如果关闭推送音频流{@link publishLocalAudioStream},SDK在入会后不会打开音频采集
|
|
|
+ * @param {IAudioConstraints} audioConstraints 音频采集参数
|
|
|
+ */
|
|
|
+ startAudioCapture(audioConstraints?: IAudioConstraints): Promise<void>;
|
|
|
+ /**
|
|
|
+ * @brief 设置音频采集参数
|
|
|
+ * @param constraints 音频采集参数
|
|
|
+ */
|
|
|
+ setAudioConstraints(constraints: IAudioConstraints): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 关闭音频采集
|
|
|
+ * @note 调用此接口后,入会后、离会再入会,采集设备保持关闭状态
|
|
|
+ */
|
|
|
+ stopAudioCapture(): void;
|
|
|
+ /**
|
|
|
+ * 切换麦克风
|
|
|
+ * @param {string} deviceId 麦克风设备ID
|
|
|
+ * @param {MediaStreamAudioTrack} audioTrack 音频轨道
|
|
|
+ * @note 传入 audioTrack 则会使用传入的音频轨道
|
|
|
+ */
|
|
|
+ switchMicrophone(deviceId: string, audioTrack?: MediaStreamAudioTrack): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 设置录音音量
|
|
|
+ * @param {VolumeSettings} volumeSettings 录音音量,取值范围[0,100]
|
|
|
+ * - 0:静音
|
|
|
+ * - <100:减小音量
|
|
|
+ * - >100:放大音量
|
|
|
+ */
|
|
|
+ setRecordingVolume(volume: number): void;
|
|
|
+ /**
|
|
|
+ * @brief 设置播放音量
|
|
|
+ * @param volume 播放音量,取值范围[0,100], 0:静音;100:原始音量
|
|
|
+ * @note 注意此方法与 {@link setRemoteAudioVolume} 相互影响,以后调用的一个为准
|
|
|
+ */
|
|
|
+ setPlayoutVolume(volume: number): void;
|
|
|
+ /**
|
|
|
+ * @brief 设置播放音量
|
|
|
+ * @param userId 用户ID
|
|
|
+ * @param volume 播放音量,取值范围[0,100], 0:静音;100:原始音量
|
|
|
+ * @note 注意此方法与 {@link setPlayoutVolume} 相互影响,以后调用的一个为准
|
|
|
+ */
|
|
|
+ setRemoteAudioVolume(userId: string, volume: number): void;
|
|
|
+ /**
|
|
|
+ * 设置麦克风 profile
|
|
|
+ *
|
|
|
+ * @param {AudioProfileKey} profileKey
|
|
|
+ * @return {Promise<void>}
|
|
|
+ */
|
|
|
+ setAudioProfile(profileKey: AudioProfileKey): Promise<void>;
|
|
|
+ /**
|
|
|
+ * @brief 获取当前用户或远端用户的音频轨道
|
|
|
+ * @param {string} userId 远端用户 userId
|
|
|
+ * @return {MediaStreamTrack} 音频轨道
|
|
|
+ *
|
|
|
+ */
|
|
|
+ getAudioTrack(userId?: string): Promise<MediaStreamTrack | undefined>;
|
|
|
+ /**
|
|
|
+ * 为本地预览设置渲染元素和视频流
|
|
|
+ * @param {AliRtcLocalView} view 渲染元素,null 则为停止显示
|
|
|
+ * @param {AliRtcVideoTrack} track 视频流类型
|
|
|
+ */
|
|
|
+ setLocalViewConfig(view: AliRtcLocalView, track: AliRtcVideoTrack): Promise<void>;
|
|
|
+ /**
|
|
|
+ * @brief 采集偏好设置
|
|
|
+ * @param cameraCapturerConfiguration 偏好设置
|
|
|
+ * - width: 设置采集分辨率宽度 默认 1280
|
|
|
+ * - height: 设置采集分辨率高度 默认 720
|
|
|
+ * - frameRate: 设置采集帧率 默认 30
|
|
|
+ * - bitrate: 设置采集码率 默认 2000
|
|
|
+ * - cameraDirection: 设置采集方向,前置或后置摄像头
|
|
|
+ * - deviceId: 设置采集相机ID
|
|
|
+ */
|
|
|
+ setCameraCapturerConfiguration(cameraCapturerConfiguration: AliEngineCameraCapturerConfiguration): Promise<void>;
|
|
|
+ /**
|
|
|
+ * @breif 设置摄像头采集内容提示
|
|
|
+ * @param contentHint 设置视频内容提示,用于提升在不同内容场景下的视频编码质量 [参考文档](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/contentHint)
|
|
|
+ */
|
|
|
+ setCameraCapturerContentHint(contentHint: string): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 禁用或启用摄像头采集
|
|
|
+ * @param enabled
|
|
|
+ * - true : 启用摄像头采集
|
|
|
+ * - false : 禁用摄像头采集
|
|
|
+ */
|
|
|
+ enableLocalVideo(enabled?: boolean): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 是否将停止摄像头流数据发送
|
|
|
+ * @param mute
|
|
|
+ * - true:停止发送摄像头流数据
|
|
|
+ * - false:表示恢复正常
|
|
|
+ */
|
|
|
+ muteLocalCamera(mute: boolean): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 是否将停止屏幕共享流数据发送
|
|
|
+ * @param mute
|
|
|
+ * - true:停止发送屏幕共享流数据
|
|
|
+ * - false:表示恢复正常
|
|
|
+ */
|
|
|
+ muteLocalScreen(mute: boolean): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 设置远端视频显示视图
|
|
|
+ * @param {AliRtcLocalView} view 渲染元素
|
|
|
+ * @param {AliRtcVideoTrack} track 视频流类型
|
|
|
+ * @param {string} uid 用户ID, 从App server分配的唯一标示符
|
|
|
+ * @note 支持joinChannel之前和之后切换窗口。如果 view 传入 null,则停止显示
|
|
|
+ */
|
|
|
+ setRemoteViewConfig(view: AliRtcLocalView, uid: string, track: AliRtcVideoTrack): void;
|
|
|
+ /**
|
|
|
+ * 检查camera是否打开
|
|
|
+ * @return {boolean}
|
|
|
+ * - true: 摄像头已打开
|
|
|
+ * - false: 摄像头没有打开
|
|
|
+ * @note 该接口用于检查当前camera的状态
|
|
|
+ */
|
|
|
+ isCameraOn(): boolean;
|
|
|
+ /**
|
|
|
+ * 切换摄像头
|
|
|
+ * @param {string} deviceId 摄像头设备ID
|
|
|
+ * @param {MediaStreamVideoTrack} videoTrack 视频流
|
|
|
+ * @note 若不传 deviceId 则前后摄像头切换,传入 videoTrack 则会使用传入的 videoTrack
|
|
|
+ */
|
|
|
+ switchCamera(deviceId?: string, videoTrack?: MediaStreamVideoTrack): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 获取摄像头设备ID
|
|
|
+ * @return {string} 摄像头设备ID
|
|
|
+ */
|
|
|
+ getCurrentCameraDeviceId(): string | undefined;
|
|
|
+ /**
|
|
|
+ * @brief 开启摄像头预览
|
|
|
+ * @details 开启摄像头预览并自动打开摄像头
|
|
|
+ * @note 如果没有调用{@link setLocalViewConfig}设置显示的view,则无法预览,但不影响推流。
|
|
|
+ * 可以在{@link joinChannel}之前就开启预览会自动打开摄像头。
|
|
|
+ */
|
|
|
+ startPreview(): Promise<void>;
|
|
|
+ /**
|
|
|
+ * @brief 开启屏幕共享预览
|
|
|
+ * @details 开启屏幕共享预览并自动打开屏幕共享
|
|
|
+ * @param config 开启屏幕共享的配置
|
|
|
+ * @note 如果没有调用{@link setLocalViewConfig}设置显示的view,则无法预览,但不影响推流。
|
|
|
+ * 可以在{@link joinChannel}之前就开启预览会自动打开屏幕共享。
|
|
|
+ */
|
|
|
+ startPreviewScreen(config?: AliRtcScreenShareStartConfig): Promise<void>;
|
|
|
+ /**
|
|
|
+ * @brief 停止本地视频预览
|
|
|
+ */
|
|
|
+ stopPreview(): Promise<void>;
|
|
|
+ /**
|
|
|
+ * @brief 停止本地屏幕共享预览
|
|
|
+ */
|
|
|
+ stopPreviewScreen(): Promise<void>;
|
|
|
+ /**
|
|
|
+ * @brief 获取当前用户或远端用户的视频轨道
|
|
|
+ * @param {AliRtcVideoTrackConfig} config 视频轨道配置
|
|
|
+ * @return {MediaStreamTrack} 视频轨道
|
|
|
+ *
|
|
|
+ */
|
|
|
+ getVideoTrack(config: AliRtcVideoTrackConfig): Promise<MediaStreamTrack | undefined>;
|
|
|
+ /**
|
|
|
+ * @brief 开启旁路直播
|
|
|
+ * @details SDK提供了开启旁路直播的功能,可以把实时音视频流经过混流、混音处理转为标准直播流并推送至指定CDN供应商
|
|
|
+ * @param streamUrl 推流地址
|
|
|
+ * @param transcoding 推流所需参数, 详细定义见{@link AliRtcLiveTranscodingParam}
|
|
|
+ */
|
|
|
+ startPublishLiveStream(streamUrl: string, transcoding: AliRtcLiveTranscodingParam): Promise<any>;
|
|
|
+ /**
|
|
|
+ * @brief 更新旁路直播相关参数
|
|
|
+ * @details SDK提供了更新旁路直播的功能,用于实时更新旁路直播参数
|
|
|
+ * @param streamUrl 推流地址
|
|
|
+ * @param transcoding 推流所需参数, 详细定义见{@link AliRtcLiveTranscodingParam}
|
|
|
+ */
|
|
|
+ updatePublishLiveStream(streamUrl: string, transcoding: AliRtcLiveTranscodingParam): Promise<any>;
|
|
|
+ /**
|
|
|
+ * @brief 更新旁路直播相关参数
|
|
|
+ * @details SDK提供了更新旁路直播的功能,用于实时更新旁路直播参数
|
|
|
+ * @param taskId 任务Id
|
|
|
+ * @param transcoding 推流所需参数, 详细定义见{@link AliRtcLiveTranscodingParam}
|
|
|
+ * @return
|
|
|
+ * - 0 : 成功
|
|
|
+ * - 非0 : 失败
|
|
|
+ * - ERR_INNER(-1) : SDK内部错误,可能的情况为SDK未初始化或者SDK销毁后调用
|
|
|
+ * - 其他 : 返回值参考官网错误码
|
|
|
+ */
|
|
|
+ updatePublishLiveStreamWithTaskId(taskId: string, transcoding: AliRtcLiveTranscodingParam): Promise<any>;
|
|
|
+ /**
|
|
|
+ * @brief 停止旁路直播
|
|
|
+ * @details SDK提供了停止旁路直播的功能
|
|
|
+ * @param streamUrl 推流地址
|
|
|
+ */
|
|
|
+ stopPublishLiveStream(streamUrl: string): Promise<any>;
|
|
|
+ /**
|
|
|
+ * @brief 停止旁路直播
|
|
|
+ * @details SDK提供了停止旁路直播的功能
|
|
|
+ * @param taskId 任务Id
|
|
|
+ */
|
|
|
+ stopPublishLiveStreamWithTaskId(taskId: string): Promise<any>;
|
|
|
+ /**
|
|
|
+ * 获取旁路直播状态
|
|
|
+ * @param streamUrl 推流地址
|
|
|
+ * @return 路直播状态
|
|
|
+ */
|
|
|
+ /**
|
|
|
+ * @brief 设置是否启用媒体扩展信息
|
|
|
+ * @param enabled 是否启用媒体扩展,需要在加入房间之前调用
|
|
|
+ */
|
|
|
+ setEnableMediaExtensionMsg(enabled: boolean): void;
|
|
|
+ /**
|
|
|
+ * @brief 发送媒体扩展信息
|
|
|
+ * @details SDK提供了发送和接收媒体扩展信息的功能,接收端参考 {@link AliRtcEngineEventListener.mediaExtensionMsgReceived},使用场景:
|
|
|
+ * - 使用媒体扩展信息传递时间戳,计算端到端的网络延迟,或者跟自身其他业务做数据同步
|
|
|
+ * - 使用媒体扩展信息传递描述信息。目前可以传递最多 4k Byte数据,可以用来传输少量数据,建议使用Json或者纯字符串;
|
|
|
+ * - 内部使用SEI扩展协议来实现;
|
|
|
+ *
|
|
|
+ * @param message 媒体扩展信息,长度限制为最大4K字节
|
|
|
+ * @param repeatCount 重复次数,代表消息冗余度,用于防止网络丢包导致的消息丢失,-1为无限传输
|
|
|
+ *
|
|
|
+ * @note 启用此能力会增加客户端性能开销,如有需求需要在加入房间之前调用 setEnableMediaExtensionMsg
|
|
|
+ * @note 使用媒体扩展信息时需要复用音视频数据通道,因此必须控制自定义消息的发送频率和消息数据长度,使用限制如下:
|
|
|
+ * - 每秒最多发送profile条消息,因为sei信息是放到h264/h265流中传输,有视频帧编码才能附加扩展信息;
|
|
|
+ * - 为了不影响媒体数据的传输质量,自定义消息体长度限制为4k Byte,可以用来传输少量信息;
|
|
|
+ * - sendMediaExtensionMsg函数中repeatCount参数为自定义消息冗余度,若大于1,则会发送多次,
|
|
|
+ * - 防止网络丢包导致的消息丢失,此时房间里的其他人也会收到多次相同的消息,需要去重
|
|
|
+ * - 发送的自定义消息,在旁路直播时,房间里的订阅者也一样会收到
|
|
|
+ * - 同一时间只有一条MediaExtensionMsg在传输,多次调用sendMediaExtensionMsg,新调用的数据会覆盖前一次的数据;
|
|
|
+ */
|
|
|
+ sendMediaExtensionMsg(message: ArrayBuffer, repeatCount: number): Promise<void>;
|
|
|
+ /**
|
|
|
+ * @brief 发送媒体扩展信息
|
|
|
+ * @details SDK提供了发送和接收媒体扩展信息的功能,接收端参考 {@link AliRtcEngineEventListener.mediaExtensionMsgReceived},使用场景:
|
|
|
+ * - 使用媒体扩展信息传递时间戳,计算端到端的网络延迟,或者跟自身其他业务做数据同步
|
|
|
+ * - 使用媒体扩展信息传递描述信息。目前可以传递最多 4k Byte数据,可以用来传输少量数据,建议使用Json或者纯字符串;
|
|
|
+ * - 内部使用SEI扩展协议来实现;
|
|
|
+ *
|
|
|
+ * @param message 媒体扩展信息,长度限制为最大4K字节
|
|
|
+ * @param repeatCount 重复次数,代表消息冗余度,用于防止网络丢包导致的消息丢失,-1为无限传输
|
|
|
+ * @param payloadType [5, 100..254]范围 payloadType=5等于使用sendMediaExtensionMsg 接口
|
|
|
+ *
|
|
|
+ * @note 启用此能力会增加客户端性能开销,如有需求需要在加入房间之前调用 setEnableMediaExtensionMsg
|
|
|
+ * @note 使用媒体扩展信息时需要复用音视频数据通道,因此必须控制自定义消息的发送频率和消息数据长度,使用限制如下:
|
|
|
+ * - 每秒最多发送profile条消息,因为sei信息是放到h264/h265流中传输,有视频帧编码才能附加扩展信息;
|
|
|
+ * - 为了不影响媒体数据的传输质量,自定义消息体长度限制为4k Byte,可以用来传输少量信息;
|
|
|
+ * - sendMediaExtensionMsg函数中repeatCount参数为自定义消息冗余度,若大于1,则会发送多次,
|
|
|
+ * - 防止网络丢包导致的消息丢失,此时房间里的其他人也会收到多次相同的消息,需要去重
|
|
|
+ * - 发送的自定义消息,在旁路直播时,房间里的订阅者也一样会收到
|
|
|
+ * - 同一时间只有一条MediaExtensionMsg在传输,多次调用sendMediaExtensionMsg,新调用的数据会覆盖前一次的数据;
|
|
|
+ */
|
|
|
+ sendMediaExtensionMsgEx(message: ArrayBuffer, repeatCount: number, payloadType: number): Promise<void>;
|
|
|
+ static Plugin: typeof AliRtcPlugin;
|
|
|
+ /**
|
|
|
+ * @brief 开启音视频处理算法插件
|
|
|
+ * @details RTC采用插件件形式提供音视频增强及特效能力,可通过[官网组件文档](https://help.aliyun.com/document_detail/261183.html) 进行组件下载,参考插件集成文档集成进RTC引擎;
|
|
|
+ * @param plugin 插件库
|
|
|
+ * @param option 插件初始化参数值,请阅读插件库接入文档
|
|
|
+ * @note
|
|
|
+ * - 入会前入会后均可调用;
|
|
|
+ * - 如果重复调用会报错;
|
|
|
+ */
|
|
|
+ enablePlugin(plugin: AliRtcPlugin, options?: any): void;
|
|
|
+ /**
|
|
|
+ * @brief 关闭音视频处理算法插件
|
|
|
+ * @param name 插件名称,通过 plugin.name 获取
|
|
|
+ * @note
|
|
|
+ * - 入会前入会后均可调用;
|
|
|
+ * - 重复调用返回错误;
|
|
|
+ */
|
|
|
+ removePlugin(name: string): void;
|
|
|
+ /**
|
|
|
+ * @brief 根据插件ID设置插件
|
|
|
+ * @param name 插件名称,通过 plugin.name 获取
|
|
|
+ * @param option 插件初始化参数值,请阅读插件库接入文档
|
|
|
+ */
|
|
|
+ setPluginOption(name: string, option: any): void;
|
|
|
+ /**
|
|
|
+ * @brief 根据插件ID获取插件内部信息
|
|
|
+ * @param name 插件名称,通过 plugin.name 获取
|
|
|
+ */
|
|
|
+ getPluginOption(name: string): any;
|
|
|
+ /**
|
|
|
+ * 美颜功能是否有效
|
|
|
+ * @return
|
|
|
+ * - true: 美颜功能有效
|
|
|
+ * - false: 无效
|
|
|
+ */
|
|
|
+ isBeautyAvailable(): boolean;
|
|
|
+ /**
|
|
|
+ * 美颜功能是否开启
|
|
|
+ * @return
|
|
|
+ * - true: 美颜功能已开启
|
|
|
+ * - false: 已关闭
|
|
|
+ */
|
|
|
+ isBeautyEnabled(): boolean;
|
|
|
+ /**
|
|
|
+ * @brief 开启或关闭美颜功能, 并设置美颜效果参数
|
|
|
+ * @param enable
|
|
|
+ * - true: 开启美颜功能
|
|
|
+ * - false: 关闭美颜功能
|
|
|
+ * @param config 美颜效果参数
|
|
|
+ */
|
|
|
+ setBeautyEffect(enable: boolean, config: AliRtcBeautyConfig): void;
|
|
|
+ /**
|
|
|
+ * @brief 开启/关闭虚拟背景替换功能
|
|
|
+ * @details 需要集成美颜插件;
|
|
|
+ * @param enable 是否开启;
|
|
|
+ * @param path 虚拟背景本地图片路径,支持JPG,PNG 格式;
|
|
|
+ *
|
|
|
+ * @note
|
|
|
+ * - 与背景虚化为替换关系,如开启虚拟背景开关后再次开启背景虚化,则只有背景虚化效果;
|
|
|
+ */
|
|
|
+ enableBackgroundExchange(enable: boolean, path: string): void;
|
|
|
+ /**
|
|
|
+ * @brief 开启/关闭虚拟背景虚化功能
|
|
|
+ * @details 需要集成美颜插件;
|
|
|
+ * 需要集成美颜插件,背景替换与背景虚化不可同时使用,如开启虚拟背景开关后再次开启背景虚化,则只有背景虚化效果;
|
|
|
+ * @param enable 是否开启;
|
|
|
+ *
|
|
|
+ * @note
|
|
|
+ * - 与虚拟背景为替换关系,如开启背景虚化开关后再次开启虚拟背景,则只有虚拟背景效果;
|
|
|
+ */
|
|
|
+ enableBackgroundBlur(enable: boolean): void;
|
|
|
+ setParameter(parameter: string): void;
|
|
|
+ getParameter(): string;
|
|
|
+ /**
|
|
|
+ * @brief 发送 DataChannel 消息
|
|
|
+ * @param dataChannelMsg 伴奏控制消息
|
|
|
+ */
|
|
|
+ sendDataChannelMessage(dataChannelMsg: AliRtcDataChannelMsg): void;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface AliRtcEngineConfig {
|
|
|
+ env?: AliRtcEnv;
|
|
|
+ webTrack?: boolean | AliRtcWebTrackConfig;
|
|
|
+ maxSignalingConnectRetryCount?: number;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface AliRtcEngineEventListener {
|
|
|
+ /**
|
|
|
+ * @brief 网络连接状态改变
|
|
|
+ * @param status 连接状态
|
|
|
+ * @param reason 连接状态变化原因
|
|
|
+ */
|
|
|
+ connectionStatusChange: (status: AliRtcConnectionStatus, reason: AliRtcConnectionStatusChangeReason) => void;
|
|
|
+ /**
|
|
|
+ * @brief 本地设备异常回调
|
|
|
+ * @param deviceType 设备类型, 参考{@link AliRtcEngine.AliRtcEngineLocalDeviceType}
|
|
|
+ * @param exceptionType 设备异常类型, 参考{@link AliRtcEngine.AliRtcEngineLocalDeviceExceptionType}
|
|
|
+ * @param msg 异常时携带的信息
|
|
|
+ * @note 此回调标识了内部无法恢复了设备异常,收到此回调时用户需要检查设备是否可用
|
|
|
+ */
|
|
|
+ localDeviceException: (localDeviceType: AliRtcEngineLocalDeviceType, localDeviceExceptionType: AliRtcEngineLocalDeviceExceptionType, description: string) => void;
|
|
|
+ /**
|
|
|
+ * @brief 用户鉴权信息即将过期通知,收到后30秒鉴权过期
|
|
|
+ * @note 该回调在鉴权信息30秒前触发,收到该回调后应该及时更新鉴权信息,参考 {@link AliRtcEngine.refreshAuthInfo}
|
|
|
+ */
|
|
|
+ /**
|
|
|
+ * 被服务器踢出/会议结束频道的消息
|
|
|
+ * @param code 原因参考{@link AliRtcEngine.AliRtcOnByeType}
|
|
|
+ */
|
|
|
+ bye: (code: AliRtcOnByeType) => void;
|
|
|
+ /**
|
|
|
+ * @brief 远端用户(通信模式)/(互动模式,主播角色)加入频道回调
|
|
|
+ * @details 该回调在以下场景会被触发
|
|
|
+ * - 通信模式:远端用户加入频道会触发该回调,如果当前用户在加入频道前已有其他用户在频道中,当前用户加入频道后也会收到已加入频道用户的回调
|
|
|
+ * - 互动模式:
|
|
|
+ * - 远端主播角色用户加入频道会触发该回调,如果当前用户在加入频道前已有其他主播在频道中,当前用户加入频道后也会收到已加入频道主播的回调
|
|
|
+ * - 远端观众角色调用 {@link AliRtcEngine.setClientRole} 切换为主播角色 {@link AliRtcEngine.AliRtcSdkClientRole.AliRtcSdkInteractive},同时设置了推流时,会触发该回调
|
|
|
+ *
|
|
|
+ * @param uid 用户ID,从App server分配的唯一标示符
|
|
|
+ * @param elapsed 用户加入频道时的耗时
|
|
|
+ * @note 互动模式下回调行为
|
|
|
+ * - 主播间可以互相收到加入频道回调
|
|
|
+ * - 观众可以收到主播加入频道回调
|
|
|
+ * - 主播无法收到观众加入频道回调
|
|
|
+ */
|
|
|
+ remoteUserOnLineNotify: (uid: string, elapsed: number) => void;
|
|
|
+ /**
|
|
|
+ * @brief 远端用户(通信模式)/(互动模式,主播角色)离开频道回调
|
|
|
+ * @details 该回调在以下场景会被触发
|
|
|
+ * - 通信模式:远端用户离开频道会触发该回调
|
|
|
+ * - 互动模式:
|
|
|
+ * - 远端主播角色 {@link AliRtcEngine.AliRtcSdkClientRole.AliRtcSdkInteractive} 离开频道
|
|
|
+ * - 远端主播切换调用 {@link AliRtcEngine.setClientRole} 切换为观众角色 {@link AliRtcEngine.AliRtcSdkClientRole.AliRtcSdkLive},会触发该回调
|
|
|
+ * - 通信模式和互动模式主播角色情况下,当长时间收不到远端用户数据,超时掉线时,会触发该回调
|
|
|
+ *
|
|
|
+ * @param uid 用户ID,从App server分配的唯一标示符
|
|
|
+ * @param reason 用户离线的原因,详见 {@link AliRtcEngine.AliRtcUserOfflineReason}
|
|
|
+ */
|
|
|
+ remoteUserOffLineNotify: (uid: string, aliRtcUserOfflineReason: AliRtcUserOfflineReason) => void;
|
|
|
+ /**
|
|
|
+ * @brief 远端用户的音视频流发生变化回调
|
|
|
+ * @details 该回调在以下场景会被触发
|
|
|
+ * - 当远端用户从未推流变更为推流(包括音频和视频)
|
|
|
+ * - 当远端用户从已推流变更为未推流(包括音频和视频)
|
|
|
+ * - 互动模式下,调用 {@link AliRtcEngine.setClientRole} 切换为主播角色 {@link AliRtcEngine.AliRtcSdkClientRole.AliRtcSdkInteractive},同时设置了推流时,会触发该回调
|
|
|
+ *
|
|
|
+ * @param uid 用户ID,从App server分配的唯一标示符
|
|
|
+ * @param audioTrack 音频流类型,详见 {@link AliRtcEngine.AliRtcAudioTrack}
|
|
|
+ * @param videoTrack 视频流类型,详见 {@link AliRtcEngine.AliRtcVideoTrack}
|
|
|
+ * @note 该回调仅在通信模式用户和互动模式下的主播角色才会触发
|
|
|
+ */
|
|
|
+ remoteTrackAvailableNotify: (uid: string, aliRtcAudioTrack: AliRtcAudioTrack, aliRtcVideoTrack: AliRtcVideoTrack) => void;
|
|
|
+ /**
|
|
|
+ * @brief 远端用户静音/取消静音回调
|
|
|
+ * @param uid 远端用户ID
|
|
|
+ * @param isMute 该用户是否静音
|
|
|
+ * - true: 静音
|
|
|
+ * - false: 取消静音
|
|
|
+ */
|
|
|
+ userAudioMuted: (uid: string, isMute: boolean) => void;
|
|
|
+ /**
|
|
|
+ * @brief 对端用户发送视频黑帧数据发送通知
|
|
|
+ * @param uid 执行muteVideo的用户ID
|
|
|
+ * @param isMute
|
|
|
+ * - true: 推流黑帧
|
|
|
+ * - false: 正常推流
|
|
|
+ * @note 该接口用于对端用户发送视频黑帧数据时的回调
|
|
|
+ */
|
|
|
+ userVideoMuted: (uid: string, isMute: boolean) => void;
|
|
|
+ /**
|
|
|
+ * @brief 对端用户发送屏幕黑帧数据发送通知
|
|
|
+ * @param uid 执行muteVideo的用户ID
|
|
|
+ * @param isMute
|
|
|
+ * - true: 推流黑帧
|
|
|
+ * - false: 正常推流
|
|
|
+ * @note 该接口用于对端用户发送屏幕黑帧数据时的回调
|
|
|
+ */
|
|
|
+ userScreenMuted: (uid: string, isMute: boolean) => void;
|
|
|
+ /**
|
|
|
+ * 音量反馈
|
|
|
+ * @param {Array} speakers 用户音量对象数组
|
|
|
+ * @param {string} speaker.userId 用户ID
|
|
|
+ * @param {number} speaker.volume 音量
|
|
|
+ * @note userId 为空字符串时代表是本地麦克风采集的音量
|
|
|
+ */
|
|
|
+ audioVolume: (speakers: {
|
|
|
+ userId: string;
|
|
|
+ volume: number;
|
|
|
+ }[]) => void;
|
|
|
+ /**
|
|
|
+ * 发布视频流的数据统计
|
|
|
+ * @param aliRtcStats 统计信息
|
|
|
+ */
|
|
|
+ aliRtcStats: (aliRtcStats: any) => void;
|
|
|
+ /**
|
|
|
+ * 音频推流变更回调
|
|
|
+ * @param track 流标识
|
|
|
+ * @param oldState 之前的推流状态
|
|
|
+ * @param newState 当前的推流状态
|
|
|
+ * @param elapseSinceLastState 状态变更时间间隔(毫秒)
|
|
|
+ * @param channel 当前频道
|
|
|
+ */
|
|
|
+ audioPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number, channel: string) => void;
|
|
|
+ /**
|
|
|
+ * 音频订阅情况变更回调
|
|
|
+ * @param uid 用户ID
|
|
|
+ * @param oldState 之前的订阅状态
|
|
|
+ * @param newState 当前的订阅状态
|
|
|
+ * @param elapseSinceLastState 状态变更时间间隔(毫秒)
|
|
|
+ * @param channel 当前频道
|
|
|
+ */
|
|
|
+ audioSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
|
|
|
+ /**
|
|
|
+ * 视频推流变更回调
|
|
|
+ * @param oldState 之前的推流状态
|
|
|
+ * @param newState 当前的推流状态
|
|
|
+ * @param elapseSinceLastState 状态变更时间间隔(毫秒)
|
|
|
+ * @param channel 当前频道
|
|
|
+ */
|
|
|
+ videoPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number, channel: string) => void;
|
|
|
+ /**
|
|
|
+ * 次要流推流变更回调
|
|
|
+ * @param oldState 之前的推流状态
|
|
|
+ * @param newState 当前的推流状态
|
|
|
+ * @param elapseSinceLastState 状态变更时间间隔(毫秒)
|
|
|
+ * @param channel 当前频道
|
|
|
+ */
|
|
|
+ dualStreamPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number, channel: string) => void;
|
|
|
+ /**
|
|
|
+ * 屏幕分享推流变更回调
|
|
|
+ * @param oldState 之前的推流状态
|
|
|
+ * @param newState 当前的推流状态
|
|
|
+ * @param elapseSinceLastState 状态变更时间间隔(毫秒)
|
|
|
+ * @param channel 当前频道
|
|
|
+ */
|
|
|
+ screenSharePublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number, channel: string) => void;
|
|
|
+ /**
|
|
|
+ * DataChannel 推流变更回调
|
|
|
+ * @param oldState 之前的推流状态
|
|
|
+ * @param newState 当前的推流状态
|
|
|
+ * @param elapseSinceLastState 状态变更时间间隔(毫秒)
|
|
|
+ * @param channel 当前频道
|
|
|
+ */
|
|
|
+ dataPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number, channel: string) => void;
|
|
|
+ /**
|
|
|
+ * 相机流订阅情况变更回调
|
|
|
+ * @param uid 用户ID
|
|
|
+ * @param oldState 之前的订阅状态
|
|
|
+ * @param newState 当前的订阅状态
|
|
|
+ * @param elapseSinceLastState 状态变更时间间隔(毫秒)
|
|
|
+ * @param channel 当前频道
|
|
|
+ */
|
|
|
+ videoSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
|
|
|
+ /**
|
|
|
+ * 大小流订阅情况变更回调
|
|
|
+ * @param uid 用户ID
|
|
|
+ * @param oldStreamType 之前的订阅状态
|
|
|
+ * @param newStreamType 当前的订阅状态
|
|
|
+ * @param elapseSinceLastState 状态变更时间间隔(毫秒)
|
|
|
+ * @param channel 当前频道
|
|
|
+ */
|
|
|
+ subscribeStreamTypeChanged: (uid: string, oldStreamType: AliRtcVideoStreamType, newStreamType: AliRtcVideoStreamType, elapseSinceLastState: number, channel: string) => void;
|
|
|
+ /**
|
|
|
+ * 屏幕分享流订阅情况变更回调
|
|
|
+ * @param uid 用户ID
|
|
|
+ * @param oldState 之前的订阅状态
|
|
|
+ * @param newState 当前的订阅状态
|
|
|
+ * @param elapseSinceLastState 状态变更时间间隔(毫秒)
|
|
|
+ * @param channel 当前频道
|
|
|
+ */
|
|
|
+ screenShareSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
|
|
|
+ /**
|
|
|
+ * DataChannel 订阅情况变更回调
|
|
|
+ * @param uid 用户ID
|
|
|
+ * @param oldState 之前的订阅状态
|
|
|
+ * @param newState 当前的订阅状态
|
|
|
+ * @param elapseSinceLastState 状态变更时间间隔(毫秒)
|
|
|
+ * @param channel 当前频道
|
|
|
+ */
|
|
|
+ dataSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
|
|
|
+ /**
|
|
|
+ * 收到媒体扩展信息回调
|
|
|
+ * @param uid 用户ID,媒体信息发送用户的ID
|
|
|
+ * @param message 媒体扩展信息
|
|
|
+ * @param payloadType payload类型,sendMediaExtensionMsg返回5,sendMediaExtensionMsgEx发送的会返回具体类型
|
|
|
+ * @note 当一端通过 {@link AliRtcEngine.sendMediaExtensionMsg} 发送信息后,其他端通过该回调接收数据
|
|
|
+ */
|
|
|
+ mediaExtensionMsgReceived: (uid: string, message: ArrayBuffer, payloadType: number) => void;
|
|
|
+ /**
|
|
|
+ * @brief 用户鉴权信息即将过期通知,收到后30秒鉴权过期
|
|
|
+ * @note 该回调在鉴权信息30秒前触发,收到该回调后应该及时更新鉴权信息,参考 {@link AliRtcEngine.refreshAuthInfo:}
|
|
|
+ */
|
|
|
+ authInfoWillExpire: () => void;
|
|
|
+ /**
|
|
|
+ * @brief 用户调用需要鉴权的接口,服务端返回信息过期
|
|
|
+ * @note 该回调触发代表鉴权信息已过期,想要继续在会中,需要重新入会,参考 {@link AliRtcEngine.joinChannel:name:onResultWithUserId:}
|
|
|
+ */
|
|
|
+ authInfoExpired: () => {};
|
|
|
+ /**
|
|
|
+ * 远程用户的音频自动播放失败
|
|
|
+ * @param uid
|
|
|
+ * @note 应该在收到该回调时弹出弹窗引导用户点击页面进行播放,用户点击页面后 SDK 会自动尝试播放
|
|
|
+ */
|
|
|
+ remoteAudioAutoPlayFail: (uid: string) => void;
|
|
|
+ /**
|
|
|
+ * 远程用户的视频自动播放失败
|
|
|
+ * @param uid
|
|
|
+ * @note 应该在收到该回调时弹出弹窗引导用户点击页面进行播放,用户点击页面后 SDK 会自动尝试播放
|
|
|
+ */
|
|
|
+ remoteVideoAutoPlayFail: (uid: string, videoTrack: AliRtcVideoTrack) => void;
|
|
|
+ /**
|
|
|
+ * 远程用户的音频播放出错
|
|
|
+ * @param uid 用户ID
|
|
|
+ * @param reason 出错原因,可选
|
|
|
+ */
|
|
|
+ remoteAudioPlayError: (uid: string, reason: string | undefined) => void;
|
|
|
+ /**
|
|
|
+ * 远程用户的视频播放出错
|
|
|
+ * @param uid 用户ID
|
|
|
+ * @param reason 出错原因,可选
|
|
|
+ */
|
|
|
+ remoteVideoPlayError: (uid: string, reason: string | undefined) => void;
|
|
|
+ /**
|
|
|
+ * rtc 传输数据统计
|
|
|
+ * @param stats 统计信息
|
|
|
+ */
|
|
|
+ rtcStats: (stats: any) => void;
|
|
|
+ /**
|
|
|
+ * 发布视频流的数据统计
|
|
|
+ * @param aliRtcStats 统计信息
|
|
|
+ */
|
|
|
+ rtcLocalVideoStats: (stats: AliRtcLocalVideoStats[]) => void;
|
|
|
+ /**
|
|
|
+ * 发布音频流的数据统计
|
|
|
+ * @param aliRtcStats 统计信息
|
|
|
+ */
|
|
|
+ rtcLocalAudioStats: (stats: AliRtcLocalAudioStats[]) => void;
|
|
|
+ /**
|
|
|
+ * 订阅视频流的数据统计
|
|
|
+ * @param aliRtcStats 统计信息
|
|
|
+ */
|
|
|
+ rtcRemoteVideoStats: (stats: AliRtcRemoteVideoStats[]) => void;
|
|
|
+ /**
|
|
|
+ * 订阅远端音频流的数据统计
|
|
|
+ * @param aliRtcStats 统计信息
|
|
|
+ */
|
|
|
+ rtcRemoteAudioStats: (stats: AliRtcRemoteAudioStats[]) => void;
|
|
|
+ /**
|
|
|
+ * @brief 错误通知
|
|
|
+ * @deprecated 请使用 occurError
|
|
|
+ * @details 如果engine出现error,通过这个回调通知app
|
|
|
+ * @param error 错误类型,参考 {@link AliRtcError}
|
|
|
+ * @param uid 用户 Id,不一定存在
|
|
|
+ */
|
|
|
+ onOccurError: (error: AliRtcError, uid?: string) => void;
|
|
|
+ /**
|
|
|
+ * @brief 错误通知
|
|
|
+ * @details 如果engine出现error,通过这个回调通知app
|
|
|
+ * @param error 错误类型,参考 {@link AliRtcError}
|
|
|
+ * @param uid 用户 Id,不一定存在
|
|
|
+ */
|
|
|
+ occurError: (error: AliRtcError, uid?: string) => void;
|
|
|
+ /**
|
|
|
+ * @brief 收到数据通道消息
|
|
|
+ * @param uid 用户ID
|
|
|
+ * @param message 消息
|
|
|
+ */
|
|
|
+ dataChannelMsg: (uid: string, message: AliRtcDataChannelMsg) => void;
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcEngineLocalDeviceExceptionType {
|
|
|
+ /** 未知异常类型 */
|
|
|
+ AliEngineLocalDeviceExceptionTypeUnknown = 0,
|
|
|
+ /** 麦克风打开失败 */
|
|
|
+ AliEngineLocalDeviceExceptionTypeMicOpenFail = 1,
|
|
|
+ /** 麦克风被打断 */
|
|
|
+ AliEngineLocalDeviceExceptionTypeMicInterrupt = 2,
|
|
|
+ /** 麦克风无权限 */
|
|
|
+ AliEngineLocalDeviceExceptionTypeMicAuthFail = 3,
|
|
|
+ /** 无可用麦克风 */
|
|
|
+ AliEngineLocalDeviceExceptionTypeMicNotAvailable = 4,
|
|
|
+ /** 扬声器打开失败 */
|
|
|
+ AliEngineLocalDeviceExceptionTypeSpeakerOpenFail = 5,
|
|
|
+ /** 扬声器被打断 */
|
|
|
+ AliEngineLocalDeviceExceptionTypeSpeakerInterrupt = 6,
|
|
|
+ /** 无可用扬声器 */
|
|
|
+ AliEngineLocalDeviceExceptionTypeSpeakerNotAvailable = 7,
|
|
|
+ /** 音频设备异常 */
|
|
|
+ AliEngineLocalDeviceExceptionTypeAudioDeviceException = 8,
|
|
|
+ /** 摄像头打开失败 */
|
|
|
+ AliEngineLocalDeviceExceptionTypeCameraOpenFail = 9,
|
|
|
+ /** 摄像头被打断 */
|
|
|
+ AliEngineLocalDeviceExceptionTypeCameraInterrupt = 10,
|
|
|
+ /** 摄像头无权限 */
|
|
|
+ AliEngineLocalDeviceExceptionTypeCameraAuthFail = 11,
|
|
|
+ /** 显示设备异常 */
|
|
|
+ AliEngineLocalDeviceExceptionTypeDisplayException = 12,
|
|
|
+ /** 视频设备异常 */
|
|
|
+ AliEngineLocalDeviceExceptionTypeVideoDeviceException = 13
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcEngineLocalDeviceType {
|
|
|
+ /** 未知设备类型 */
|
|
|
+ AliEngineLocalDeviceTypeUnknown = 0,
|
|
|
+ /** 麦克风设备 */
|
|
|
+ AliEngineLocalDeviceTypeMic = 1,
|
|
|
+ /** 扬声器设备 */
|
|
|
+ AliEngineLocalDeviceTypeSpeaker = 2,
|
|
|
+ /** 音频设备 */
|
|
|
+ AliEngineLocalDeviceTypeAudioDevice = 3,
|
|
|
+ /** 摄像头设备 */
|
|
|
+ AliEngineLocalDeviceTypeCamera = 4,
|
|
|
+ /** 显示设备 */
|
|
|
+ AliEngineLocalDeviceTypeDisplay = 5,
|
|
|
+ /** 视频设备 */
|
|
|
+ AliEngineLocalDeviceTypeVideoDevice = 6
|
|
|
+}
|
|
|
+
|
|
|
+declare enum AliRtcEnv {
|
|
|
+ pre = "pre",
|
|
|
+ prod = "prod"
|
|
|
+}
|
|
|
+
|
|
|
+declare class AliRtcError extends Error {
|
|
|
+ _code: number;
|
|
|
+ _extra?: any;
|
|
|
+ static fromRtsError(error: any): AliRtcError;
|
|
|
+ static fromError(error: any, code?: number, fallbackMessage?: string): AliRtcError;
|
|
|
+ constructor(code: number, message: string, extra?: any);
|
|
|
+ get code(): number;
|
|
|
+ set code(code: number);
|
|
|
+ get reason(): string;
|
|
|
+ get extra(): any;
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcErrorCode {
|
|
|
+ /****************************************************
|
|
|
+ * 入会错误码
|
|
|
+ ****************************************************/
|
|
|
+ /** 已经加入频道 */
|
|
|
+ ERR_JOIN_ALREADY_JOINED = 16843521,
|
|
|
+ /** AppId不存在,请在控制台创建应用 */
|
|
|
+ ERR_JOIN_BAD_APPID = 33620481,
|
|
|
+ /** AppId已失效,请在控制台重新启用应用 */
|
|
|
+ ERR_JOIN_INVALID_APPID = 33620482,
|
|
|
+ /**
|
|
|
+ * 频道不存在,请尝试重新加入频道
|
|
|
+ * 如会议发起者入会后又很快离会,第二个人随后入会,发现会议已经不存在了。
|
|
|
+ */
|
|
|
+ ERR_JOIN_BAD_CHANNEL = 33620484,
|
|
|
+ /** 频道已经失效(目前频道有效期为48小时),请重新生成频道鉴权令牌(Token) */
|
|
|
+ ERR_JOIN_INVALID_CHANNEL = 33620483,
|
|
|
+ /** Token无效。 请重新生成频道鉴权令牌(Token) */
|
|
|
+ ERR_JOIN_BAD_TOKEN = 33620485,
|
|
|
+ /** 加入频道超时,请检查网络连接是否正常 */
|
|
|
+ ERR_JOIN_TIMEOUT = 16908804,
|
|
|
+ /** 参数错误,{@link AliRtcAuthInfo}中的字段为空或者timestamp<=0,请检查字段是否完整 */
|
|
|
+ ERR_JOIN_ERR_JOIN_BAD_PARAMBAD = 16974081,
|
|
|
+ /** 加入频道失败 */
|
|
|
+ ERR_JOIN_CHANNEL_FAILED = 16974338,
|
|
|
+ /****************************************************
|
|
|
+ * 日志模块错误码
|
|
|
+ ****************************************************/
|
|
|
+ /** 日志模块已经初始化 */
|
|
|
+ ERR_LOG_ALREADY_INIT = 16974085,
|
|
|
+ /** 日志模块根路径错误,请检查路径是否存在或路径是否具有写入权限 */
|
|
|
+ ERR_LOG_ROOT_PATH_ERROR = 16974086,
|
|
|
+ /****************************************************
|
|
|
+ * 音频设备错误码
|
|
|
+ ****************************************************/
|
|
|
+ /**
|
|
|
+ * 采集设备初始化失败、采集设备媒体服务异常、音频设备被占用。
|
|
|
+ * - Mac端和Windows端查看系统设置中音频设备是否有能量条
|
|
|
+ * - iOS端和Android端确认是否被其他应用占用
|
|
|
+ * - 如果都正常,请重启设备
|
|
|
+ */
|
|
|
+ ERR_MIC_OPEN_FAIL = 17040388,
|
|
|
+ /**
|
|
|
+ * 播放设备初始化失败、播放设备媒体服务异常、音频设备被占用。
|
|
|
+ * - Mac端和Windows端查看系统设置中音频设备是否有能量条
|
|
|
+ * - iOS端和Android端确认是否被其他应用占用
|
|
|
+ * - 如果都正常,请重启设备
|
|
|
+ */
|
|
|
+ ERR_SPEAKER_OPEN_FAIL = 17040389,
|
|
|
+ /** 系统性能不足、采集设备媒体服务异常、音频设备被占用。建议重启应用或重启设备 */
|
|
|
+ ERR_MIC_INTERRUPT = 17040390,
|
|
|
+ /** 系统性能不足,播放设备媒体服务异常,音频设备被占用。建议重启应用或重启设备 */
|
|
|
+ ERR_SPEAKER_INTERRUPT = 17040391,
|
|
|
+ /** 麦克风设备未授权,建议去系统设置中,打开麦克风授权,并且重新加入频道 */
|
|
|
+ ERR_MIC_AUTH_FAIL = 17040392,
|
|
|
+ /** 无可用的音频采集设备,检查是否接入了可用的麦克风,并检查系统设置中,该设备是否被禁用 */
|
|
|
+ ERR_MIC_NOT_AVAILABLE = 17040393,
|
|
|
+ /** 无可用的音频播放设备,检查是否接入了可用的扬声器或耳机,并检查系统设置中,该设备是否被禁用 */
|
|
|
+ ERR_SPEAKER_NOT_AVAILABLE = 17040400,
|
|
|
+ /****************************************************
|
|
|
+ * 视频设备错误码
|
|
|
+ ****************************************************/
|
|
|
+ /** 采集设备初始化失败,检查系统相机是否可用,移动端App是否占用了相机 */
|
|
|
+ ERR_CAMERA_OPEN_FAIL = 17039620,
|
|
|
+ /** 采集设备未授权,建议去系统设置中,打开摄像头授权,并且重新加入频道 */
|
|
|
+ ERR_CAMERA_AUTH_FAIL = 17039621,
|
|
|
+ /** 采集过程中出现异常,Mac、Winodows电脑相机采集灯熄灭,设备被强制中断。建议重新加入频道或者重启App */
|
|
|
+ ERR_CAMERA_INTERRUPT = 17039622,
|
|
|
+ /** 无可用的视频采集设备,检查是否接入了可用的摄像头,并检查系统设置中,该设备是否被禁用 */
|
|
|
+ ERR_CAMERA_NOT_AVAILABLE = 17039623,
|
|
|
+ /** 渲染设备初始化失败,检查Windows端显卡驱动是否需要升级,移动端手机型号或者Android平板盒子等外设是否支持OpenGL */
|
|
|
+ ERR_VIDEO_DISPLAY_OPEN_FAIL = 17039873,
|
|
|
+ /** 渲染过程中出现异常,系统异常错误导致渲染引擎报错,重新加入频道或者重启App */
|
|
|
+ ERR_VIDEO_DISPLAY_INTERRUPT = 1064992,
|
|
|
+ /****************************************************
|
|
|
+ * 网络错误码
|
|
|
+ ****************************************************/
|
|
|
+ /** 媒体通道建立失败,检查网络连接是否正常 */
|
|
|
+ ERR_ICE_CONNECTION_CONNECT_FAIL = 17105409,
|
|
|
+ /** 媒体通道重连失败,检查网络连接是否正常 */
|
|
|
+ ERR_ICE_CONNECTION_RECONNECT_FAI = 17105410,
|
|
|
+ /** 媒体通道mobility失败,应用层需要重走入会流程 */
|
|
|
+ ERR_ICE_CONNECTION_MOBILITY_FAIL = 17105411,
|
|
|
+ /** 信令心跳超时,检查网络连接是否正常 */
|
|
|
+ ERR_ICE_CONNECTION_HEARTBEAT_TIMEOUT = 16908812,
|
|
|
+ /**
|
|
|
+ * 低延时互动直播模式相关错误码
|
|
|
+ */
|
|
|
+ /** 低延时互动直播信令失败 */
|
|
|
+ ERR_LATENCY_LIVE_COMMUNICATION_FAILED = 17235971,
|
|
|
+ /** 低延时互动直播媒体设置错误 */
|
|
|
+ ERR_LATENCY_LIVE_MEIDASETTING_FAILED = 17235972,
|
|
|
+ /** 低延时互动直播当前房间没有主播推流 */
|
|
|
+ ERR_LATENCY_LIVE_NONE_BROADCASTER = 17235973,
|
|
|
+ /** 低延时互动直播错误,应用层需要重新创建新的SDK实例 */
|
|
|
+ ERR_LATENCY_LIVE_NEED_RESTART = 17235974,
|
|
|
+ /** 低延时互动直播错误,应用层需要稍等一定时间(自定义间隔)重新创建新的SDK实例 */
|
|
|
+ ERR_LATENCY_LIVE_NEED_RESTART_AGAIN_LATER = 17235975,
|
|
|
+ /** 低延迟互动直播服务不可用或者服务降级,客户端应该选择其它方式拉超大方会流,即不从cdn sfu拉流 */
|
|
|
+ ERR_LATENCY_LIVE_SERVICE_UNAVAILABLE = 17235976,
|
|
|
+ /** 低延迟互动直播网络中断错误,销毁当前sdk实例重新创建sdk后重新走订阅流程 */
|
|
|
+ ERR_LATENCY_LIVE_MEDIACONNECTION_INTERRUPTION = 17235977,
|
|
|
+ /****************************************************
|
|
|
+ * 推流相关错误码
|
|
|
+ ****************************************************/
|
|
|
+ /** 推流无效 */
|
|
|
+ ERR_SDK_PUBLISH_INVAILD = 16974597,
|
|
|
+ /** 未进入频道推流失败 */
|
|
|
+ ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL = 16843782,
|
|
|
+ /** 推送音频流失败 */
|
|
|
+ ERR_SDK_PUBLISH_AUDIO_STREAM_FAILED = 16843856,
|
|
|
+ /** 推送视频流失败 */
|
|
|
+ ERR_SDK_PUBLISH_VIDEO_STREAM_FAILED = 16843857,
|
|
|
+ /** 推送小流失败 */
|
|
|
+ ERR_SDK_PUBLISH_DUAL_STREAM_FAILED = 16843858,
|
|
|
+ /** 推送屏幕共享失败 */
|
|
|
+ ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED = 16843859,
|
|
|
+ /** 屏幕共享配置错误 */
|
|
|
+ ERR_SDK_PUBLISH_SCREEN_SHARE_CONFIG_ERROR = 16843860,
|
|
|
+ /****************************************************
|
|
|
+ * 订阅相关错误码
|
|
|
+ ****************************************************/
|
|
|
+ /** 订阅无效 */
|
|
|
+ ERR_SDK_SUBSCRIBE_INVAILD = 16974852,
|
|
|
+ /** 未进入频道订阅错误 */
|
|
|
+ ERR_SDK_SUBSCRIBE_NOT_JOIN_CHANNEL = 16844112,
|
|
|
+ /** 订阅音频流失败 */
|
|
|
+ ERR_SDK_SUBSCRIBE_AUDIO_STREAM_FAILED = 16844113,
|
|
|
+ /** 订阅视频流失败 */
|
|
|
+ ERR_SDK_SUBSCRIBE_VIDEO_STREAM_FAILED = 16844114,
|
|
|
+ /** 订阅小流失败 */
|
|
|
+ ERR_SDK_SUBSCRIBE_DUAL_STREAM_FAILED = 16844115,
|
|
|
+ /** 订阅屏幕共享失败 */
|
|
|
+ ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED = 16844116,
|
|
|
+ /** 订阅 DataChannel 失败 */
|
|
|
+ ERR_SDK_SUBSCRIBE_DATA_FAILED = 16844117,
|
|
|
+ /** 订阅 DataChannel 过程中报错 */
|
|
|
+ ERR_SDK_SUBSCRIBE_DATA_ERROR = 16844118,
|
|
|
+ /****************************************************
|
|
|
+ * 其他错误码
|
|
|
+ ****************************************************/
|
|
|
+ /** SDK状态错误,建议销毁SDK重新创建实例。 */
|
|
|
+ ERR_SDK_INVALID_STATE = 16974340,
|
|
|
+ /** 参数不匹配 */
|
|
|
+ ERR_INVALID_ARGUMENTS = 16974083,
|
|
|
+ /** Session已经被移除,建议销毁实例之后重新创建实例并加入频道。 */
|
|
|
+ ERR_SESSION_REMOVED = 33620229,
|
|
|
+ /** 互动模式下设置角色错误 */
|
|
|
+ ERR_SDK_UPDATE_ROLE_CHANNEL = 16908801,
|
|
|
+ /** SDK内部错误 */
|
|
|
+ ERR_INNER = -1,
|
|
|
+ /************************************************************************************/
|
|
|
+ /******************************** 旁路直播错误码 start ********************************/
|
|
|
+ /************************************************************************************/
|
|
|
+ /**
|
|
|
+ * MPU任务发布成功
|
|
|
+ */
|
|
|
+ ERR_SDK_MPU_TASK_PUBLISH_OK = 0,
|
|
|
+ /**
|
|
|
+ * MPU任务流未找到
|
|
|
+ */
|
|
|
+ ERR_SDK_MPU_TASK_STREAM_NOT_FOUND = 17825793,
|
|
|
+ /**
|
|
|
+ * MPU任务流已存在
|
|
|
+ */
|
|
|
+ ERR_SDK_MPU_TASK_STREAM_ALREADY_EXIST = 17825794,
|
|
|
+ /**
|
|
|
+ * MPU任务无效参数
|
|
|
+ */
|
|
|
+ ERR_SDK_MPU_TASK_INVALID_PARAM = 17825795,
|
|
|
+ /**
|
|
|
+ * MPU任务内部错误
|
|
|
+ */
|
|
|
+ ERR_SDK_MPU_TASK_INTERNAL_ERROR = 17825796,
|
|
|
+ /**
|
|
|
+ * MPU任务rtmp服务错误
|
|
|
+ */
|
|
|
+ ERR_SDK_MPU_TASK_RTMP_SERVER_ERROR = 17825797,
|
|
|
+ /**
|
|
|
+ * MPU任务rtmp流地址错误
|
|
|
+ */
|
|
|
+ ERR_SDK_MPU_TASK_RTMP_STREAM_URL_ERROR = 17825798,
|
|
|
+ /**
|
|
|
+ * MPU任务发布超时
|
|
|
+ */
|
|
|
+ ERR_SDK_MPU_TASK_PUBLISH_TIMEOUT = 17825799,
|
|
|
+ /**
|
|
|
+ * MPU任务发布成功
|
|
|
+ */
|
|
|
+ ERR_SDK_MPU_TASK_NOT_AUTHORIZED = 17825800,
|
|
|
+ /************************************************************************************/
|
|
|
+ /******************************** 旁路直播错误码 end ********************************/
|
|
|
+ /************************************************************************************/
|
|
|
+ /************************************************************************************/
|
|
|
+ /******************************** 跨频道转推错误码 start ******************************/
|
|
|
+ /************************************************************************************/
|
|
|
+ /**
|
|
|
+ * 检测到本地状态不对,没入会,角色错误,频道模式错误
|
|
|
+ */
|
|
|
+ ERR_SDK_CHANNEL_RELAY_STATE_ERROR = 18874369,
|
|
|
+ /**
|
|
|
+ * 服务端返回436,源通道模式不匹配
|
|
|
+ */
|
|
|
+ ERR_SDK_CHANNEL_RELAY_SRC_NOT_ALLOW = 18874370,
|
|
|
+ /**
|
|
|
+ * 服务端返回437,目标通道不存在或者模式不匹配
|
|
|
+ */
|
|
|
+ ERR_SDK_CHANNEL_RELAY_JOIN_DEST_FAILED = 18874371,
|
|
|
+ /**
|
|
|
+ * 服务端返回438,token无效
|
|
|
+ */
|
|
|
+ ERR_SDK_CHANNEL_RELAY_TOKEN_INVALID = 18874372,
|
|
|
+ /**
|
|
|
+ * 服务端返651,session不是主播
|
|
|
+ */
|
|
|
+ ERR_SDK_CHANNEL_RELAY_ROLE_ERROR = 18874373,
|
|
|
+ /**
|
|
|
+ * 服务端400,参数错误
|
|
|
+ */
|
|
|
+ ERR_SDK_CHANNEL_RELAY_INVALID_PARAM = 18874374,
|
|
|
+ /**
|
|
|
+ * 服务端返回440,不能转推到本频道
|
|
|
+ */
|
|
|
+ ERR_SDK_CHANNEL_RELAY_TO_SELF_ERROR = 18874375
|
|
|
+}
|
|
|
+
|
|
|
+declare class AliRtcLiveTranscoding {
|
|
|
+ authInfo?: AliRtcAuthInfo;
|
|
|
+ private slsReporter;
|
|
|
+ constructor(slsReporter: SLSReporter);
|
|
|
+ private doRequest;
|
|
|
+ setAuthInfo(authInfo: AliRtcAuthInfo): void;
|
|
|
+ clear(): void;
|
|
|
+ startPublishLiveStream(streamUrl: string, transcodingParam: AliRtcLiveTranscodingParam): Promise<any>;
|
|
|
+ startPublishLiveStreamWithTaskId(taskId: string, transcodingParam: AliRtcLiveTranscodingParam): Promise<any>;
|
|
|
+ updatePublishLiveStream(streamUrl: string, transcodingParam: AliRtcLiveTranscodingParam): Promise<any>;
|
|
|
+ updatePublishLiveStreamWithTaskId(taskId: string, transcodingParam: AliRtcLiveTranscodingParam): Promise<any>;
|
|
|
+ stopPublishLiveStream(streamUrl: string): Promise<any>;
|
|
|
+ stopPublishLiveStreamWithTaskId(taskId: string): Promise<any>;
|
|
|
+ refreshAuthInfo(authInfo: AliRtcRefreshAuthInfo): void;
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcLiveTranscodingAudioSampleRate {
|
|
|
+ LiveTranscoding_HZ_48000 = 48000,
|
|
|
+ LiveTranscoding_HZ_44100 = 44100,
|
|
|
+ LiveTranscoding_HZ_32000 = 32000,
|
|
|
+ LiveTranscoding_HZ_16000 = 16000,
|
|
|
+ LiveTranscoding_HZ_8000 = 8000
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcLiveTranscodingCropMode {
|
|
|
+ /*! 缩放模式 */
|
|
|
+ LiveTranscodingOrigin = 0,
|
|
|
+ /*! 剪裁 */
|
|
|
+ LiveTranscodingCrop = 1,
|
|
|
+ /*! 填充 */
|
|
|
+ LiveTranscodingFill = 2
|
|
|
+}
|
|
|
+
|
|
|
+export declare class AliRtcLiveTranscodingEncodeParam {
|
|
|
+ videoWidth: number;
|
|
|
+ videoHeight: number;
|
|
|
+ videoFramerate: number;
|
|
|
+ videoBitrate: number;
|
|
|
+ videoGop: number;
|
|
|
+ audioSamplerate: AliRtcLiveTranscodingAudioSampleRate;
|
|
|
+ audioBitrate: number;
|
|
|
+ audioChannels: number;
|
|
|
+ constructor(videoWidth: number, videoHeight: number, videoFramerate?: number, videoBitrate?: number, videoGop?: number, audioSamplerate?: AliRtcLiveTranscodingAudioSampleRate, audioBitrate?: number, audioChannels?: number);
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcLiveTranscodingErrorCode {
|
|
|
+ LiveTranscodingErrorPublishOk = 0,
|
|
|
+ LiveTranscodingErrorStreamNotFound = 17825793,
|
|
|
+ LiveTranscodingErrorStreamAlreadyExist = 17825794,
|
|
|
+ LiveTranscodingErrorInvalidParam = 17825795,
|
|
|
+ LiveTranscodingErrorInternalError = 17825796,
|
|
|
+ LiveTranscodingErrorRtmpServerError = 17825797,
|
|
|
+ LiveTranscodingErrorRtmpStreamUrlError = 17825798,
|
|
|
+ LiveTranscodingErrorPublishTimeout = 17825799,
|
|
|
+ LiveTranscodingErrorNotAuthorized = 17825800
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcLiveTranscodingFontType {
|
|
|
+ NOTO_SERIF_CJKSC_REGULAR = 0,
|
|
|
+ ALIBABA_PUHUITI_REGULAR = 1,
|
|
|
+ ALIBABA_PUHUITI_BOLD = 2,
|
|
|
+ ALIBABA_PUHUITI_Heavy = 3,
|
|
|
+ ALIBABA_PUHUITI_LIGHT = 4,
|
|
|
+ ALIBABA_PUHUITI_MEDIUM = 5
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcLiveTranscodingMediaProcessMode {
|
|
|
+ /*! 通用模式 */
|
|
|
+ LiveTranscodingNormal = 0,
|
|
|
+ /*! 虚拟背景模式 */
|
|
|
+ LiveTranscodingVirtualBackground = 1
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcLiveTranscodingMixMode {
|
|
|
+ /*! 单路模式 */
|
|
|
+ LiveTranscodingSingle = 0,
|
|
|
+ /*! 混流模式 */
|
|
|
+ LiveTranscodingMix = 1
|
|
|
+}
|
|
|
+
|
|
|
+export declare class AliRtcLiveTranscodingMixParam {
|
|
|
+ taskProfile: AliRtcLiveTranscodingTaskProfile;
|
|
|
+ encodeParam?: AliRtcLiveTranscodingEncodeParam;
|
|
|
+ users: AliRtcTranscodingUser[];
|
|
|
+ backgroundColor: number;
|
|
|
+ backgrounds: AliRtcTranscodingImage[];
|
|
|
+ watermarks: AliRtcTranscodingImage[];
|
|
|
+ clockWidgets: AliRtcTranscodingClockWidget[];
|
|
|
+ cropMode?: AliRtcLiveTranscodingCropMode;
|
|
|
+ mediaProcessMode?: AliRtcLiveTranscodingMediaProcessMode;
|
|
|
+ constructor(taskProfile: AliRtcLiveTranscodingTaskProfile);
|
|
|
+}
|
|
|
+
|
|
|
+export declare class AliRtcLiveTranscodingParam {
|
|
|
+ /*! 旁路模式 */
|
|
|
+ mixMode: AliRtcLiveTranscodingMixMode;
|
|
|
+ /*! 路模式单路参数 */
|
|
|
+ singleParam?: AliRtcLiveTranscodingSingleParam;
|
|
|
+ /*! 旁路模式混流参数 */
|
|
|
+ mixParam?: AliRtcLiveTranscodingMixParam;
|
|
|
+ constructor(mixMode?: AliRtcLiveTranscodingMixMode, singleParam?: AliRtcLiveTranscodingSingleParam, mixParam?: AliRtcLiveTranscodingMixParam);
|
|
|
+ toJson(type: MPU_TASK_TRANSACTION_TYPE, authInfo: AliRtcAuthInfo, taskId: string, streamUrl?: string, messageId?: string): {
|
|
|
+ [key: string]: any;
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcLiveTranscodingSegmentType {
|
|
|
+ /*! 无人像分割 */
|
|
|
+ LiveTranscodingNoBody = 0,
|
|
|
+ /*! 人像分割 */
|
|
|
+ LiveTranscodingBody = 1
|
|
|
+}
|
|
|
+
|
|
|
+export declare class AliRtcLiveTranscodingSingleParam {
|
|
|
+ userId?: string;
|
|
|
+ streamType?: AliRtcLiveTranscodingStreamType;
|
|
|
+ sourceType?: AliRtcLiveTranscodingSourceType;
|
|
|
+ constructor(uid?: string, streamType?: AliRtcLiveTranscodingStreamType, sourceType?: AliRtcLiveTranscodingSourceType);
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcLiveTranscodingSourceType {
|
|
|
+ /*! 相机流 */
|
|
|
+ LiveTranscodingCamera = 0,
|
|
|
+ /*! 屏幕流 */
|
|
|
+ LiveTranscodingShareScreen = 1
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcLiveTranscodingState {
|
|
|
+ LiveTranscodingState_IDLE = 0,
|
|
|
+ LiveTranscodingState_CONNNECT = 1,
|
|
|
+ LiveTranscodingState_RUNNING = 2,
|
|
|
+ LiveTranscodingState_RECOVERING = 3,
|
|
|
+ LiveTranscodingState_FAILURE = 4,
|
|
|
+ LiveTranscodingState_END = 5
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcLiveTranscodingStreamType {
|
|
|
+ /*! 原始流 */
|
|
|
+ LiveTranscodingOrigin = 0,
|
|
|
+ /*! 音频 */
|
|
|
+ LiveTranscodingAudio = 1,
|
|
|
+ /*! 视频 */
|
|
|
+ LiveTranscodingVideo = 2
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcLiveTranscodingTaskProfile {
|
|
|
+ LiveTranscoding_Profile_1IN_1080P = 0,
|
|
|
+ LiveTranscoding_Profile_1IN_720P = 1,
|
|
|
+ LiveTranscoding_Profile_1IN_360P = 2,
|
|
|
+ LiveTranscoding_Profile_2IN_1080P = 3,
|
|
|
+ LiveTranscoding_Profile_2IN_720P = 4,
|
|
|
+ LiveTranscoding_Profile_2IN_360P = 5,
|
|
|
+ LiveTranscoding_Profile_4IN_1080P = 6,
|
|
|
+ LiveTranscoding_Profile_4IN_720P = 7,
|
|
|
+ LiveTranscoding_Profile_4IN_360P = 8,
|
|
|
+ LiveTranscoding_Profile_9IN_1080P = 9,
|
|
|
+ LiveTranscoding_Profile_9IN_720P = 10,
|
|
|
+ LiveTranscoding_Profile_9IN_360P = 11,
|
|
|
+ LiveTranscoding_Profile_12IN_1080P = 12,
|
|
|
+ LiveTranscoding_Profile_12IN_720P = 13,
|
|
|
+ LiveTranscoding_Profile_12IN_360P = 14,
|
|
|
+ LiveTranscoding_Profile_16IN_1080P = 15,
|
|
|
+ LiveTranscoding_Profile_16IN_720P = 16,
|
|
|
+ LiveTranscoding_Profile_16IN_360P = 17,
|
|
|
+ LiveTranscoding_Profile_Mixed = 9999
|
|
|
+}
|
|
|
+
|
|
|
+declare interface AliRtcLocalAudioStats {
|
|
|
+ track: AliRtcAudioTrack;
|
|
|
+ stats: any;
|
|
|
+}
|
|
|
+
|
|
|
+export declare class AliRtcLocalStreamInfo extends default_2<AliRtcLocalStreamListener> {
|
|
|
+ type: AliRtcRawDataStreamType;
|
|
|
+ originVideoTrack?: MediaStreamTrack;
|
|
|
+ videoSource?: VideoStreamSource;
|
|
|
+ private _videoMuted;
|
|
|
+ originAudioTrack?: MediaStreamTrack;
|
|
|
+ audioSource?: AudioStreamSource;
|
|
|
+ private _audioMuted;
|
|
|
+ private _targetVideoTrack?;
|
|
|
+ private _targetDualVideoTrack?;
|
|
|
+ private _targetAudioTrack?;
|
|
|
+ private _publishVideoStream?;
|
|
|
+ private _publishDualVideoStream?;
|
|
|
+ private _publishAudioStream?;
|
|
|
+ private _previewStream?;
|
|
|
+ plugins: AliRtcPlugin[];
|
|
|
+ private _profileManager?;
|
|
|
+ cameraVideoConstraints?: IVideoConstraints;
|
|
|
+ micAudioConstraints?: IAudioConstraints;
|
|
|
+ private get profileManager();
|
|
|
+ get audioProfile(): AudioProfileKey | undefined;
|
|
|
+ constructor(type: AliRtcRawDataStreamType);
|
|
|
+ private onVideoTrackEnded;
|
|
|
+ private onAudioTrackEnded;
|
|
|
+ updateSource(newStream: LocalStream, newVideoSource?: VideoStreamSource, newAudioSource?: AudioStreamSource): Promise<void>;
|
|
|
+ get currentProfile(): string | undefined;
|
|
|
+ get currentVideoTrack(): MediaStreamTrack | undefined;
|
|
|
+ get currentDualVideoTrack(): MediaStreamTrack | undefined;
|
|
|
+ get publishVideoStream(): LocalStream | undefined;
|
|
|
+ get publishDualVideoStream(): LocalStream | undefined;
|
|
|
+ get currentAudioTrack(): MediaStreamTrack | undefined;
|
|
|
+ get publishAudioStream(): LocalStream | undefined;
|
|
|
+ get previewStream(): LocalStream | undefined;
|
|
|
+ /**
|
|
|
+ * 更新 VideoTrack
|
|
|
+ * @param videoTrack
|
|
|
+ */
|
|
|
+ updateVideoTrack(videoTrack?: MediaStreamTrack, force?: boolean): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 更新 DualVideoTrack
|
|
|
+ * @param videoTrack
|
|
|
+ * @param force
|
|
|
+ */
|
|
|
+ updateDualVideoTrack(videoTrack?: MediaStreamTrack, force?: boolean): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 更新 AudioTrack
|
|
|
+ * @param audioTrack
|
|
|
+ */
|
|
|
+ updateAudioTrack(audioTrack?: MediaStreamTrack, force?: boolean): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 设置音频流静音
|
|
|
+ * @param muted
|
|
|
+ */
|
|
|
+ setAudioMuted(muted: boolean): void;
|
|
|
+ get isAudioMuted(): boolean;
|
|
|
+ /**
|
|
|
+ * 设置视频流静音
|
|
|
+ * @param muted
|
|
|
+ */
|
|
|
+ setVideoMuted(muted: boolean): void;
|
|
|
+ get isVideoMuted(): boolean;
|
|
|
+ process(localStreamInfos: AliRtcLocalStreamInfo[]): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 停止视频流
|
|
|
+ */
|
|
|
+ stopVideo(): void;
|
|
|
+ /**
|
|
|
+ * 停止音频流
|
|
|
+ */
|
|
|
+ stopAudio(): void;
|
|
|
+ /**
|
|
|
+ * 停止视频流和音频流
|
|
|
+ */
|
|
|
+ stop(): void;
|
|
|
+ /**
|
|
|
+ * 应该在执行完 plugin 后调用
|
|
|
+ * @param profileName
|
|
|
+ * @param profileValue
|
|
|
+ */
|
|
|
+ updateVideoProfile(profileName?: string, profileValue?: Partial<IProfile>, skipConstraints?: boolean): Promise<void>;
|
|
|
+ get videoProfile(): string | undefined;
|
|
|
+ setVideoContentHint(hint?: string): void;
|
|
|
+ /**
|
|
|
+ * 应该在执行完 plugin 后调用
|
|
|
+ * @param profileName
|
|
|
+ */
|
|
|
+ updateAudioProfile(profileKey: AudioProfileKey): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 复制视频 profile 到指定 LocalStream
|
|
|
+ * @param publishStream
|
|
|
+ */
|
|
|
+ cloneVideoProfile(publishStream: LocalStream): Promise<void>;
|
|
|
+ addPlugin(plugin: AliRtcPlugin): void;
|
|
|
+ removePlugin(plugin: AliRtcPlugin): boolean;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface AliRtcLocalStreamListener {
|
|
|
+ videotrackended: () => void;
|
|
|
+ audiotrackended: () => void;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface AliRtcLocalVideoStats {
|
|
|
+ track: AliRtcVideoTrack;
|
|
|
+ streamType?: AliRtcVideoStreamType;
|
|
|
+ stats: any;
|
|
|
+}
|
|
|
+
|
|
|
+declare type AliRtcLocalView = string | HTMLVideoElement | string[] | HTMLVideoElement[] | null;
|
|
|
+
|
|
|
+export declare enum AliRtcLogLevel {
|
|
|
+ DEBUG = 0,
|
|
|
+ INFO = 1,
|
|
|
+ API = 2,
|
|
|
+ WARNING = 3,
|
|
|
+ ERROR = 4,
|
|
|
+ NONE = 5
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief OnBye类型枚举
|
|
|
+ */
|
|
|
+declare enum AliRtcOnByeType {
|
|
|
+ /** 当前user被踢出channel */
|
|
|
+ AliRtcOnByeBeKickedOut = 1,
|
|
|
+ /** channel已结束,需要离开会议 */
|
|
|
+ AliRtcOnByeChannelTerminated = 2,
|
|
|
+ /** 相同userID在其他设备joinChannel,当前设备被下线 */
|
|
|
+ AliRtcOnByeUserReplaced = 3
|
|
|
+}
|
|
|
+
|
|
|
+export declare abstract class AliRtcPlugin extends default_2<AliRtcPluginListener> {
|
|
|
+ name: string;
|
|
|
+ options: any;
|
|
|
+ type: AliRtcPluginType;
|
|
|
+ streamType: AliRtcRawDataStreamType;
|
|
|
+ trackType: AliRtcPluginTrackType;
|
|
|
+ zIndex: number;
|
|
|
+ private _isEnable;
|
|
|
+ lastInputAudioTrack?: MediaStreamTrack;
|
|
|
+ lastOutputAudioTrack?: MediaStreamTrack;
|
|
|
+ lastInputVideoTrack?: MediaStreamTrack;
|
|
|
+ lastOutputVideoTrack?: MediaStreamTrack;
|
|
|
+ private _hasCleared;
|
|
|
+ constructor(name: string, streamType?: AliRtcRawDataStreamType, trackType?: AliRtcPluginTrackType);
|
|
|
+ get initOptions(): {};
|
|
|
+ getOptions(): any;
|
|
|
+ abstract setOptions(options: any): void;
|
|
|
+ abstract isSupported(version: string): boolean;
|
|
|
+ init(): Promise<void>;
|
|
|
+ enable(): void;
|
|
|
+ disable(): void;
|
|
|
+ get isEnable(): boolean;
|
|
|
+ protected audioUpdated(streamInfo: AliRtcLocalStreamInfo): boolean;
|
|
|
+ protected videoUpdated(streamInfo: AliRtcLocalStreamInfo): boolean;
|
|
|
+ execute(streamInfo: AliRtcLocalStreamInfo, streamInfos: AliRtcLocalStreamInfo[]): Promise<void>;
|
|
|
+ abstract shouldUpdate(streamInfo: AliRtcLocalStreamInfo, streamInfos: AliRtcLocalStreamInfo[]): boolean;
|
|
|
+ abstract process(streamInfo: AliRtcLocalStreamInfo, streamInfos: AliRtcLocalStreamInfo[]): Promise<void>;
|
|
|
+ clear(_streamInfo?: AliRtcLocalStreamInfo): void;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface AliRtcPluginListener {
|
|
|
+ enabled: () => void;
|
|
|
+ disabled: () => void;
|
|
|
+ updated: () => void;
|
|
|
+ ready: () => void;
|
|
|
+ overload: (info: any) => void;
|
|
|
+ error: (error: any) => void;
|
|
|
+ unsupported: () => void;
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcPluginTrackType {
|
|
|
+ AUDIO = 0,
|
|
|
+ VIDEO = 1,
|
|
|
+ BOTH = 2
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcPluginType {
|
|
|
+ PRE_PROCESSOR = 0,
|
|
|
+ POST_PROCESSOR = 1
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcPublishState {
|
|
|
+ /** 0: SDK初始推流状态 */
|
|
|
+ AliRtcStatePublishIdle = 0,
|
|
|
+ /** 1: 未推流状态,可能是因为:
|
|
|
+ * - 已设置停止推送媒体流
|
|
|
+ * - 推送媒体流失败
|
|
|
+ */
|
|
|
+ AliRtcStateNoPublish = 1,
|
|
|
+ /** 2: 推流链接建立过程中 */
|
|
|
+ AliRtcStatePublishing = 2,
|
|
|
+ /** 3: 推流成功 */
|
|
|
+ AliRtcStatePublished = 3
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcRawDataStreamType {
|
|
|
+ /** 相机流 */
|
|
|
+ AliRtcSdkStreamTypeCapture = 0,
|
|
|
+ /** 屏幕共享流 */
|
|
|
+ AliRtcSdkStreamTypeScreen = 1
|
|
|
+}
|
|
|
+
|
|
|
+export declare type AliRtcRefreshAuthInfo = Pick<AliRtcAuthInfo, 'userId' | 'nonce' | 'token' | 'timestamp' | 'role'>;
|
|
|
+
|
|
|
+declare interface AliRtcRemoteAudioStats {
|
|
|
+ uid: string;
|
|
|
+ track: AliRtcAudioTrack;
|
|
|
+ stats: any;
|
|
|
+}
|
|
|
+
|
|
|
+export declare class AliRtcRemoteUserInfo {
|
|
|
+ private remoteUser;
|
|
|
+ constructor(remoteUser: RemoteUser);
|
|
|
+ get userId(): string;
|
|
|
+ get displayName(): string;
|
|
|
+ get isMuteAudioPlaying(): boolean;
|
|
|
+ get hasAudio(): boolean;
|
|
|
+ get hasCamera(): boolean;
|
|
|
+ get hasCameraLarge(): boolean;
|
|
|
+ get hasCameraSmall(): boolean;
|
|
|
+ get hasScreenShare(): boolean;
|
|
|
+ get isAudioSubscribing(): boolean;
|
|
|
+ get isVideoSubscribing(): boolean;
|
|
|
+ get isVideoLargeSubscribing(): boolean;
|
|
|
+ get isVideoSmallSubscribing(): boolean;
|
|
|
+ get isScreenSubscribing(): boolean;
|
|
|
+ get audioElement(): HTMLAudioElement | undefined;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface AliRtcRemoteVideoStats {
|
|
|
+ uid: string;
|
|
|
+ track: AliRtcVideoTrack;
|
|
|
+ streamType?: AliRtcVideoStreamType;
|
|
|
+ stats: any;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface AliRtcScreenShareConfiguration {
|
|
|
+ frameRate?: number;
|
|
|
+ bitrate?: number;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface AliRtcScreenShareStartConfig {
|
|
|
+ audio?: boolean;
|
|
|
+ videoTrack?: MediaStreamVideoTrack;
|
|
|
+ audioTrack?: MediaStreamAudioTrack;
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcSdkChannelProfile {
|
|
|
+ /** 普通通信模式 */
|
|
|
+ AliRtcSdkCommunication = "communication",
|
|
|
+ /** 直播模式(大方会模式) */
|
|
|
+ AliRtcSdkInteractiveLive = "interactive_live",
|
|
|
+ /** 低延迟互动直播模式 */
|
|
|
+ AliRtcSdkInteractiveWithLowLatencyLive = "cdn_live"
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcSdkClientRole {
|
|
|
+ /** 互动角色 */
|
|
|
+ AliRtcSdkInteractive = "interactive",
|
|
|
+ /** 观众角色 */
|
|
|
+ AliRtcSdkLive = "live"
|
|
|
+}
|
|
|
+
|
|
|
+/** 角色鉴权 主播pub|观众sub|转推流鉴权(跨房间转推中使用)relay */
|
|
|
+declare type AliRtcSdkTokenRole = 'pub' | 'sub' | 'relay';
|
|
|
+
|
|
|
+export declare enum AliRtcSubscribeState {
|
|
|
+ /** 初始状态 */
|
|
|
+ AliRtcStateSubscribeIdle = 0,
|
|
|
+ /** 未订阅 */
|
|
|
+ AliRtcStateNoSubscribe = 1,
|
|
|
+ /** 订阅中 */
|
|
|
+ AliRtcStateSubscribing = 2,
|
|
|
+ /** 已订阅 */
|
|
|
+ AliRtcStateSubscribed = 3
|
|
|
+}
|
|
|
+
|
|
|
+export declare class AliRtcTranscodingClockWidget {
|
|
|
+ x: number;
|
|
|
+ y: number;
|
|
|
+ fontSize: number;
|
|
|
+ zOrder: number;
|
|
|
+ fontColor: number;
|
|
|
+ fontType: AliRtcLiveTranscodingFontType;
|
|
|
+ constructor(x: number, y: number, fontSize: number);
|
|
|
+ constructor(x: number, y: number, fontSize: number, zOrder: number);
|
|
|
+ constructor(x: number, y: number, fontSize: number, zOrder: number, fontColor: number);
|
|
|
+ constructor(x: number, y: number, fontSize: number, zOrder: number, fontColor: number, fontType: AliRtcLiveTranscodingFontType);
|
|
|
+ toJson(videoWidth: number, videoHeight: number): {
|
|
|
+ x: number;
|
|
|
+ y: number;
|
|
|
+ fonttype: AliRtcLiveTranscodingFontType;
|
|
|
+ fontsize: number;
|
|
|
+ fontcolor: number;
|
|
|
+ zorder: number;
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+export declare class AliRtcTranscodingImage {
|
|
|
+ static DisplayType: typeof DisplayType;
|
|
|
+ url: string;
|
|
|
+ x: number;
|
|
|
+ y: number;
|
|
|
+ width: number;
|
|
|
+ height: number;
|
|
|
+ alpha: number;
|
|
|
+ display: DisplayType;
|
|
|
+ zOrder: number;
|
|
|
+ constructor(url: string, x: number, y: number, width: number, height: number);
|
|
|
+ constructor(url: string, x: number, y: number, width: number, height: number, zOrder: number);
|
|
|
+ constructor(url: string, x: number, y: number, width: number, height: number, zOrder: number, alpha: number);
|
|
|
+ constructor(url: string, x: number, y: number, width: number, height: number, zOrder: number, alpha: number, display: DisplayType);
|
|
|
+ toJson(videoWidth: number, videoHeight: number): {
|
|
|
+ url: string;
|
|
|
+ alpha: number;
|
|
|
+ display: DisplayType;
|
|
|
+ x: number;
|
|
|
+ y: number;
|
|
|
+ width: number;
|
|
|
+ height: number;
|
|
|
+ zorder: number;
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+export declare class AliRtcTranscodingText {
|
|
|
+ text: string;
|
|
|
+ x: number;
|
|
|
+ y: number;
|
|
|
+ fontSize: number;
|
|
|
+ zOrder: number;
|
|
|
+ fontColor: number;
|
|
|
+ fontType: AliRtcLiveTranscodingFontType;
|
|
|
+ constructor(text: string, x: number, y: number, fontSize: number);
|
|
|
+ constructor(text: string, x: number, y: number, fontSize: number, zOrder: number);
|
|
|
+ constructor(text: string, x: number, y: number, fontSize: number, zOrder: number, fontColor: number);
|
|
|
+ constructor(text: string, x: number, y: number, fontSize: number, zOrder: number, fontColor: number, fontType: AliRtcLiveTranscodingFontType);
|
|
|
+ toJson(videoWidth: number, videoHeight: number): {
|
|
|
+ text: string;
|
|
|
+ x: number;
|
|
|
+ y: number;
|
|
|
+ fonttype: AliRtcLiveTranscodingFontType;
|
|
|
+ fontsize: number;
|
|
|
+ fontcolor: number;
|
|
|
+ zorder: number;
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+export declare class AliRtcTranscodingUser {
|
|
|
+ userId: string;
|
|
|
+ x: number;
|
|
|
+ y: number;
|
|
|
+ width: number;
|
|
|
+ height: number;
|
|
|
+ zOrder?: number;
|
|
|
+ sourceType?: AliRtcLiveTranscodingSourceType;
|
|
|
+ segmentType: AliRtcLiveTranscodingSegmentType;
|
|
|
+ images: AliRtcTranscodingImage[];
|
|
|
+ texts: AliRtcTranscodingText[];
|
|
|
+ constructor(userId: string, x: number, y: number, width: number, height: number);
|
|
|
+ constructor(userId: string, x: number, y: number, width: number, height: number, zOrder: number);
|
|
|
+ constructor(userId: string, x: number, y: number, width: number, height: number, zOrder: number, sourceType: AliRtcLiveTranscodingSourceType);
|
|
|
+ toJson(index: number, videoWidth: number, videoHeight: number, mediaProcessMode?: AliRtcLiveTranscodingMediaProcessMode): {
|
|
|
+ [key: string]: any;
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcTrascodingPublishTaskStatus {
|
|
|
+ /*! 任务开始 */
|
|
|
+ TrascodingPublishTaskStatusStart = 0,
|
|
|
+ /*! 任务更新 */
|
|
|
+ TrascodingPublishTaskStatusUpdate = 1,
|
|
|
+ /*! 任务已停止 */
|
|
|
+ TrascodingPublishTaskStatusStop = 2
|
|
|
+}
|
|
|
+
|
|
|
+declare enum AliRtcUserOfflineReason {
|
|
|
+ /** 用户主动离开 */
|
|
|
+ AliRtcUserOfflineQuit = 0,
|
|
|
+ /** 因过长时间收不到对方数据包,超时掉线 */
|
|
|
+ AliRtcUserOfflineDropped = 1,
|
|
|
+ /** 用户身份从主播切换为观众时触发 */
|
|
|
+ AliRtcUserOfflineBecomeAudience = 2
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcVideoStreamType {
|
|
|
+ /** 无,在OnSubscribeStreamTypeChanged回调表示当前未订阅 */
|
|
|
+ AliRtcVideoStreamTypeNone = 0,
|
|
|
+ /** 高码率,高分辨率流(大流) */
|
|
|
+ AliRtcVideoStreamTypeHigh = 1,
|
|
|
+ /** 低码率,低分辨率流(小流) */
|
|
|
+ AliRtcVideoStreamTypeLow = 2
|
|
|
+}
|
|
|
+
|
|
|
+export declare enum AliRtcVideoTrack {
|
|
|
+ /** 无视频流 **/
|
|
|
+ AliRtcVideoTrackNo = 0,
|
|
|
+ /** 相机流 **/
|
|
|
+ AliRtcVideoTrackCamera = 1,
|
|
|
+ /** 屏幕共享流 **/
|
|
|
+ AliRtcVideoTrackScreen = 2,
|
|
|
+ /** 相机流和屏幕共享流 **/
|
|
|
+ AliRtcVideoTrackBoth = 3
|
|
|
+}
|
|
|
+
|
|
|
+declare interface AliRtcVideoTrackConfig {
|
|
|
+ userId?: string;
|
|
|
+ streamType: AliRtcRawDataStreamType;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface AliRtcWebTrackConfig {
|
|
|
+ biz: string;
|
|
|
+ extraParams?: string;
|
|
|
+}
|
|
|
+
|
|
|
+declare class AudioLevelMonitor extends default_2<AudioLevelMonitorListener> {
|
|
|
+ private audioContext;
|
|
|
+ private stream;
|
|
|
+ private sourceNode?;
|
|
|
+ private analyser?;
|
|
|
+ constructor();
|
|
|
+ getLevel(): number;
|
|
|
+ /**
|
|
|
+ * 开启监听 audio level 的变化
|
|
|
+ *
|
|
|
+ * @param {MediaStreamTrack} track 音频轨
|
|
|
+ * @param {number} [interval=1000] 检测间隔,单位毫秒,默认 1000ms
|
|
|
+ */
|
|
|
+ start(track: MediaStreamTrack, interval?: number): void;
|
|
|
+ stop(): void;
|
|
|
+ dispose(): void;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface AudioLevelMonitorListener {
|
|
|
+ audioLevel: (level: number) => void;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface AudioMixerPluginOptions {
|
|
|
+ audio?: number;
|
|
|
+ screen?: number;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * ------------------ 模式 ----- 采样率 ----- 声道 ----- 码率(kbps) -----
|
|
|
+ *
|
|
|
+ * standard: 标准音质 48000 单声道 64
|
|
|
+ *
|
|
|
+ * high: 高音质 48000 单声道 128
|
|
|
+ *
|
|
|
+ * standard-stereo: 立体声音质 48000 双声道 80
|
|
|
+ *
|
|
|
+ * high-stereo: 立体声高音质 48000 双声道 192
|
|
|
+ */
|
|
|
+declare type AudioProfileKey = 'standard' | 'high' | 'standard-stereo' | 'high-stereo';
|
|
|
+
|
|
|
+declare enum AudioStreamSource {
|
|
|
+ Microphone = 0,
|
|
|
+ Screen = 1,
|
|
|
+ Mixed = 2
|
|
|
+}
|
|
|
+
|
|
|
+declare class BizControl extends default_2<BizControlListener> {
|
|
|
+ /**
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
+ static logName: string;
|
|
|
+ protected self: LocalUser;
|
|
|
+ protected userMap: RemoteUserMap;
|
|
|
+ private usersViewMap;
|
|
|
+ rtsManager: RtsManager;
|
|
|
+ protected localStreamManager: LocalStreamManager;
|
|
|
+ protected authInfo?: AliRtcAuthInfo;
|
|
|
+ protected signalingManager: SignalingManager;
|
|
|
+ pluginManager: PluginManager;
|
|
|
+ private audioMixerPlugin?;
|
|
|
+ private dualVideoPlugin?;
|
|
|
+ private blankAudioPlugin?;
|
|
|
+ protected slsReporter: SLSReporter;
|
|
|
+ private statsMonitorId?;
|
|
|
+ private autoSubAudio;
|
|
|
+ private autoSubVideo;
|
|
|
+ private autoSubScreen;
|
|
|
+ private wantSubAudio;
|
|
|
+ private wantSubVideo;
|
|
|
+ private wantSubScreen;
|
|
|
+ private defaultStreamType;
|
|
|
+ private audioMuted;
|
|
|
+ private playoutVolume;
|
|
|
+ private refreshUrlTimer?;
|
|
|
+ private audioVolumeIndicationInterval;
|
|
|
+ private indicationTimer;
|
|
|
+ private parameter;
|
|
|
+ constructor(config: BizControlConfig);
|
|
|
+ private addSignalingManagerListener;
|
|
|
+ isAutoSubAudio(): boolean;
|
|
|
+ setAutoSubAudio(value: boolean): void;
|
|
|
+ isAutoSubVideo(): boolean;
|
|
|
+ setAutoSubVideo(value: boolean): void;
|
|
|
+ isAutoSubScreen(): boolean;
|
|
|
+ setAutoSubScreen(value: boolean): void;
|
|
|
+ isWantSubAudio(): boolean;
|
|
|
+ setWantSubAudio(value: boolean): void;
|
|
|
+ isWantSubVideo(): boolean;
|
|
|
+ setWantSubVideo(value: boolean): void;
|
|
|
+ isWantSubScreen(): boolean;
|
|
|
+ setWantSubScreen(value: boolean): void;
|
|
|
+ setRemoteDefaultVideoStreamType(type: AliRtcVideoStreamType): void;
|
|
|
+ setRemoteUserVideoStreamType(userId: string, type: AliRtcVideoStreamType): void;
|
|
|
+ setAudioMuted(mute: boolean): void;
|
|
|
+ setLocalViewConfig(view: AliRtcLocalView, track: AliRtcVideoTrack): void;
|
|
|
+ setRemoteViewConfig(uid: string, view: AliRtcLocalView, track: AliRtcVideoTrack): void;
|
|
|
+ get channel(): string | undefined;
|
|
|
+ get userId(): string | undefined;
|
|
|
+ get remoteUsers(): RemoteUser[];
|
|
|
+ /**
|
|
|
+ * 获取推流对象,只能是自己
|
|
|
+ */
|
|
|
+ get publisher(): LocalUser | undefined;
|
|
|
+ get isSubscribing(): boolean;
|
|
|
+ /**
|
|
|
+ * 处理远端用户推流状态变化
|
|
|
+ * @param {string} userId
|
|
|
+ * @param {string} displayname
|
|
|
+ * @param {string} callid
|
|
|
+ * @param {string} pullStreamUrl
|
|
|
+ * @param {TrackInfo[]} tracks
|
|
|
+ * @returns {void}
|
|
|
+ */
|
|
|
+ onRemotePublishStateChange(publishInfo: PublishUser): void;
|
|
|
+ /** 定期更新所有人的推拉流地址,便于重连
|
|
|
+ * @param pushStreamUrl 已有的推流地址,根据地址中的过期时间来设置定时器
|
|
|
+ * @private
|
|
|
+ */
|
|
|
+ private setTimeoutToUpdateAllStreamUrls;
|
|
|
+ /**
|
|
|
+ * 登陆成功后初始化用户管理,创建自己
|
|
|
+ * @param {AliRtcAuthInfo} authInfo
|
|
|
+ * @param {JoinResult} data
|
|
|
+ * @returns {Promise<void>}
|
|
|
+ */
|
|
|
+ init(authInfo: AliRtcAuthInfo, data: JoinResult): void;
|
|
|
+ leave(): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 离会后清除所有数据
|
|
|
+ * @returns {Promise<void>}
|
|
|
+ */
|
|
|
+ clear(): Promise<void>;
|
|
|
+ private startStatsMonitor;
|
|
|
+ private stopStatsMonitor;
|
|
|
+ /**
|
|
|
+ * 添加远端用户
|
|
|
+ * @param {string} userId
|
|
|
+ * @param {string} displayName
|
|
|
+ * @returns {void}
|
|
|
+ */
|
|
|
+ addUser(userId: string, displayName: string, reason: SubscribeReason): RemoteUser;
|
|
|
+ /**
|
|
|
+ * 执行添加远端用户
|
|
|
+ * @param {string} userId
|
|
|
+ * @param {string} displayName
|
|
|
+ * @returns {RemoteUser}
|
|
|
+ */
|
|
|
+ private executeAddUser;
|
|
|
+ /**
|
|
|
+ * 远端用户设备状态变化
|
|
|
+ * @param {DeviceStatusChangeType} event
|
|
|
+ * @param {string} userId
|
|
|
+ */
|
|
|
+ private onRemoteDeviceStatusChange;
|
|
|
+ /**
|
|
|
+ * 远端流数据采集上报
|
|
|
+ * @param {any} stat
|
|
|
+ */
|
|
|
+ private onRemoteStatReport;
|
|
|
+ /**
|
|
|
+ * rts 单 PC 订阅超限
|
|
|
+ */
|
|
|
+ private onSubscribeExceeds;
|
|
|
+ /**
|
|
|
+ * 移除远端用户
|
|
|
+ * @param {LeaveInfo} user
|
|
|
+ * @returns {Promise<void>}
|
|
|
+ */
|
|
|
+ removeLeftUser(user: LeaveInfo): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 更新远端用户数据
|
|
|
+ * @param {JoinInfo[]} users
|
|
|
+ * @returns {{joinList: JoinInfo[], leaveList: LeaveInfo[], presentList: JoinInfo[]}}
|
|
|
+ */
|
|
|
+ updateUsers(users: JoinInfo[]): {
|
|
|
+ joinList: JoinInfo[];
|
|
|
+ leaveList: LeaveInfo[];
|
|
|
+ presentList: JoinInfo[];
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * 根据 userId 获取 RemoteUser
|
|
|
+ * @param {string} userId
|
|
|
+ * @returns {RemoteUser | undefined}
|
|
|
+ */
|
|
|
+ getRemoteUser(userId: string): RemoteUser | undefined;
|
|
|
+ /**
|
|
|
+ * 更新远端用户设备信息
|
|
|
+ * @param {RemoteUserStatus} user
|
|
|
+ * @returns {boolean} true: 用户状态改变 false: 用户状态没有改变
|
|
|
+ */
|
|
|
+ updateRemoteUserDeviceStatus(user: RemoteUserStatus): void;
|
|
|
+ updateAudioWant(uid: string, sub: boolean): void;
|
|
|
+ updateVideoWant(uid: string, sub: boolean): void;
|
|
|
+ updateScreenWant(uid: string, sub: boolean): void;
|
|
|
+ private stopIndication;
|
|
|
+ private startIndication;
|
|
|
+ setEnableDualVideoStream(enabled: boolean, options?: AliRtcDualVideoPluginOptions): void;
|
|
|
+ setAudioVolume(options: AudioMixerPluginOptions): void;
|
|
|
+ enableAudioVolumeIndication(interval: number): void;
|
|
|
+ setPlayoutVolume(volume: number): void;
|
|
|
+ refreshAuthInfo(authInfo: AliRtcRefreshAuthInfo): void;
|
|
|
+ setEnableMediaExtensionMsg(enable: boolean): void;
|
|
|
+ setAudioRedEnabled(enable: boolean): void;
|
|
|
+ setParameter(parameter: string): void;
|
|
|
+ getParameter(): string;
|
|
|
+ sendDataChannelMessage(message: AliRtcDataChannelMsg): Promise<void>;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface BizControlConfig {
|
|
|
+ slsReporter: SLSReporter;
|
|
|
+ signalingManager: SignalingManager;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface BizControlListener {
|
|
|
+ [ClientEventType.RtsSubscribeExceeds]: (userId: string, options?: SubscribeOptions) => void;
|
|
|
+ [DeviceStatusChange.Remote]: (event: DeviceStatusChangeType, userId: string) => void;
|
|
|
+ [ClientEventType.PullStreamStats]: (userId: string, stat: any, pullStreamUrl: string) => void;
|
|
|
+ remoteTrackAvailableChange: (uid: string, aliRtcAudioTrack: AliRtcAudioTrack, aliRtcVideoTrack: AliRtcVideoTrack) => void;
|
|
|
+ audioSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
|
|
|
+ videoSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
|
|
|
+ screenSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
|
|
|
+ dataSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
|
|
|
+ userAudioMuted: (uid: string, isMute: boolean) => void;
|
|
|
+ userVideoMuted: (uid: string, isMute: boolean) => void;
|
|
|
+ userScreenMuted: (userId: string, isMute: boolean) => void;
|
|
|
+ audioVolume: (speakers: {
|
|
|
+ userId: string;
|
|
|
+ volume: number;
|
|
|
+ }[]) => void;
|
|
|
+ rtcLocalVideoStats: (stats: AliRtcLocalVideoStats[]) => void;
|
|
|
+ rtcLocalAudioStats: (stats: AliRtcLocalAudioStats[]) => void;
|
|
|
+ rtcRemoteVideoStats: (stats: AliRtcRemoteVideoStats[]) => void;
|
|
|
+ rtcRemoteAudioStats: (stats: AliRtcRemoteAudioStats[]) => void;
|
|
|
+ rtcStats: (stats: any) => void;
|
|
|
+ remoteAudioAutoPlayFail: (uid: string) => void;
|
|
|
+ remoteVideoAutoPlayFail: (uid: string, track: AliRtcVideoTrack) => void;
|
|
|
+ remoteAudioPlayError: (uid: string, reason?: string) => void;
|
|
|
+ remoteVideoPlayError: (uid: string, reason?: string) => void;
|
|
|
+ remoteSubscribeError: (error: AliRtcError, uid?: string) => void;
|
|
|
+ occurError: (error: AliRtcError, uid?: string) => void;
|
|
|
+ remoteDataChannelMessage: (uid: string, message: AliRtcDataChannelMsg) => void;
|
|
|
+}
|
|
|
+
|
|
|
+declare enum ClientEventType {
|
|
|
+ PullStreamStats = "remoteStat",
|
|
|
+ RtsSubscribeExceeds = "rtsSubscribeExceeds",
|
|
|
+ UserJoined = "userJoined",
|
|
|
+ UserLeft = "userLeft",
|
|
|
+ Bye = "bye",
|
|
|
+ MuteAudio = "muteAudio",
|
|
|
+ UnmuteAudio = "unmuteAudio",
|
|
|
+ MuteVideo = "muteVideo",
|
|
|
+ UnmuteVideo = "unmuteVideo",
|
|
|
+ MuteScreen = "muteScreen",
|
|
|
+ UnmuteScreen = "unmuteScreen",
|
|
|
+ Error = "error"
|
|
|
+}
|
|
|
+
|
|
|
+declare enum CmdType {
|
|
|
+ Add = 0,
|
|
|
+ Del = 1,
|
|
|
+ Update = 2,
|
|
|
+ None = 100
|
|
|
+}
|
|
|
+
|
|
|
+declare enum CodecType {
|
|
|
+ OPUS = "opus",
|
|
|
+ H264 = "H264",
|
|
|
+ UNKNOWN = ""
|
|
|
+}
|
|
|
+
|
|
|
+declare enum ConnectionLatencyStage {
|
|
|
+ CREATE_ENGINE = "create_engine",
|
|
|
+ JOIN = "join",
|
|
|
+ WANT_INSERT_PUB_TASK = "wantInsertPubTask",
|
|
|
+ INSERT_PUB_TASK = "InsertPubTask",
|
|
|
+ HANDLE_PUB_TASK = "HandlePubTask",
|
|
|
+ RECV_NOTIFY_PUBLISH = "RecvNotifyPublish",
|
|
|
+ INSERT_SUB_TASK = "InsertSubTask",
|
|
|
+ HANDLE_SUB_TASK = "HandleSubTask",
|
|
|
+ FIRST_REMOTE = "first_remote"
|
|
|
+}
|
|
|
+
|
|
|
+declare enum ConnectionLatencyStatus {
|
|
|
+ START = "start",
|
|
|
+ SEND_SIG = "send_sig",
|
|
|
+ RECV_RST = "recv_rst",
|
|
|
+ END = "end",
|
|
|
+ RECEIVED = "received",
|
|
|
+ DECODED = "decoded",
|
|
|
+ PLAYED = "played"
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * websocket链接状态
|
|
|
+ */
|
|
|
+declare enum CONNECTSTATUS {
|
|
|
+ DISCONNECTED = 0,
|
|
|
+ CONNECTING = 1,
|
|
|
+ CONNECTED = 2
|
|
|
+}
|
|
|
+
|
|
|
+declare interface DeviceStatus {
|
|
|
+ micOpen: boolean;
|
|
|
+ micInterrupted: boolean;
|
|
|
+ cameraOpen: boolean;
|
|
|
+ screenShare: boolean;
|
|
|
+ audioDisable: boolean;
|
|
|
+ videoDisable: boolean;
|
|
|
+ screenDisable: boolean;
|
|
|
+ backgroundMode: boolean;
|
|
|
+ accompanyPlaying: boolean;
|
|
|
+}
|
|
|
+
|
|
|
+declare enum DeviceStatusChange {
|
|
|
+ Local = "local-device-status-change",
|
|
|
+ Remote = "remote-device-status-change"
|
|
|
+}
|
|
|
+
|
|
|
+declare type DeviceStatusChangeType = ClientEventType.MuteAudio | ClientEventType.UnmuteAudio | ClientEventType.MuteScreen | ClientEventType.UnmuteScreen | ClientEventType.MuteVideo | ClientEventType.UnmuteVideo;
|
|
|
+
|
|
|
+declare enum DisplayType {
|
|
|
+ NOT_DISPLAY = 0,
|
|
|
+ ALWAYS = 1,
|
|
|
+ WHEN_NO_VIDEO = 2
|
|
|
+}
|
|
|
+
|
|
|
+declare interface IResponse {
|
|
|
+ version: number;
|
|
|
+ code: number;
|
|
|
+ msgtype: MessageType;
|
|
|
+ tid: string;
|
|
|
+ isproxy?: boolean;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface ISendPackage {
|
|
|
+ version: number;
|
|
|
+ msgtype: MessageType;
|
|
|
+ tid: string;
|
|
|
+ header: {
|
|
|
+ appid: string;
|
|
|
+ channelid: string;
|
|
|
+ sessionid: string;
|
|
|
+ userid: string;
|
|
|
+ displayName?: string;
|
|
|
+ clientversion?: string;
|
|
|
+ platform?: string;
|
|
|
+ };
|
|
|
+ data: {
|
|
|
+ seq: number;
|
|
|
+ l1ip?: string;
|
|
|
+ status?: string;
|
|
|
+ clientrole?: string;
|
|
|
+ configure?: {
|
|
|
+ clientrole?: AliRtcSdkClientRole;
|
|
|
+ channelprofile: AliRtcSdkChannelProfile;
|
|
|
+ };
|
|
|
+ auth?: SendPackageAuthInfo;
|
|
|
+ sessionid?: string;
|
|
|
+ pushstreamurl?: string;
|
|
|
+ users?: any[];
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 服务端通知的远端用户信息
|
|
|
+ */
|
|
|
+declare interface JoinInfo {
|
|
|
+ displayname: string;
|
|
|
+ session: string;
|
|
|
+ userid: string;
|
|
|
+ callid: string;
|
|
|
+ clientrole?: string;
|
|
|
+ subscribe?: {
|
|
|
+ pullstreamurl: string;
|
|
|
+ };
|
|
|
+ tracks?: TrackInfo[];
|
|
|
+}
|
|
|
+
|
|
|
+declare interface JoinResult {
|
|
|
+ pushstreamurl: string;
|
|
|
+ tid: string;
|
|
|
+ users: JoinInfo[];
|
|
|
+ timestamp: number;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface LeaveInfo {
|
|
|
+ userid: string;
|
|
|
+ leavecode: AliRtcUserOfflineReason;
|
|
|
+ reason: string;
|
|
|
+}
|
|
|
+
|
|
|
+declare class LocalProfileManager {
|
|
|
+ private defaultProfile;
|
|
|
+ profile?: string;
|
|
|
+ profileMap: Map<string, IProfile>;
|
|
|
+ audioProfile?: AudioProfileKey;
|
|
|
+ contentHint?: string;
|
|
|
+ constructor(defaultProfile?: IProfile);
|
|
|
+ updateProfile(profileKey: string, profileValue?: Partial<IProfile>): void;
|
|
|
+ get videoProfile(): string | undefined;
|
|
|
+ updateAudioProfile(profileKey: AudioProfileKey): void;
|
|
|
+ setContentHint(videoTrack: MediaStreamTrack | undefined, contentHint?: string): void;
|
|
|
+ /**
|
|
|
+ * 更新源流 Constraints
|
|
|
+ * 更新 PeerConnectiong Sender 相关配置
|
|
|
+ * @param stream
|
|
|
+ */
|
|
|
+ setVideoProfile(originVideoTrack: MediaStreamTrack | undefined, target: LocalStream | undefined, skipConstraints?: boolean): Promise<void>;
|
|
|
+}
|
|
|
+
|
|
|
+declare type LocalStreamConfig = Omit<_LocalStreamConfig, 'custom'>;
|
|
|
+
|
|
|
+declare interface _LocalStreamConfig extends IStreamConfig {
|
|
|
+ videoProfile?: string;
|
|
|
+ screenProfile?: string;
|
|
|
+}
|
|
|
+
|
|
|
+declare class LocalStreamManager extends default_2<LocalStreamManagerListener> {
|
|
|
+ /**
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
+ static logName: string;
|
|
|
+ private pluginManager;
|
|
|
+ private slsReporter;
|
|
|
+ private publishingCameraVideoStream;
|
|
|
+ private publishingScreenVideoStream;
|
|
|
+ cameraStreamInfo: AliRtcLocalStreamInfo;
|
|
|
+ screenStreamInfo: AliRtcLocalStreamInfo;
|
|
|
+ private streamInfos;
|
|
|
+ private _audioCaptureDisabled;
|
|
|
+ private _cameraCaptureDisabled;
|
|
|
+ private _publishLocalAudioStreamEnabled;
|
|
|
+ private _publishLocalVideoStreamEnabled;
|
|
|
+ private _publishLocalScreenStreamEnabled;
|
|
|
+ constructor(pluginManager: PluginManager, slsReporter: SLSReporter);
|
|
|
+ get hasCamera(): boolean;
|
|
|
+ get audioCaptureDisabled(): boolean;
|
|
|
+ set audioCaptureDisabled(closed: boolean);
|
|
|
+ get cameraCaptureDisabled(): boolean;
|
|
|
+ set cameraCaptureDisabled(closed: boolean);
|
|
|
+ setAudioMuted(muted: boolean): void;
|
|
|
+ get isAudioMuted(): boolean;
|
|
|
+ setCameraMuted(muted: boolean): void;
|
|
|
+ get isCameraMuted(): boolean;
|
|
|
+ setScreenMuted(muted: boolean): void;
|
|
|
+ get isScreenMuted(): boolean;
|
|
|
+ get publishLocalAudioStreamEnabled(): boolean;
|
|
|
+ set publishLocalAudioStreamEnabled(enable: boolean);
|
|
|
+ get publishLocalVideoStreamEnabled(): boolean;
|
|
|
+ set publishLocalVideoStreamEnabled(enable: boolean);
|
|
|
+ get publishLocalScreenStreamEnabled(): boolean;
|
|
|
+ set publishLocalScreenStreamEnabled(enable: boolean);
|
|
|
+ updateStreams(): Promise<void>;
|
|
|
+ private setAvailableCameraDeviceId;
|
|
|
+ private setAvailableMicrophoneDeviceId;
|
|
|
+ /**
|
|
|
+ * 创建 LocalStream
|
|
|
+ * @param {LocalStreamConfig} params 创建 LocalStream 的配置
|
|
|
+ * @returns {LocalStream} 当前创建的 LocalStream
|
|
|
+ */
|
|
|
+ createLocalStream(params: LocalStreamConfig): Promise<LocalStream | undefined>;
|
|
|
+ /**
|
|
|
+ * 停止推流,底层调用 rts publishStop,不会导致 DC 马上关闭。适合暂时停推的场景
|
|
|
+ * @param {StopPublishOptions} options
|
|
|
+ * @returns {Promise<PublishStreamInfo>} 如果返回了 audio,则表示需要更新音频流
|
|
|
+ */
|
|
|
+ stopLocalStream(options: StopPublishOptions): Promise<void>;
|
|
|
+ get publishStreams(): PublishStreamInfo;
|
|
|
+ createHTTPPublishStream(): Promise<{
|
|
|
+ publishStream: LocalStream | undefined;
|
|
|
+ videoSmallStream: LocalStream | undefined;
|
|
|
+ screenStream: LocalStream | undefined;
|
|
|
+ vMsid: string | undefined;
|
|
|
+ }>;
|
|
|
+ /**
|
|
|
+ * 停止所有流
|
|
|
+ */
|
|
|
+ stop(): void;
|
|
|
+ /**
|
|
|
+ * 设置摄像头流 profile
|
|
|
+ * @param {LocalStream | null} stream
|
|
|
+ * @param {string} profileKey
|
|
|
+ * @param {IProfile} profile
|
|
|
+ */
|
|
|
+ setVideoProfile(profileKey?: string, profile?: Partial<IProfile>, skipConstraints?: boolean): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 设置摄像头流 content hint
|
|
|
+ * @param {string} hint
|
|
|
+ * @note 不传则尝试复用之前的 hint
|
|
|
+ */
|
|
|
+ setVideoContentHint(hint?: string): void;
|
|
|
+ /**
|
|
|
+ * 设置音频流 profile
|
|
|
+ * @param {string} profileKey
|
|
|
+ */
|
|
|
+ setAudioProfile(profileKey: AudioProfileKey): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 设置屏幕共享流 profile
|
|
|
+ * @param {LocalStream} stream
|
|
|
+ * @param {string} profileKey
|
|
|
+ * @param {IProfile} profile
|
|
|
+ */
|
|
|
+ setScreenProfile(profileKey?: string, profile?: Partial<IProfile>): Promise<void>;
|
|
|
+ setScreenContentHint(hint?: string): void;
|
|
|
+ /**
|
|
|
+ * 设置 cameraVideoConstraints
|
|
|
+ * @param {IVideoConstraints} cameraVideoConstraints
|
|
|
+ */
|
|
|
+ setCameraVideoConstraints(cameraVideoConstraints: IVideoConstraints): void;
|
|
|
+ /**
|
|
|
+ * 设置 micAudioConstraints
|
|
|
+ * @param {IAudioConstraints} micAudioConstraints
|
|
|
+ */
|
|
|
+ setMicAudioConstraints(micAudioConstraints: IAudioConstraints): void;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface LocalStreamManagerListener {
|
|
|
+ trackended: (type: TrackEvent_2) => {};
|
|
|
+ publishupdate: () => {};
|
|
|
+}
|
|
|
+
|
|
|
+declare class LocalUser extends User {
|
|
|
+ /**
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
+ static logName: string;
|
|
|
+ private _url;
|
|
|
+ private joinTime;
|
|
|
+ private _isPublishing;
|
|
|
+ private publishPromise;
|
|
|
+ private previewElements;
|
|
|
+ private screenPreviewElements;
|
|
|
+ private streamManager;
|
|
|
+ private dc;
|
|
|
+ protected streamTracks?: TrackInfo[];
|
|
|
+ protected publishId: string;
|
|
|
+ protected signalingManager: SignalingManager;
|
|
|
+ traceId: string;
|
|
|
+ private monitorTimerId?;
|
|
|
+ private monitorDataCache;
|
|
|
+ private trackTraceIdMap;
|
|
|
+ private candidateDataCache;
|
|
|
+ private pcMediaStatsMap;
|
|
|
+ protected slsReporter: SLSReporter;
|
|
|
+ private audioPubState;
|
|
|
+ private videoPubState;
|
|
|
+ private videoSmallPubState;
|
|
|
+ private screenPubState;
|
|
|
+ private dataPubState;
|
|
|
+ private parameter;
|
|
|
+ constructor(config: LocalUserConfig);
|
|
|
+ get url(): string;
|
|
|
+ set url(value: string);
|
|
|
+ get joined(): boolean;
|
|
|
+ get isPublishing(): boolean;
|
|
|
+ get publishStreams(): PublishStreamInfo;
|
|
|
+ get cameraTrack(): MediaStreamTrack | undefined;
|
|
|
+ get screenTrack(): MediaStreamTrack | undefined;
|
|
|
+ get audioTrack(): MediaStreamTrack | undefined;
|
|
|
+ get hasCamera(): boolean;
|
|
|
+ get hasMicrophone(): boolean;
|
|
|
+ get hasScreenShare(): boolean;
|
|
|
+ get hasCameraTrackInMS(): boolean;
|
|
|
+ get hasCameraDualTrackInMS(): boolean;
|
|
|
+ get hasScreenTrackInMS(): boolean;
|
|
|
+ get hasAudioTrackInMS(): boolean;
|
|
|
+ get cameraDirection(): string | undefined;
|
|
|
+ get audioCaptureDisabled(): boolean;
|
|
|
+ get cameraCaptureDisabled(): boolean;
|
|
|
+ get publishLocalVideoStreamEnabled(): boolean;
|
|
|
+ get publishLocalAudioStreamEnabled(): boolean;
|
|
|
+ get publishLocalScreenStreamEnabled(): boolean;
|
|
|
+ setPublishLocalAudioStreamEnabled(enable: boolean): void;
|
|
|
+ setPublishLocalVideoStreamEnabled(enable: boolean): void;
|
|
|
+ setPublishLocalScreenStreamEnabled(enable: boolean): void;
|
|
|
+ initInfo(authInfo: AliRtcAuthInfo, pushStreamUrl: string): void;
|
|
|
+ setVideoProfile(profile?: VideoProfileWithSendFramerate): Promise<void>;
|
|
|
+ setVideoContentHint(hint: string): void;
|
|
|
+ setScreenContentHint(hint: string): void;
|
|
|
+ setAudioProfile(profileKey: AudioProfileKey): Promise<void>;
|
|
|
+ setScreenProfile(profile?: Partial<IProfile>): Promise<void>;
|
|
|
+ setCameraDirection(direction: AliRtcCameraDirection): void;
|
|
|
+ setCameraDeviceId(deviceId: string): void;
|
|
|
+ muteLocalCamera(mute: boolean): void;
|
|
|
+ muteLocalMic(mute: boolean): void;
|
|
|
+ muteLocalScreen(mute: boolean): void;
|
|
|
+ setMicrophoneDeviceId(deviceId: string): void;
|
|
|
+ setMicrophoneConstraints(constraints: MediaTrackConstraints): void;
|
|
|
+ updatePubId(): void;
|
|
|
+ clearPublishState(): void;
|
|
|
+ leave(): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 销毁,停止推流
|
|
|
+ * @returns {Promise<void>}
|
|
|
+ */
|
|
|
+ clear(): Promise<void>;
|
|
|
+ resetElement(element: HTMLVideoElement): void;
|
|
|
+ setPreviewElement(previewParams: PreviewConfig): void;
|
|
|
+ startDefaultCamera(audioOnly: boolean): Promise<void>;
|
|
|
+ startDefaultAudio(): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 为本地预览设置渲染元素和视频流
|
|
|
+ * @param {AliRtcLocalView} view 渲染元素,null 则为停止显示
|
|
|
+ * @param {AliRtcVideoTrack} track 视频流类型
|
|
|
+ */
|
|
|
+ setViewConfig(elements: null | HTMLVideoElement[], track: AliRtcVideoTrack): void;
|
|
|
+ /**
|
|
|
+ * 开启摄像头采集
|
|
|
+ * @param params
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ startCameraCapture(): Promise<LocalStream | undefined>;
|
|
|
+ /**
|
|
|
+ * 关闭摄像头采集
|
|
|
+ * @note 调用此接口后,入会后、离会再入会,采集设备保持关闭状态
|
|
|
+ */
|
|
|
+ stopCameraCapture(): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 开启麦克风采集
|
|
|
+ * @param params
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ startAudioCapture(): Promise<LocalStream | undefined>;
|
|
|
+ /**
|
|
|
+ * 关闭音频采集
|
|
|
+ * @note 调用此接口后,入会后、离会再入会,采集设备保持关闭状态
|
|
|
+ */
|
|
|
+ stopAudioCapture(): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 预览本地流
|
|
|
+ * @param {PreviewConfig} previewParams
|
|
|
+ * @returns {Promise<MediaStream>}
|
|
|
+ */
|
|
|
+ preview(previewParams: PreviewConfig): Promise<MediaStream | undefined>;
|
|
|
+ /**
|
|
|
+ * 在所有预览容器中预览当前流
|
|
|
+ * @param {boolean} screen 是否指定预览辅流
|
|
|
+ */
|
|
|
+ previewAll(previewAllParams?: PreviewAllConfig): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 停止预览本地流
|
|
|
+ */
|
|
|
+ stopPreview(previewParams?: StopPreviewConfig): void;
|
|
|
+ /**
|
|
|
+ * 恢复推流
|
|
|
+ * @returns {Promise<void>}
|
|
|
+ */
|
|
|
+ resumePublish(): Promise<void>;
|
|
|
+ createLocalStream(params: LocalStreamConfig): Promise<LocalStream | undefined>;
|
|
|
+ stopLocalStream(options: PublishOptions): Promise<void>;
|
|
|
+ private compareAndPublish;
|
|
|
+ private reportAudioProfile;
|
|
|
+ private reportVideoProfile;
|
|
|
+ private reportScreenProfile;
|
|
|
+ private updateDataChannel;
|
|
|
+ private publishDataChannel;
|
|
|
+ /**
|
|
|
+ * 开始推流
|
|
|
+ * @param isResume 是否是恢复推流
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ startPublish(isResume?: boolean, reason?: PublishReason): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 重新执行 progress 并触发 publishupdate
|
|
|
+ */
|
|
|
+ updateStreams(): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 对比本地流和正在推流,进行推流更新
|
|
|
+ * @param isResume 是否是恢复推流
|
|
|
+ */
|
|
|
+ publishUpdate(reason?: PublishReason): Promise<PublishInfo | undefined>;
|
|
|
+ private syncPublishToRoomServer;
|
|
|
+ private refreshPushStreamUrl;
|
|
|
+ /**
|
|
|
+ * 推流,用于 rts subscribe/publish 被调用后,此时 DataChannel 已存在
|
|
|
+ * @param {LocalStream} stream
|
|
|
+ * @returns {Promise<PublishInfo>}
|
|
|
+ */
|
|
|
+ publishAdd(stream: LocalStream, extra: PublishExtraParams, isResume?: boolean, retryTimes?: number): Promise<PublishInfo>;
|
|
|
+ /**
|
|
|
+ * 替换推流 Track(仅限于替换已存在的 Track 类型)
|
|
|
+ * @param {LocalStream} stream
|
|
|
+ * @returns {Promise<PublishInfo>}
|
|
|
+ */
|
|
|
+ publishReplace(stream: LocalStream, extra?: PublishExtraParams): Promise<PublishInfo>;
|
|
|
+ /**
|
|
|
+ * 停止推某些轨,不销毁 DataChannel 和 LocalStream,用于非销毁场景
|
|
|
+ * @param {PublishOptions} options
|
|
|
+ * @returns {Promise<PublishInfo>}
|
|
|
+ */
|
|
|
+ publishDeleteTracks(options: PublishOptions): Promise<PublishInfo>;
|
|
|
+ /**
|
|
|
+ * 停止推流,不销毁 LocalStream,用于非销毁场景
|
|
|
+ * @returns {Promise<PublishInfo>}
|
|
|
+ */
|
|
|
+ publishStop(): Promise<PublishInfo>;
|
|
|
+ /**
|
|
|
+ * 停止推流,销毁 DataChannel,用于销毁的场景
|
|
|
+ * @returns {Promise<PublishInfo>}
|
|
|
+ */
|
|
|
+ unPublish(): Promise<PublishInfo>;
|
|
|
+ /**
|
|
|
+ * 事件通知本地的设备使用状态
|
|
|
+ */
|
|
|
+ reportSelfDeviceStatus(): void;
|
|
|
+ /**
|
|
|
+ * 从localStream 中获取当前的设备状态
|
|
|
+ * @returns {string}
|
|
|
+ */
|
|
|
+ private getDeviceStatus;
|
|
|
+ private onTrackEnd;
|
|
|
+ private resetPreviewElements;
|
|
|
+ private resetSecondayPreviewElements;
|
|
|
+ getMediaStats(id: string): any;
|
|
|
+ private reportPublishMonitor;
|
|
|
+ private reportNetwork;
|
|
|
+ private startStreamMonitor;
|
|
|
+ /**
|
|
|
+ * 停止本地流数据采集
|
|
|
+ */
|
|
|
+ private stopStreamMonitor;
|
|
|
+ /**
|
|
|
+ * 清除本地流
|
|
|
+ * @returns {void}
|
|
|
+ */
|
|
|
+ clearStream(): void;
|
|
|
+ /**
|
|
|
+ * 获取当前使用的摄像头 deviceId
|
|
|
+ * @returns {string | undefined}
|
|
|
+ */
|
|
|
+ getCurrentCameraDeviceId(): string | undefined;
|
|
|
+ /**
|
|
|
+ * 获取当前使用的摄像头 deviceId
|
|
|
+ * @returns {string | undefined}
|
|
|
+ */
|
|
|
+ getCurrentMicDeviceId(): string | undefined;
|
|
|
+ enableAudioVolumeIndication(interval: number): void;
|
|
|
+ sendSEI(message: ArrayBuffer, repeatCount: number, payloadType: number): Promise<void>;
|
|
|
+ sendDataChannelMessage(message: AliRtcDataChannelMsg): Promise<void>;
|
|
|
+ getStats(): Promise<{
|
|
|
+ audio: AliRtcLocalAudioStats[];
|
|
|
+ video: AliRtcLocalVideoStats[];
|
|
|
+ candidate: any;
|
|
|
+ }>;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface LocalUserConfig {
|
|
|
+ rtsManager: RtsManager;
|
|
|
+ localStreamManager: LocalStreamManager;
|
|
|
+ slsReporter: SLSReporter;
|
|
|
+ signalingManager: SignalingManager;
|
|
|
+ pluginManager: PluginManager;
|
|
|
+ audioVolumeIndicationInterval: number;
|
|
|
+ parameter: {
|
|
|
+ [key: string]: any;
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 日志埋点类,调用LogReporter进行日志埋点
|
|
|
+ * 在入会之前,会将埋点缓存,入会后以每200ms一条的速度将缓存的埋点按顺序上报
|
|
|
+ */
|
|
|
+declare class LogClient {
|
|
|
+ protected tracker?: default_3;
|
|
|
+ protected param?: any;
|
|
|
+ protected msgCacheArr: any[];
|
|
|
+ protected index: number;
|
|
|
+ protected stsOpt?: any;
|
|
|
+ protected slsToken?: SLSSTSToken;
|
|
|
+ protected ossToken?: OSSSTSToken;
|
|
|
+ protected ntpClock: NTPClient;
|
|
|
+ constructor();
|
|
|
+ private createTracker;
|
|
|
+ start(info: AliRtcAuthInfo): void;
|
|
|
+ updateToken(slsToken: SLSSTSToken, ossToken?: OSSSTSToken): void;
|
|
|
+ /**
|
|
|
+ * 断开连接
|
|
|
+ */
|
|
|
+ stop(): void;
|
|
|
+ /**
|
|
|
+ * 发送一条日志
|
|
|
+ * @param {any} log
|
|
|
+ */
|
|
|
+ sendReport(log: any): void;
|
|
|
+ /**
|
|
|
+ * 初始化公共参数
|
|
|
+ */
|
|
|
+ protected initParam(info: AliRtcAuthInfo): void;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface LogInfo {
|
|
|
+ [key: string]: string | number;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface MediaTrackInfo {
|
|
|
+ ssrc: string;
|
|
|
+ msid: string;
|
|
|
+ red: number;
|
|
|
+ codec: CodecType;
|
|
|
+ sample?: number;
|
|
|
+ pt: number;
|
|
|
+ type?: CmdType;
|
|
|
+}
|
|
|
+
|
|
|
+declare enum MessageType {
|
|
|
+ KEEPALIVE = "keepalive",
|
|
|
+ JOINCHANNEL = "joinchannel",
|
|
|
+ NOTIFYJOIN = "notifyjoin",
|
|
|
+ NOTIFYSTATUS = "notifystatus",
|
|
|
+ STATUSREPORT = "statusreport",
|
|
|
+ LEAVECHANNEL = "leavechannel",
|
|
|
+ NOTIFYLEAVE = "notifyleave",
|
|
|
+ NOTIFYPUBLISH = "notifypublish",
|
|
|
+ BYE = "bye",
|
|
|
+ RECONNECT = "reconnect",
|
|
|
+ PUBLISH = "publish",
|
|
|
+ REFRESHURL = "refreshurl",
|
|
|
+ UNSUBSCRIBE = "unsubscribe",
|
|
|
+ ROLEUPDATE = "roleupdate"
|
|
|
+}
|
|
|
+
|
|
|
+declare enum MPU_TASK_TRANSACTION_TYPE {
|
|
|
+ MPU_TASK_TRANSACTION_START = 0,
|
|
|
+ MPU_TASK_TRANSACTION_UPDATE = 1,
|
|
|
+ MPU_TASK_TRANSACTION_STOP = 2,
|
|
|
+ MPU_TASK_TRANSACTION_LIST = 3,
|
|
|
+ MPU_TASK_TRANSACTION_POLLING = 4,
|
|
|
+ MPU_TASK_TRANSACTION_ACKNOWLEDGE = 5,
|
|
|
+ MPU_TASK_TRANSACTION_END = 6
|
|
|
+}
|
|
|
+
|
|
|
+declare enum MsidType {
|
|
|
+ Audio = "sophon_audio",
|
|
|
+ VideoLarge = "sophon_video_camera_large",
|
|
|
+ VideoSmall = "sophon_video_camera_small",
|
|
|
+ Screen = "sophon_video_screen_share",
|
|
|
+ Data = "sophon_data"
|
|
|
+}
|
|
|
+
|
|
|
+declare class NTPClient {
|
|
|
+ private static instance;
|
|
|
+ private ntpClock;
|
|
|
+ private constructor();
|
|
|
+ static getInstance(): NTPClient;
|
|
|
+ now(): number;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface OSSSTSToken {
|
|
|
+ access_key_id: string;
|
|
|
+ access_key_secret: string;
|
|
|
+ security_token: string;
|
|
|
+ region_endpoint: string;
|
|
|
+ bucket_name: string;
|
|
|
+ expiration: number;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface OSSToken {
|
|
|
+ access_key_id: string;
|
|
|
+ access_key_secret: string;
|
|
|
+ security_token: string;
|
|
|
+ region_endpoint: string;
|
|
|
+ bucket_name: string;
|
|
|
+ expiration: number;
|
|
|
+}
|
|
|
+
|
|
|
+declare class PackageCreater {
|
|
|
+ protected authInfo: AliRtcAuthInfo;
|
|
|
+ protected userName: string;
|
|
|
+ protected seqIndex: number;
|
|
|
+ constructor(authInfo: AliRtcAuthInfo, userName: string);
|
|
|
+ get roleAuth(): SendPackageAuthInfo | undefined;
|
|
|
+ refreshAuthInfo(authInfo: AliRtcAuthInfo): void;
|
|
|
+ getSeqIndex(): number;
|
|
|
+ /**
|
|
|
+ * 创建一个心跳包
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ createKeepAlivePackage(): ISendPackage;
|
|
|
+ /**
|
|
|
+ * 创建一个用于发送入会消息的Package
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ createJoinPackage(): ISendPackage;
|
|
|
+ /**
|
|
|
+ * 创建一个用于发送离会消息的Package
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ crateLeavePackage(): ISendPackage;
|
|
|
+ createStatusPackage(status: string): ISendPackage;
|
|
|
+ /**
|
|
|
+ * 创建一个用于发送推流消息的Package
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ createPublishPackage(): ISendPackage;
|
|
|
+ createRoleUpdatePackage(): ISendPackage;
|
|
|
+ createReconnectPackage(data?: ReconnectData): ISendPackage;
|
|
|
+ createRefreshUrlPackage(): ISendPackage;
|
|
|
+ /**
|
|
|
+ * 创建一个Response包
|
|
|
+ * @param {string} tid Notify消息的tid
|
|
|
+ * @param {MessageType} msgType 消息类型
|
|
|
+ * @returns {IResponse}
|
|
|
+ */
|
|
|
+ createResponsePackage(tid: string, msgType: MessageType): IResponse;
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param messageType
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ protected createBaseSendPackage(messageType: MessageType): ISendPackage;
|
|
|
+}
|
|
|
+
|
|
|
+declare type Parameter = {
|
|
|
+ [key: string]: any;
|
|
|
+};
|
|
|
+
|
|
|
+declare class PluginManager extends default_2<PluginManagerListener> {
|
|
|
+ private plugins;
|
|
|
+ add(plugin: AliRtcPlugin, options?: any): void;
|
|
|
+ remove(name: string): void;
|
|
|
+ removeAll(): void;
|
|
|
+ get(name: string): AliRtcPlugin | undefined;
|
|
|
+ has(name: string): boolean;
|
|
|
+ getAll(): AliRtcPlugin[];
|
|
|
+}
|
|
|
+
|
|
|
+declare interface PluginManagerListener {
|
|
|
+ added: (plugin: AliRtcPlugin) => void;
|
|
|
+ removed: (plugin: AliRtcPlugin) => void;
|
|
|
+ updated: (plugin: AliRtcPlugin) => void;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface PreviewAllConfig {
|
|
|
+ primary?: boolean;
|
|
|
+ screen?: boolean;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface PreviewConfig {
|
|
|
+ videoElement: HTMLVideoElement;
|
|
|
+ screen?: boolean;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface PublishExtraParams {
|
|
|
+ vMsid?: string;
|
|
|
+ aMsid?: string;
|
|
|
+ isVideoSmall?: boolean;
|
|
|
+ isScreen?: boolean;
|
|
|
+ isAudio?: boolean;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface PublishInfo {
|
|
|
+ type: PublishType;
|
|
|
+ userid: string;
|
|
|
+ sessionid: string;
|
|
|
+ displayname: string;
|
|
|
+ pubid?: string;
|
|
|
+ resume?: boolean;
|
|
|
+ subscribe: {
|
|
|
+ signal: string;
|
|
|
+ pullstreamurl: string;
|
|
|
+ };
|
|
|
+ l1ip?: string;
|
|
|
+ callid: string;
|
|
|
+ tracks: TrackInfo[];
|
|
|
+ traceid?: string;
|
|
|
+ signaltid?: string;
|
|
|
+}
|
|
|
+
|
|
|
+declare type PublishOptions = StreamOptions & {
|
|
|
+ vMsid?: string;
|
|
|
+};
|
|
|
+
|
|
|
+declare enum PublishReason {
|
|
|
+ MANUAL = 0,
|
|
|
+ JOIN_CHANNEL = 1,
|
|
|
+ ROLE_CHANGE = 2,
|
|
|
+ RECONNECT = 3
|
|
|
+}
|
|
|
+
|
|
|
+declare interface PublishStreamInfo {
|
|
|
+ audio?: LocalStream;
|
|
|
+ video?: LocalStream;
|
|
|
+ videoSmall?: LocalStream;
|
|
|
+ screen?: LocalStream;
|
|
|
+ videoProfile?: LocalProfileManager;
|
|
|
+ screenProfile?: LocalProfileManager;
|
|
|
+}
|
|
|
+
|
|
|
+declare enum PublishType {
|
|
|
+ Add = "add",
|
|
|
+ Delete = "delete",
|
|
|
+ Replace = "replace",
|
|
|
+ Stop = "stop",
|
|
|
+ UnPublish = "unpublish"
|
|
|
+}
|
|
|
+
|
|
|
+declare interface PublishUser {
|
|
|
+ callid: string;
|
|
|
+ clientrole?: string;
|
|
|
+ displayname: string;
|
|
|
+ subscribe?: {
|
|
|
+ pullstreamurl: string;
|
|
|
+ };
|
|
|
+ pubid?: string;
|
|
|
+ tracks?: TrackInfo[];
|
|
|
+ userid: string;
|
|
|
+ sessionid?: string;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface ReconnectData {
|
|
|
+ role?: RoleForReconnectData;
|
|
|
+ auth?: SendPackageAuthInfo;
|
|
|
+ publish?: {
|
|
|
+ users: [PublishInfo];
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+declare interface RefreshInfo {
|
|
|
+ pushstreamurl?: string;
|
|
|
+ users?: RefreshUser[];
|
|
|
+}
|
|
|
+
|
|
|
+declare interface RefreshUrlResult extends SignalingResult {
|
|
|
+ pushstreamurl?: string;
|
|
|
+ users?: RefreshUser[];
|
|
|
+}
|
|
|
+
|
|
|
+declare interface RefreshUser {
|
|
|
+ userid: string;
|
|
|
+ subscribe: {
|
|
|
+ pullstreamurl: string;
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+declare interface RemoteMediaTrackInfo extends MediaTrackInfo {
|
|
|
+ subscribeState?: RemoteTrackSubscribeState;
|
|
|
+}
|
|
|
+
|
|
|
+declare class RemoteStreamInfo extends default_2<StreamListener> {
|
|
|
+ /**
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
+ static logName: string;
|
|
|
+ protected audioInfo: RemoteMediaTrackInfo;
|
|
|
+ protected videoLargeInfo: RemoteMediaTrackInfo;
|
|
|
+ protected videoSmallInfo: RemoteMediaTrackInfo;
|
|
|
+ protected screenInfo: RemoteMediaTrackInfo;
|
|
|
+ protected dataInfo: RemoteMediaTrackInfo;
|
|
|
+ protected audioVolume: number;
|
|
|
+ protected audioMuted: boolean;
|
|
|
+ protected userStatus?: DeviceStatus;
|
|
|
+ constructor();
|
|
|
+ /**
|
|
|
+ * 远端流音频轨道信息
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ getAudioInfo(): RemoteMediaTrackInfo;
|
|
|
+ /**
|
|
|
+ * 远端流视频轨道信息
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ getVideoSmallInfo(): RemoteMediaTrackInfo;
|
|
|
+ /**
|
|
|
+ * 远端流视频轨道信息
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ getVideoLargeInfo(): RemoteMediaTrackInfo;
|
|
|
+ /**
|
|
|
+ * 远端流屏幕共享轨道信息
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ getScreenInfo(): RemoteMediaTrackInfo;
|
|
|
+ getDataInfo(): RemoteMediaTrackInfo;
|
|
|
+ get subscribingInfos(): RemoteMediaTrackInfo[];
|
|
|
+ get hasTrack(): boolean;
|
|
|
+ /**
|
|
|
+ * 远端流是否包含音频轨道
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ get hasAudio(): boolean;
|
|
|
+ /**
|
|
|
+ * 远端流是否包含视频轨道
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ get hasVideo(): boolean;
|
|
|
+ /**
|
|
|
+ * 远端流是否包含视频大流轨道
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ get hasVideoLarge(): boolean;
|
|
|
+ /**
|
|
|
+ * 远端流是否包含视频小流轨道
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ get hasVideoSmall(): boolean;
|
|
|
+ /**
|
|
|
+ * 远端流是否包含屏幕共享轨道
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ get hasScreen(): boolean;
|
|
|
+ get hasData(): boolean;
|
|
|
+ /**
|
|
|
+ * 是否订阅远端流音频轨道
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ get isAudioSubscribed(): boolean;
|
|
|
+ get isAudioSubscribing(): boolean;
|
|
|
+ /**
|
|
|
+ * 是否订阅远端流视频轨道
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ get isVideoSubscribed(): boolean;
|
|
|
+ get isVideoSubscribing(): boolean;
|
|
|
+ /**
|
|
|
+ * 是否订阅远端流视频大流轨道
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ get isVideoLargeSubscribed(): boolean;
|
|
|
+ get isVideoLargeSubscribing(): boolean;
|
|
|
+ /**
|
|
|
+ * 是否订阅远端流视频小流轨道
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ get isVideoSmallSubscribed(): boolean;
|
|
|
+ get isVideoSmallSubscribing(): boolean;
|
|
|
+ /**
|
|
|
+ * 是否订阅远端流屏幕共享轨道
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ get isScreenSubscribed(): boolean;
|
|
|
+ get isScreenSubscribing(): boolean;
|
|
|
+ get isDataSubscribed(): boolean;
|
|
|
+ get isDataSubscribing(): boolean;
|
|
|
+ get audioCodec(): CodecType;
|
|
|
+ get videoCodec(): CodecType;
|
|
|
+ get audioTrackInfo(): AliRtcAudioTrack;
|
|
|
+ get videoTrackInfo(): AliRtcVideoTrack;
|
|
|
+ updateTracks(tracks?: TrackInfo[]): UpdateTracksResult;
|
|
|
+ protected updateRemoteTrackSsrc(audioSsrc: string, videoLargeSsrc: string, videoSmallSsrc: string, screenSsrc: string, dataSsrc: string): void;
|
|
|
+ markRemoteTrackSubscribing(option: SubscribeOptions): any;
|
|
|
+ updateRemoteTrackSubState(option: SubscribeOptions): any;
|
|
|
+ /**
|
|
|
+ * 更新远端用户设备状态
|
|
|
+ * @param status
|
|
|
+ * @returns {boolean} 状态改变返回true,否则返回false
|
|
|
+ */
|
|
|
+ updateRemoteUserDeviceStatus(status: string): boolean;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface RemoteSubscribeOptions {
|
|
|
+ remoteUser: RemoteUser;
|
|
|
+ options: SubscribeOptions;
|
|
|
+}
|
|
|
+
|
|
|
+declare enum RemoteTrackSubscribeState {
|
|
|
+ NotSubscribe = 0,
|
|
|
+ Subscribing = 1,
|
|
|
+ Subscribed = 2
|
|
|
+}
|
|
|
+
|
|
|
+declare class RemoteUser extends User {
|
|
|
+ /**
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
+ static logName: string;
|
|
|
+ remoteCallid: string;
|
|
|
+ remoteUserInfo: AliRtcRemoteUserInfo;
|
|
|
+ protected localUser?: LocalUser;
|
|
|
+ protected lastPubId: string;
|
|
|
+ protected stream?: RemoteStream;
|
|
|
+ protected screenStream?: RemoteStream;
|
|
|
+ private viewMap;
|
|
|
+ private audioTrack?;
|
|
|
+ private audioElement?;
|
|
|
+ protected subscribed: boolean;
|
|
|
+ protected mediaStream?: MediaStream;
|
|
|
+ protected secondaryMediaStream?: MediaStream;
|
|
|
+ protected prevSubConfig?: SubConfig;
|
|
|
+ protected signalingManager: SignalingManager;
|
|
|
+ protected slsReporter: SLSReporter;
|
|
|
+ private wantSubAudio;
|
|
|
+ private wantSubVideo;
|
|
|
+ private wantSubScreen;
|
|
|
+ private defaultVideoStreamType;
|
|
|
+ private audioMuted;
|
|
|
+ private playoutVolume;
|
|
|
+ private playoutGainNode?;
|
|
|
+ private audioSubState;
|
|
|
+ private videoSubState;
|
|
|
+ private videoLargeSubState;
|
|
|
+ private videoSmallSubState;
|
|
|
+ private screenSubState;
|
|
|
+ private dataSubState;
|
|
|
+ private dc;
|
|
|
+ private dcMsgWaitingPieces;
|
|
|
+ streamInfo: RemoteStreamInfo;
|
|
|
+ private _streamUrl;
|
|
|
+ private parameter;
|
|
|
+ private monitorTimerId?;
|
|
|
+ private monitorDataCache;
|
|
|
+ private trackTraceIdMap;
|
|
|
+ constructor(config: RemoteUserConfig);
|
|
|
+ get streamUrl(): string;
|
|
|
+ set streamUrl(value: string);
|
|
|
+ isWantSubAudio(): boolean;
|
|
|
+ setWantSubAudio(value: boolean): void;
|
|
|
+ isWantSubVideo(): boolean;
|
|
|
+ setWantSubVideo(value: boolean): void;
|
|
|
+ isWantSubScreen(): boolean;
|
|
|
+ setWantSubScreen(value: boolean): void;
|
|
|
+ setRemoteDefaultVideoStreamType(type: AliRtcVideoStreamType): void;
|
|
|
+ setAudioMuted(value: boolean): void;
|
|
|
+ getAudioElement(): HTMLAudioElement | undefined;
|
|
|
+ private handleAudioContextSuspended;
|
|
|
+ setPlayoutVolume(value: number): void;
|
|
|
+ getAudioMuted(): boolean;
|
|
|
+ get hasAudioTrack(): boolean;
|
|
|
+ get hasVideoTrack(): boolean;
|
|
|
+ get hasVideoLargeTrack(): boolean;
|
|
|
+ get hasVideoSmallTrack(): boolean;
|
|
|
+ get hasScreenTrack(): boolean;
|
|
|
+ get isAudioSubscribing(): boolean;
|
|
|
+ get isVideoSubscribing(): boolean;
|
|
|
+ get isVideoLargeSubscribing(): boolean;
|
|
|
+ get isVideoSmallSubscribing(): boolean;
|
|
|
+ get isScreenSubscribing(): boolean;
|
|
|
+ get isDataSubscribing(): boolean;
|
|
|
+ get audioEnabled(): boolean;
|
|
|
+ get videoEnabled(): boolean;
|
|
|
+ get screenEnabled(): boolean;
|
|
|
+ get getAudioTrack(): MediaStreamAudioTrack | undefined;
|
|
|
+ get getCameraStream(): RemoteStream | undefined;
|
|
|
+ get getScreenStream(): RemoteStream | undefined;
|
|
|
+ setViewConfig(view: AliRtcLocalView, track: AliRtcVideoTrack): void;
|
|
|
+ /**
|
|
|
+ * 销毁
|
|
|
+ * @returns {Promise<void>}
|
|
|
+ */
|
|
|
+ clear(needStopSub?: boolean): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 更新远端用户的设备状态
|
|
|
+ * @param {string} status
|
|
|
+ * @returns {void}
|
|
|
+ */
|
|
|
+ updateRemoteUserDeviceStatus(status: string): void;
|
|
|
+ /**
|
|
|
+ * 更新远端用户的推流状态,已经停止推流的 tracks 要 delete,或者整体 stop
|
|
|
+ * @param {string} callid
|
|
|
+ * @param {string} pullStreamUrl
|
|
|
+ * @param {TrackInfo[]} tracks
|
|
|
+ * @returns {Promise<TrackChangeState>}
|
|
|
+ */
|
|
|
+ updateRemoteTracks(callid: string, pullStreamUrl: string, _pubid: string, tracks?: TrackInfo[]): Promise<UpdateTracksResult>;
|
|
|
+ /**
|
|
|
+ * 订阅远端流
|
|
|
+ * @param {SubscribeOptions} options
|
|
|
+ * @returns {Promise<void>} 返回可播放的 MediaStream,可能为空。如果同时订阅了主流和辅流,只会返回主流对应的 MediaStream
|
|
|
+ */
|
|
|
+ subscribe(options?: SubscribeOptions, reason?: SubscribeReason, startTs?: number): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 订阅远端流
|
|
|
+ * @param {SubscribeOptions} options 订阅配置
|
|
|
+ * @param {boolean} secondary 是否订阅辅流
|
|
|
+ * @returns {Promise<SubscribeResult>}
|
|
|
+ */
|
|
|
+ private subscribeProxy;
|
|
|
+ /**
|
|
|
+ * 移除对某些轨道的订阅
|
|
|
+ * @param {UnSubscribeOptions} options 取消订阅轨道配置
|
|
|
+ * @returns {Promise<SubscribeResult>}
|
|
|
+ */
|
|
|
+ private subscribeDeleteTracks;
|
|
|
+ /**
|
|
|
+ * 移除对某些轨道的订阅
|
|
|
+ * @param {Partial<ISubConfigItem>} deleteTrack 删除订阅配置
|
|
|
+ * @returns {Promise<SubscribeResult>}
|
|
|
+ */
|
|
|
+ private subscribeDeleteProxy;
|
|
|
+ /**
|
|
|
+ * 用保存的订阅参数恢复订阅
|
|
|
+ */
|
|
|
+ restore(): void;
|
|
|
+ resumeAudio(): Promise<void>;
|
|
|
+ resumeVideo(videoTrack?: AliRtcVideoTrack): Promise<void>;
|
|
|
+ resumePlay(): void;
|
|
|
+ /**
|
|
|
+ * 停止订阅远端流
|
|
|
+ * @param {string} userId
|
|
|
+ * @param {UnSubscribeOptions} options
|
|
|
+ * @returns {Promise<void>}
|
|
|
+ */
|
|
|
+ stopSubscribe(options?: UnSubscribeOptions): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 停止对某个拉流 URL 的订阅
|
|
|
+ * @param {url} pullStreamUrl
|
|
|
+ * @returns {Promise<SubscribeResult>}
|
|
|
+ */
|
|
|
+ private doStopSubscribe;
|
|
|
+ private updateStream;
|
|
|
+ private updateScreenStream;
|
|
|
+ private clearStream;
|
|
|
+ private clearScreenStream;
|
|
|
+ private onDataChannelMessage;
|
|
|
+ private onDataChannelError;
|
|
|
+ private dataChannelConnected;
|
|
|
+ private subscribeDataChannel;
|
|
|
+ private subscribeStopDataChannel;
|
|
|
+ getRetryOptions(): RemoteSubscribeOptions | undefined;
|
|
|
+ /**
|
|
|
+ * 尝试更新订阅
|
|
|
+ * 1. 需要新增订阅的情况:想要订阅 & 没有正在订阅 & 远端有流
|
|
|
+ */
|
|
|
+ updateSubscribe(reason: SubscribeReason): {
|
|
|
+ addOption: SubscribeOptions;
|
|
|
+ deleteOption: SubscribeOptions;
|
|
|
+ };
|
|
|
+ private handleAutoPlayFailed;
|
|
|
+ private handleAudioPaused;
|
|
|
+ private handleVideoPlayFailded;
|
|
|
+ private playAudio;
|
|
|
+ stopPlayAudio(): void;
|
|
|
+ playAll(isScreen?: boolean, isReplace?: boolean): void;
|
|
|
+ /**
|
|
|
+ * 播放
|
|
|
+ */
|
|
|
+ private play;
|
|
|
+ stopPlayAll(isScreen?: boolean): void;
|
|
|
+ /**
|
|
|
+ * 是否开启声音
|
|
|
+ * @param {boolean} enable
|
|
|
+ * @returns {void}
|
|
|
+ */
|
|
|
+ toggleAudio(enable?: boolean): void;
|
|
|
+ /**
|
|
|
+ * 是否开启画面
|
|
|
+ * @param {boolean} enable
|
|
|
+ * @returns {void}
|
|
|
+ */
|
|
|
+ toggleVideo(enable?: boolean): void;
|
|
|
+ /**
|
|
|
+ * 是否开启画面
|
|
|
+ * @param {boolean} enable
|
|
|
+ * @returns {void}
|
|
|
+ */
|
|
|
+ toggleScreen(enable?: boolean): void;
|
|
|
+ getStats(): Promise<{
|
|
|
+ audio: AliRtcRemoteAudioStats[];
|
|
|
+ video: AliRtcRemoteVideoStats[];
|
|
|
+ }>;
|
|
|
+ /**
|
|
|
+ * 开启音量检测
|
|
|
+ * @param {number} interval 时间间隔
|
|
|
+ */
|
|
|
+ enableAudioVolumeIndication(interval: number): void;
|
|
|
+ private reportSubscribeMonitor;
|
|
|
+ private startStreamMonitor;
|
|
|
+ /**
|
|
|
+ * 停止本地流数据采集
|
|
|
+ */
|
|
|
+ private stopStreamMonitor;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface RemoteUserConfig {
|
|
|
+ userId: string;
|
|
|
+ displayName: string;
|
|
|
+ rtsManager: RtsManager;
|
|
|
+ usersViewMap: {
|
|
|
+ [key: string]: RemoteUserViewMap;
|
|
|
+ };
|
|
|
+ slsReporter: SLSReporter;
|
|
|
+ signalingManager: SignalingManager;
|
|
|
+ localUser?: LocalUser;
|
|
|
+ audioVolumeIndicationInterval: number;
|
|
|
+ playoutVolume: number;
|
|
|
+ parameter: {
|
|
|
+ [key: string]: any;
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+declare interface RemoteUserMap {
|
|
|
+ [userId: string]: RemoteUser;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface RemoteUserStatus {
|
|
|
+ userid: string;
|
|
|
+ status: string;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface RemoteUserViewMap {
|
|
|
+ cameraViews: HTMLVideoElement[];
|
|
|
+ screenViews: HTMLVideoElement[];
|
|
|
+}
|
|
|
+
|
|
|
+declare interface RoleForReconnectData {
|
|
|
+ channelprofile?: AliRtcSdkChannelProfile;
|
|
|
+ clientrole?: AliRtcSdkClientRole;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * RoomServerMessageCenter支持的事件
|
|
|
+ */
|
|
|
+declare interface RoomServerListener {
|
|
|
+ onJoinChannelResult: (data: any) => void;
|
|
|
+ onPublishResult: (code: number, tid: string, description: string) => void;
|
|
|
+ onNotifyJoin: (users: JoinInfo[]) => void;
|
|
|
+ onNotifyStatus: (users: RemoteUserStatus[]) => void;
|
|
|
+ onLeaveResult: (code: number, tid: string) => void;
|
|
|
+ onRoleUpdateResult: (code: number, tid: string, description: string) => void;
|
|
|
+ onRefreshUrlResult: (data: any) => void;
|
|
|
+ onNotifyLeave: (users: LeaveInfo[]) => void;
|
|
|
+ onNotifyPublish: (users: PublishUser[]) => void;
|
|
|
+ onStatusReport: (code: number, tid: string, description: string) => void;
|
|
|
+ onBye: (reason: AliRtcOnByeType, description: string) => void;
|
|
|
+ onKeepAliveRsp: () => void;
|
|
|
+ onConnectFail: (err: AliRtcError) => void;
|
|
|
+ onNetworkError: (err: AliRtcError) => void;
|
|
|
+ onAuthInvalid: () => void;
|
|
|
+ onReconnectStart: () => void;
|
|
|
+ onReconnectFail: (err: AliRtcError) => void;
|
|
|
+ onReconnectSuccess: (users: JoinInfo[]) => void;
|
|
|
+ onError: (err: AliRtcError) => void;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * RoomServer消息中心
|
|
|
+ * 负责发送和接收信令数据,消息重发、回复Response
|
|
|
+ */
|
|
|
+declare class RoomServerMessageCenter extends default_2<RoomServerListener> {
|
|
|
+ static logName: string;
|
|
|
+ protected authInfo: AliRtcAuthInfo;
|
|
|
+ protected userName: string;
|
|
|
+ protected channelProfile: AliRtcSdkChannelProfile;
|
|
|
+ protected clientRole: AliRtcSdkClientRole;
|
|
|
+ private slsReporter;
|
|
|
+ protected wsClient: Socket;
|
|
|
+ protected packageCreater: PackageCreater;
|
|
|
+ protected keepAliveTimer: number;
|
|
|
+ protected packageCache: Map<string, ISendPackage>;
|
|
|
+ protected isFirstConnect: boolean;
|
|
|
+ protected aliveChecker: number;
|
|
|
+ protected reconnectData?: ReconnectData;
|
|
|
+ constructor(authInfo: AliRtcAuthInfo, userName: string, channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, slsReporter: SLSReporter, maxConnectRetryCount?: number);
|
|
|
+ get retryCount(): number;
|
|
|
+ /**
|
|
|
+ * 开始连接信令
|
|
|
+ * @param roomserverurl
|
|
|
+ */
|
|
|
+ start(roomserverurl: string): void;
|
|
|
+ /**
|
|
|
+ * 开始心跳计时器,并自动发送心跳包
|
|
|
+ */
|
|
|
+ startKeepAlive(): void;
|
|
|
+ /**
|
|
|
+ * 停止心跳计时器
|
|
|
+ */
|
|
|
+ stopKeepAlive(): void;
|
|
|
+ /**
|
|
|
+ * 发送入会、重连前所缓存信息
|
|
|
+ */
|
|
|
+ sendPkgCache(): void;
|
|
|
+ /**
|
|
|
+ * 发送离开房间
|
|
|
+ */
|
|
|
+ leave(): void;
|
|
|
+ /**
|
|
|
+ * 透明通道消息上报
|
|
|
+ * @param status
|
|
|
+ */
|
|
|
+ reportStatus(status: string): void;
|
|
|
+ /**
|
|
|
+ * 发送推流消息
|
|
|
+ */
|
|
|
+ publish(_pubInfo: PublishInfo): void;
|
|
|
+ /**
|
|
|
+ * 更新角色
|
|
|
+ */
|
|
|
+ roleUpdate(role: string): void;
|
|
|
+ /**
|
|
|
+ * 更新推拉流地址
|
|
|
+ * @param {RefreshInfo} info
|
|
|
+ */
|
|
|
+ refreshUrl(info: RefreshInfo): void;
|
|
|
+ refreshAuthInfo(authInfo: AliRtcAuthInfo): void;
|
|
|
+ /**
|
|
|
+ * 关闭websocket连接,并销毁
|
|
|
+ */
|
|
|
+ close(): void;
|
|
|
+ /**
|
|
|
+ * 通过此方法发送数据到业务信令
|
|
|
+ * 此方法会自动保存发送的package,并做重发.
|
|
|
+ * response包不要通过此方法发送
|
|
|
+ * @param pkg
|
|
|
+ */
|
|
|
+ protected sendPackage(pkg: ISendPackage): void;
|
|
|
+ /**
|
|
|
+ * 更新重连 payload
|
|
|
+ * @param {ReconnectData} reconnectData
|
|
|
+ */
|
|
|
+ updateReconnectData(reconnectData?: ReconnectData): void;
|
|
|
+ /**
|
|
|
+ * 收到websocket连接成功的消息
|
|
|
+ * ws连接建立成功后立刻发送join消息
|
|
|
+ */
|
|
|
+ protected onOpen(): void;
|
|
|
+ /**
|
|
|
+ * 收到业务信令消息
|
|
|
+ * @param event
|
|
|
+ */
|
|
|
+ protected onMessage(event: MessageEvent): void;
|
|
|
+ /**
|
|
|
+ * 收到错误消息
|
|
|
+ * @param event
|
|
|
+ */
|
|
|
+ protected onError(event: Event): void;
|
|
|
+ /**
|
|
|
+ * 连接失败
|
|
|
+ */
|
|
|
+ protected onConnectFail(): void;
|
|
|
+ /**
|
|
|
+ * 鉴权失败
|
|
|
+ */
|
|
|
+ protected onAuthInvalid(): void;
|
|
|
+ /**
|
|
|
+ * 网络异常
|
|
|
+ */
|
|
|
+ protected onNetworkError(): void;
|
|
|
+ /**
|
|
|
+ * 收到websocket断开消息
|
|
|
+ * @param event
|
|
|
+ */
|
|
|
+ protected onClose(event: CloseEvent): void;
|
|
|
+ protected onKeepAliveRsp(): void;
|
|
|
+ protected onReconnectStart(): void;
|
|
|
+ protected onReconnectFail(): void;
|
|
|
+ /**
|
|
|
+ * 处理 Keepalive 心跳,加速判断网络异常
|
|
|
+ */
|
|
|
+ protected checkAlive(): void;
|
|
|
+ /**
|
|
|
+ * 处理收到的业务信令
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ protected onRecvMessage(response: any): void;
|
|
|
+ /**
|
|
|
+ * 收到入会消息的response
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ protected onJoinResult(response: any): void;
|
|
|
+ /**
|
|
|
+ * 收到离开消息的response
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ protected onLeaveResult(response: any): void;
|
|
|
+ /**
|
|
|
+ * 收到publish消息的response
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ protected onPublishResult(response: any): void;
|
|
|
+ /**
|
|
|
+ * 收到roleUpdate消息的response
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ protected onRoleUpdateResult(response: any): void;
|
|
|
+ /**
|
|
|
+ * 收到 refreshurl 消息的response
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ protected onRefreshUrlResult(response: any): void;
|
|
|
+ /**
|
|
|
+ * 收到重联消息的response
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ protected onReconnectResult(response: any): void;
|
|
|
+ /**
|
|
|
+ * 收到业务信令下发的消息
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ protected onNotifyJoin(response: any): void;
|
|
|
+ /**
|
|
|
+ * 收到业务信令下发的透明通道消息
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ protected onNotifyStatus(response: any): void;
|
|
|
+ /**
|
|
|
+ * 收到远端用户离开的通知
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ protected onNotifyLeave(response: any): void;
|
|
|
+ /**
|
|
|
+ * 收到远端用户推流的通知
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ protected onNotifyPublish(response: any): void;
|
|
|
+ /**
|
|
|
+ * 收到statusreport的response
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ protected onStatusReport(response: any): void;
|
|
|
+ /**
|
|
|
+ * 收到被踢出频道的消息
|
|
|
+ * @param {any} response
|
|
|
+ */
|
|
|
+ protected onBye(response: any): void;
|
|
|
+}
|
|
|
+
|
|
|
+declare class RoomServerSignaling extends default_2<RoomServerListener> {
|
|
|
+ /**
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
+ static logName: string;
|
|
|
+ protected messageCenter?: RoomServerMessageCenter;
|
|
|
+ protected authInfo?: AliRtcAuthInfo;
|
|
|
+ protected userName?: string;
|
|
|
+ protected channelProfile: AliRtcSdkChannelProfile;
|
|
|
+ protected clientRole: AliRtcSdkClientRole;
|
|
|
+ private slsReporter;
|
|
|
+ protected reconnectData?: ReconnectData;
|
|
|
+ protected roomServerUri: string;
|
|
|
+ constructor(channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, slsReporter: SLSReporter, env?: AliRtcEnv);
|
|
|
+ /**
|
|
|
+ * 更新重连数据
|
|
|
+ * @param {ReconnectData} reconnectData
|
|
|
+ */
|
|
|
+ private updateReconnectData;
|
|
|
+ /**
|
|
|
+ * 释放资源
|
|
|
+ */
|
|
|
+ reset(): void;
|
|
|
+ /**
|
|
|
+ * 加入频道
|
|
|
+ * @param {AliRtcAuthInfo} authInfo
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ join(authInfo: AliRtcAuthInfo, userName: string, maxConnectRetryCount?: number): Promise<JoinResult>;
|
|
|
+ /**
|
|
|
+ * 离开频道
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ leave(): Promise<SignalingResult>;
|
|
|
+ /**
|
|
|
+ * 开始推流
|
|
|
+ * @param pubInfo
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ publish(pubInfo: PublishInfo): Promise<SignalingResult>;
|
|
|
+ roleUpdate(role: AliRtcSdkClientRole): Promise<SignalingResult>;
|
|
|
+ setChannelProfile(channelProfile: AliRtcSdkChannelProfile): void;
|
|
|
+ /**
|
|
|
+ * 更新推流地址
|
|
|
+ */
|
|
|
+ refreshUrl(info: RefreshInfo): Promise<RefreshUrlResult>;
|
|
|
+ /**
|
|
|
+ * 上报设备状态
|
|
|
+ * @param status
|
|
|
+ */
|
|
|
+ reportStatus(status: string): Promise<void>;
|
|
|
+ protected handleSignalError(code: number, description: string, errorCode?: AliRtcErrorCode): AliRtcError;
|
|
|
+ refreshAuthInfo(authInfo: AliRtcAuthInfo): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 初始化MessageCenter,增加事件监听
|
|
|
+ */
|
|
|
+ protected initMessageCenter(): void;
|
|
|
+}
|
|
|
+
|
|
|
+declare class RtsManager extends default_2<RtsManagerEventListener> {
|
|
|
+ /**
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
+ static logName: string;
|
|
|
+ private rts;
|
|
|
+ private encodedInsertableStreams;
|
|
|
+ private audioRedEnabled;
|
|
|
+ private localStreamManager;
|
|
|
+ private slsReporter;
|
|
|
+ private _rtsReconnecting;
|
|
|
+ private _rtsPeerConnectionType;
|
|
|
+ private connecting;
|
|
|
+ private connected;
|
|
|
+ private _pcTraceId;
|
|
|
+ private _localJoinTime;
|
|
|
+ private connectionResolve?;
|
|
|
+ private connectingPromise?;
|
|
|
+ private dcResolve?;
|
|
|
+ private dcReject?;
|
|
|
+ private dcConnectingPromise?;
|
|
|
+ private _publishingTracks;
|
|
|
+ private parameter;
|
|
|
+ constructor(localStreamManager: LocalStreamManager, slsReporter: SLSReporter, parameter: Parameter);
|
|
|
+ private addRTSListener;
|
|
|
+ /**
|
|
|
+ * 更新鉴权信息,传入一个新的带鉴权的 URL,RTS 会去除鉴权信息做更新
|
|
|
+ * @param newUrlWithAuth
|
|
|
+ */
|
|
|
+ updateAuth(newUrlWithAuth: string): void;
|
|
|
+ get pcTraceId(): string;
|
|
|
+ set localJoinTime(time: number);
|
|
|
+ setEncodedInsertableStreams(enable: boolean): void;
|
|
|
+ setAudioRedEnabled(enable: boolean): void;
|
|
|
+ clear(): void;
|
|
|
+ private startConnect;
|
|
|
+ private setConnected;
|
|
|
+ get isConnecting(): boolean;
|
|
|
+ get isConnected(): boolean;
|
|
|
+ get publishingTracks(): TrackInfo[];
|
|
|
+ private getPubMsid;
|
|
|
+ private updatePublishingTracks;
|
|
|
+ private httpPublish;
|
|
|
+ waitPublishSender(streamUrl: string, isAudio?: boolean, msid?: string): Promise<any>;
|
|
|
+ getPublishVideoStats(streamUrl: string, msid?: string): Promise<unknown>;
|
|
|
+ getPublishAudioStats(streamUrl: string, msid?: string): Promise<unknown>;
|
|
|
+ publishAdd(streamUrl: string, stream: LocalStream, callId: string, extra?: PublishExtraParams, isResume?: boolean, waitSender?: boolean, reason?: PublishReason): Promise<string>;
|
|
|
+ publishDelete(streamUrl: string, options: PublishOptions): Promise<string>;
|
|
|
+ publishReplace(streamUrl: string, stream: LocalStream, extra?: PublishExtraParams): Promise<string>;
|
|
|
+ publishStop(streamUrl: string): Promise<string>;
|
|
|
+ publishAddDataChannel(streamUrl: string): Promise<any>;
|
|
|
+ publishStopDataChannel(streamUrl: string, datachannel: any): Promise<void>;
|
|
|
+ unpublish(): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 获取 sub/subAdd config
|
|
|
+ * @param {ISubscribeConfig | ISubConfigItem} options
|
|
|
+ * @returns {Omit<ISignalConfig | ISubConfigItem, 'url'>}
|
|
|
+ */
|
|
|
+ private getSubConfig;
|
|
|
+ private httpSubscribe;
|
|
|
+ private subscribeAdd;
|
|
|
+ subscribeDelete(subscribeOptions: RemoteSubscribeOptions): Promise<{
|
|
|
+ url: string;
|
|
|
+ stream: any;
|
|
|
+ } | undefined>;
|
|
|
+ subscibeStop(streamUrl: string): Promise<void>;
|
|
|
+ subscribeAddDataChannel(streamUrl: string): Promise<any>;
|
|
|
+ subscribeStopDatachannel(streamUrl: string, datachannel: any): Promise<any>;
|
|
|
+ publish(streamUrl: string, callId: string, isResume?: boolean, reason?: PublishReason): Promise<{
|
|
|
+ traceId: string;
|
|
|
+ l1ip?: string;
|
|
|
+ }>;
|
|
|
+ private reportSubscribeLatency;
|
|
|
+ subscribe(remoteSubscribeOptions: RemoteSubscribeOptions, reason: SubscribeReason, callId: string, remoteCallId: string, startTs: number): Promise<any>;
|
|
|
+ getSubscribeVideoStats(streamUrl: string, msid?: string): Promise<unknown>;
|
|
|
+ getSubscribeAudioStats(streamUrl: string, msid?: string): Promise<unknown>;
|
|
|
+ getStreamByMsid(config: any): LocalStream | RemoteStream;
|
|
|
+ getDatachannelByMsid(config: {
|
|
|
+ url: string;
|
|
|
+ msid?: string;
|
|
|
+ }): any;
|
|
|
+ getPCStats(): Promise<any>;
|
|
|
+ sendSEI(streamUrl: string, data: ArrayBuffer, repeatCount: number, payloadType: number): Promise<void>;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface RtsManagerEventListener {
|
|
|
+ reconnecting: (type: RtsPeerConnectionType) => {};
|
|
|
+ disconnected: () => {};
|
|
|
+ connected: (isReconnected: boolean, type: RtsPeerConnectionType) => {};
|
|
|
+ subscribeexceeds: () => {};
|
|
|
+ seimessage: (url: string, payloadType: number, data: ArrayBuffer) => {};
|
|
|
+}
|
|
|
+
|
|
|
+declare enum RtsPeerConnectionType {
|
|
|
+ PUBLISH = "publish",
|
|
|
+ SUBSCRIBE = "subscribe"
|
|
|
+}
|
|
|
+
|
|
|
+declare interface SendPackageAuthInfo {
|
|
|
+ timestamp: number;
|
|
|
+ nonce?: string;
|
|
|
+ token: string;
|
|
|
+ tokenrole: AliRtcSdkTokenRole;
|
|
|
+}
|
|
|
+
|
|
|
+declare class SignalingManager extends default_2<RoomServerListener> {
|
|
|
+ /**
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
+ static logName: string;
|
|
|
+ protected signaling?: RoomServerSignaling;
|
|
|
+ protected authInfo?: AliRtcAuthInfo;
|
|
|
+ protected userName?: string;
|
|
|
+ protected channelProfile: AliRtcSdkChannelProfile;
|
|
|
+ protected clientRole: AliRtcSdkClientRole;
|
|
|
+ protected env: AliRtcEnv;
|
|
|
+ protected maxConnectRetryCount?: number;
|
|
|
+ stsManager: StsManager;
|
|
|
+ private slsReporter;
|
|
|
+ constructor(channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, slsReporter: SLSReporter, env?: AliRtcEnv);
|
|
|
+ reset(): void;
|
|
|
+ /**
|
|
|
+ * 向业务信令发送入会
|
|
|
+ * @param {AliRtcAuthInfo} authInfo
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ join(authInfo: AliRtcAuthInfo, userName?: string, maxConnectRetryCount?: number, timeRecorder?: TimeRecorder): Promise<JoinResult>;
|
|
|
+ retryJoin(): void;
|
|
|
+ /**
|
|
|
+ * 向业务信令发送离会
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ leave(): Promise<SignalingResult>;
|
|
|
+ /**
|
|
|
+ * 推流
|
|
|
+ * @param pubInfo
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ publish(pubInfo: PublishInfo): Promise<SignalingResult>;
|
|
|
+ /**
|
|
|
+ * 通过透明通道发送设备状态
|
|
|
+ * @param {string} status
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ reportStatus(status: string): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 切换角色
|
|
|
+ * @param {AliRtcSdkClientRole} role
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ setClientRole(role: AliRtcSdkClientRole): Promise<SignalingResult | undefined>;
|
|
|
+ /**
|
|
|
+ * 切换模式
|
|
|
+ * @param {AliRtcSdkChannelProfile} channelProfile
|
|
|
+ */
|
|
|
+ setChannelProfile(channelProfile: AliRtcSdkChannelProfile): void;
|
|
|
+ /**
|
|
|
+ * 更新推流url
|
|
|
+ * @param {RefreshInfo} info
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ refreshUrl(info: RefreshInfo): Promise<RefreshUrlResult>;
|
|
|
+ refreshAuthInfo(authInfo: AliRtcRefreshAuthInfo): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 监听业务信令相关的事件
|
|
|
+ */
|
|
|
+ protected initSignaling(): void;
|
|
|
+ /**
|
|
|
+ * 收到心跳消息
|
|
|
+ */
|
|
|
+ protected onKeepAliveRsp(): void;
|
|
|
+ /**
|
|
|
+ * 收到远端用户入会消息
|
|
|
+ * @param {JoinInfo[]} users
|
|
|
+ */
|
|
|
+ protected onNotifyJoin(users: JoinInfo[]): void;
|
|
|
+ /**
|
|
|
+ * 收到远端用户的透明通道消息
|
|
|
+ * @param {RemoteUserStatus[]} users
|
|
|
+ */
|
|
|
+ protected onNotifyStatus(users: RemoteUserStatus[]): void;
|
|
|
+ /**
|
|
|
+ * 收到远端用户的离会消息
|
|
|
+ * @param {LeaveInfo[]} users
|
|
|
+ */
|
|
|
+ protected onNotifyLeave(users: LeaveInfo[]): void;
|
|
|
+ /**
|
|
|
+ * 收到远端用户推流状态变化消息
|
|
|
+ * @param {PublishInfo[]} users
|
|
|
+ */
|
|
|
+ protected onNotifyPublish(users: PublishUser[]): void;
|
|
|
+ /**
|
|
|
+ * 收到被踢掉消息
|
|
|
+ * @param {string} reason
|
|
|
+ * @param {string} description
|
|
|
+ */
|
|
|
+ protected onBye(reason: AliRtcOnByeType, description: string): void;
|
|
|
+ /**
|
|
|
+ * 收到连接失败消息
|
|
|
+ * @param {AliRtcError} err
|
|
|
+ */
|
|
|
+ protected onConnectFail(err: AliRtcError): void;
|
|
|
+ /**
|
|
|
+ * 收到网络异常消息
|
|
|
+ * @param {AliRtcError} err
|
|
|
+ */
|
|
|
+ protected onNetworkError(err: AliRtcError): void;
|
|
|
+ /**
|
|
|
+ * 收到网络异常消息
|
|
|
+ */
|
|
|
+ protected onAuthInvalid(): void;
|
|
|
+ protected onReconnectStart(): void;
|
|
|
+ /**
|
|
|
+ * 收到重连成功消息
|
|
|
+ * @param {JoinInfo[]} users
|
|
|
+ */
|
|
|
+ protected onReconnectSuccess(users: JoinInfo[]): void;
|
|
|
+ /**
|
|
|
+ * 收到重连失败消息
|
|
|
+ */
|
|
|
+ protected onReconnectFail(err: AliRtcError): void;
|
|
|
+ /**
|
|
|
+ * 收到错误消息
|
|
|
+ * @param {AliRtcError} err
|
|
|
+ */
|
|
|
+ protected onError(err: AliRtcError): void;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface SignalingResult {
|
|
|
+ tid: string;
|
|
|
+ code?: number;
|
|
|
+ message?: string;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 日志埋点类
|
|
|
+ * 每个埋点暴露对应的接口
|
|
|
+ */
|
|
|
+declare class SLSReporter {
|
|
|
+ private engine;
|
|
|
+ protected logClient: LogClient;
|
|
|
+ protected authInfo?: AliRtcAuthInfo;
|
|
|
+ private ntpClock;
|
|
|
+ private static staticClient;
|
|
|
+ private static getLogClient;
|
|
|
+ static reportOSSUpload(sessionId: string, date: string, responseCode?: number): void;
|
|
|
+ constructor(engine: WrappedAliRtcEngine);
|
|
|
+ private customFields;
|
|
|
+ /**
|
|
|
+ * 设置通用字段
|
|
|
+ * @param fields 字段键值对
|
|
|
+ */
|
|
|
+ setCustomFields(fields: {
|
|
|
+ [key: string]: any;
|
|
|
+ }): void;
|
|
|
+ /**
|
|
|
+ * 获取通用字段
|
|
|
+ * @param key 字段键
|
|
|
+ * @returns 字段值或undefined
|
|
|
+ */
|
|
|
+ getCustomField(key: string): any;
|
|
|
+ /**
|
|
|
+ * 开始建立连接
|
|
|
+ * @param authInfo
|
|
|
+ */
|
|
|
+ start(info: AliRtcAuthInfo): void;
|
|
|
+ updateToken(token: SLSSTSToken, ossToken?: OSSSTSToken): void;
|
|
|
+ /**
|
|
|
+ * 断开连接
|
|
|
+ */
|
|
|
+ stop(): void;
|
|
|
+ reportPublishMonitor(callId: string, traceId: string, msid: string, track: MediaStreamTrack | undefined, stats: any[]): void;
|
|
|
+ reportSubscribeMonitor(callId: string, remoteId: string, traceId: string, msid: string, stats: any[]): void;
|
|
|
+ reportNetworkMonitor(candidates: any[]): void;
|
|
|
+ /**
|
|
|
+ * 加入房间成功埋点
|
|
|
+ * @param {number} joinTime
|
|
|
+ * @param {number} result
|
|
|
+ * @param {string} tid
|
|
|
+ */
|
|
|
+ reportJoin(result: number, timeRecord: TimeRecorder, tid?: string): void;
|
|
|
+ /**
|
|
|
+ * Join 链接细节
|
|
|
+ */
|
|
|
+ reportJoinConnection(logInfo: LogInfo): void;
|
|
|
+ /**
|
|
|
+ * 用户离开频道事件埋点
|
|
|
+ * @param {number} leaveTime
|
|
|
+ * @param {number} result
|
|
|
+ * @param {string} tid
|
|
|
+ */
|
|
|
+ reportLeave(leaveTime: number, result: number, tid: string): void;
|
|
|
+ /**
|
|
|
+ * 推流事件上报
|
|
|
+ * @param {string} callid
|
|
|
+ * @param {boolean} isLargeVideo
|
|
|
+ * @param {boolean} isSmallVideo
|
|
|
+ * @param {boolean} isScreenShare
|
|
|
+ * @param {boolean} isAudio
|
|
|
+ * @param {number} result
|
|
|
+ * @param {string} tid
|
|
|
+ * @param {number} pubTime
|
|
|
+ */
|
|
|
+ reportPublish(isRepublish: boolean, url: string, callid: string, isLargeVideo: boolean, isSmallVideo: boolean, isScreenShare: boolean, isAudio: boolean, result: number | undefined, pcTraceId: string, traceId: string, startTime: number): void;
|
|
|
+ /**
|
|
|
+ * 首包上报
|
|
|
+ * @param {string} callid
|
|
|
+ * @param {number} startTime
|
|
|
+ * @param {number} publishTime
|
|
|
+ * @param {number} joinTime
|
|
|
+ * @param {string} tckid
|
|
|
+ * @param {string} pcTraceId
|
|
|
+ * @param {string} traceId
|
|
|
+ * @param {PublishReason} reason
|
|
|
+ */
|
|
|
+ reportPublishFirstPacket(isRepublish: boolean, callid: string, startTime: number, publishTime: number, joinTime: number, tckid: string, pcTraceId: string, traceId: string, reason: PublishReason): void;
|
|
|
+ /**
|
|
|
+ * 停止推流事件上报
|
|
|
+ * @param {string} callid
|
|
|
+ * @param {number} unpubTime
|
|
|
+ * @param {number} result
|
|
|
+ * @param {string} tid
|
|
|
+ */
|
|
|
+ reportUnpublish(callid: string, unpubTime: number, result: number, tid: string): void;
|
|
|
+ /**
|
|
|
+ * 订阅事件埋点
|
|
|
+ * @param {string} callid
|
|
|
+ * @param {string} remoteid
|
|
|
+ * @param {boolean} isLargeVideo
|
|
|
+ * @param {boolean} isSmallVideo
|
|
|
+ * @param {boolean} isScreenShare
|
|
|
+ * @param {boolean} isAudio
|
|
|
+ * @param {number} result
|
|
|
+ * @param {string} tid
|
|
|
+ * @param {number} subTime
|
|
|
+ */
|
|
|
+ reportSubscribe(callid: string, remoteid: string, isLargeVideo: boolean, isSmallVideo: boolean, isScreenShare: boolean, isAudio: boolean, result: number, tid: string, subTime: number, logInfo: LogInfo): void;
|
|
|
+ reportSubscribeFirstPacket(isResume: boolean, callid: string, remoteid: string, trackId: string, logInfo: LogInfo): void;
|
|
|
+ reportSubscribeFirstFrame(isResume: boolean, callid: string, remoteid: string, trackId: string, logInfo: LogInfo): void;
|
|
|
+ /**
|
|
|
+ * 停止订阅事件埋点
|
|
|
+ * @param {string} callid
|
|
|
+ * @param {string} remoteid
|
|
|
+ * @param {number} unsubTime
|
|
|
+ * @param {number} result
|
|
|
+ * @param {string} tid
|
|
|
+ */
|
|
|
+ reportUnsubscribe(callid: string, remoteid: string, unsubTime: number, result: number, tid: string): void;
|
|
|
+ reportMute(callid: string, enable: boolean, type: 'audio' | 'video' | 'screen'): void;
|
|
|
+ /**
|
|
|
+ * 更新角色埋点
|
|
|
+ * @param {string|undefined} or 旧的角色
|
|
|
+ * @param {string} nr 新的角色
|
|
|
+ */
|
|
|
+ reportRoleUpdate(or: string | undefined, nr: string): void;
|
|
|
+ /**
|
|
|
+ * 更新角色埋点
|
|
|
+ * @param {string|undefined} or 旧的角色
|
|
|
+ * @param {string} nr 新的角色
|
|
|
+ */
|
|
|
+ reportRoleUpdateResult(or: string | undefined, nr: string, ctm: number, result: number): void;
|
|
|
+ /**
|
|
|
+ * 设置camera videoprofile
|
|
|
+ */
|
|
|
+ reportVideoProfile(profile: string): void;
|
|
|
+ /**
|
|
|
+ * 设置screenshare videoprofile
|
|
|
+ */
|
|
|
+ reportScreenProfile(profile: string): void;
|
|
|
+ /**
|
|
|
+ * 错误事件埋点
|
|
|
+ * @param err
|
|
|
+ */
|
|
|
+ reportError(err: any): void;
|
|
|
+ /**
|
|
|
+ * 错误事件埋点
|
|
|
+ * @param err
|
|
|
+ */
|
|
|
+ reportWarning(msg: string): void;
|
|
|
+ reportRoomServerEvent(isRequest: boolean, type: string, requestId: string, content: any): void;
|
|
|
+ reportTranscodingError(result: number, taskid: string): void;
|
|
|
+ reportBye(result: number): void;
|
|
|
+ reportAudio(error: any, cost: number, deviceName: string): void;
|
|
|
+ reportScreen(error: any, cost: number): void;
|
|
|
+ reportScreenStop(error: any): void;
|
|
|
+ reportSwitchCamera(deviceId: string): void;
|
|
|
+ reportPublishProfile(trackId: string, logInfo: LogInfo): void;
|
|
|
+ reportSDKCreated(startTs: number): void;
|
|
|
+ reportJoinInvoked(authInfo: AliRtcAuthInfo): void;
|
|
|
+ reportJoinResult(error: any): void;
|
|
|
+ reportSTSResult(code: number, startTs: number): void;
|
|
|
+ reportLeaveInvoked(): void;
|
|
|
+ reportSEIMessage(payloadType: number, length: number, repeatCount: number, delay: number, isKey: boolean): void;
|
|
|
+ /**
|
|
|
+ * 接通耗时事件(12001)
|
|
|
+ * 用stage和status来区分接通过程中各个时间节点。
|
|
|
+ * @param state
|
|
|
+ * @param status
|
|
|
+ * @param calid
|
|
|
+ * @param tckid
|
|
|
+ */
|
|
|
+ reportConnectionLatencyEvent<Stage extends keyof ValidStatusMap>(stage: Stage, status: ValidStatusMap[Stage], calid: string, tckid: string, tm?: number, ntptm?: number, http?: boolean): void;
|
|
|
+ /**
|
|
|
+ * 日志埋点
|
|
|
+ * 在埋点中增加tm字段,表示发生埋点的客户端本地时间
|
|
|
+ * @param {any} param 埋点内容
|
|
|
+ */
|
|
|
+ protected log(param: any): void;
|
|
|
+ /**
|
|
|
+ * 将Object转换成string
|
|
|
+ * @param {any} data
|
|
|
+ * @returns {string}
|
|
|
+ */
|
|
|
+ protected data2String(data: any): string;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface SLSSTSToken {
|
|
|
+ access_key_id: string;
|
|
|
+ access_key_secret: string;
|
|
|
+ expiration: number;
|
|
|
+ log_store_debug: string;
|
|
|
+ log_store_stats: string;
|
|
|
+ project: string;
|
|
|
+ region_endpoint: string;
|
|
|
+ security_token: string;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface SLSToken {
|
|
|
+ access_key_id: string;
|
|
|
+ access_key_secret: string;
|
|
|
+ security_token: string;
|
|
|
+ region_endpoint: string;
|
|
|
+ project: string;
|
|
|
+ log_store_stats: string;
|
|
|
+ log_store_debug: string;
|
|
|
+ expiration: number;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Websocket类
|
|
|
+ */
|
|
|
+declare class Socket extends default_2<SocketListener> {
|
|
|
+ /**
|
|
|
+ * @ignore
|
|
|
+ */
|
|
|
+ static logName: string;
|
|
|
+ protected ws?: WebSocket;
|
|
|
+ protected socketStatus: CONNECTSTATUS;
|
|
|
+ protected wsUrl: string;
|
|
|
+ protected lastConnectStartTime: number;
|
|
|
+ protected maxConnectRetryCount: number;
|
|
|
+ connectRetryCount: number;
|
|
|
+ protected gotErr: boolean;
|
|
|
+ protected closedByInvoke: boolean;
|
|
|
+ protected isReconnecting: boolean;
|
|
|
+ protected networkAvailableChecked: boolean;
|
|
|
+ private reconnectTimeoutId;
|
|
|
+ constructor(maxConnectRetryCount?: number);
|
|
|
+ get connectUrl(): string;
|
|
|
+ /**
|
|
|
+ * 返回websocket连接的状态
|
|
|
+ */
|
|
|
+ get connectStatus(): CONNECTSTATUS;
|
|
|
+ /**
|
|
|
+ * 开始连接
|
|
|
+ * @param wsUrl
|
|
|
+ */
|
|
|
+ start(wsUrl: string): void;
|
|
|
+ /**
|
|
|
+ * 发送消息
|
|
|
+ * @param pkg
|
|
|
+ */
|
|
|
+ send(pkg: ISendPackage | IResponse): boolean;
|
|
|
+ /**
|
|
|
+ * 主动断开连接
|
|
|
+ */
|
|
|
+ close(): void;
|
|
|
+ reconnect(): void;
|
|
|
+ /**
|
|
|
+ * 连接成功
|
|
|
+ * @param event
|
|
|
+ */
|
|
|
+ protected onOpen(event: Event): void;
|
|
|
+ /**
|
|
|
+ * 收到消息
|
|
|
+ * @param event
|
|
|
+ */
|
|
|
+ protected onMessage(event: MessageEvent): void;
|
|
|
+ /**
|
|
|
+ * 收到错误
|
|
|
+ * @param event
|
|
|
+ */
|
|
|
+ protected onError(event: Event): void;
|
|
|
+ /**
|
|
|
+ * 连接断开
|
|
|
+ * @param event
|
|
|
+ */
|
|
|
+ protected onClose(event: CloseEvent): Promise<void>;
|
|
|
+ /**
|
|
|
+ * 初始化websocket
|
|
|
+ */
|
|
|
+ protected initWebSocket(): void;
|
|
|
+ /**
|
|
|
+ * 反初始化websocket
|
|
|
+ */
|
|
|
+ protected uninitWebsocket(): void;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Socket的支持的事件
|
|
|
+ */
|
|
|
+declare interface SocketListener {
|
|
|
+ onOpen: (event: Event) => void;
|
|
|
+ onMessage: (event: MessageEvent) => void;
|
|
|
+ onError: (event: Event) => void;
|
|
|
+ onClose: (event: CloseEvent) => void;
|
|
|
+ onConnectFail: () => void;
|
|
|
+ onAuthInvalid: () => void;
|
|
|
+ onNetworkError: () => void;
|
|
|
+ onReconnectStart: () => void;
|
|
|
+ onReconnectFail: (event: Event) => void;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface StopPreviewConfig {
|
|
|
+ videoElement?: HTMLVideoElement;
|
|
|
+ primary?: boolean;
|
|
|
+ screen?: boolean;
|
|
|
+}
|
|
|
+
|
|
|
+declare type StopPublishOptions = StreamOptions;
|
|
|
+
|
|
|
+declare interface StreamListener {
|
|
|
+ [DeviceStatusChange.Remote]: (event: DeviceStatusChangeType) => void;
|
|
|
+ error: (err: AliRtcError) => void;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface StreamOptions {
|
|
|
+ audio?: boolean;
|
|
|
+ video?: boolean;
|
|
|
+ screen?: boolean;
|
|
|
+ data?: boolean;
|
|
|
+}
|
|
|
+
|
|
|
+declare class StsManager extends default_2<StsManagerListener> {
|
|
|
+ static logName: string;
|
|
|
+ private env;
|
|
|
+ private authInfo?;
|
|
|
+ private timer?;
|
|
|
+ private slsReporter;
|
|
|
+ private expiration;
|
|
|
+ private skipTime;
|
|
|
+ constructor(slsReporter: SLSReporter, env: AliRtcEnv);
|
|
|
+ refreshAuthInfo(authInfo: AliRtcAuthInfo): void;
|
|
|
+ private requestToken;
|
|
|
+ startSTSUpdate(authInfo: AliRtcAuthInfo): void;
|
|
|
+ clear(): void;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface StsManagerListener {
|
|
|
+ onTokenUpdate: (ossToken: OSSToken, slsToken: SLSToken) => void;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface SubConfig {
|
|
|
+ isAudioSubscribing: boolean;
|
|
|
+ isVideoSubscribing: boolean;
|
|
|
+ isScreenSubscribing: boolean;
|
|
|
+ audioEnabled: boolean;
|
|
|
+ videoEnabled: boolean;
|
|
|
+ screenEnabled: boolean;
|
|
|
+}
|
|
|
+
|
|
|
+declare type SubscribeOptions = StreamOptions & {
|
|
|
+ aMsid?: string;
|
|
|
+ vMsid?: string;
|
|
|
+};
|
|
|
+
|
|
|
+declare enum SubscribeReason {
|
|
|
+ InRoom = "inRoom",
|
|
|
+ Join = "join",
|
|
|
+ Publish = "publish",
|
|
|
+ User = "user",
|
|
|
+ Resume = "resume",
|
|
|
+ Retry = "retry",
|
|
|
+ Reconnect = "reconnect"
|
|
|
+}
|
|
|
+
|
|
|
+declare interface TimeRecorder {
|
|
|
+ start: number;
|
|
|
+ [key: string]: number;
|
|
|
+}
|
|
|
+
|
|
|
+declare enum TrackEvent_2 {
|
|
|
+ VideoTrackEnded = "videoTrackEnded",
|
|
|
+ AudioTrackEnded = "audioTrackEnded",
|
|
|
+ ScreenTrackEnded = "screenTrackEnded"
|
|
|
+}
|
|
|
+
|
|
|
+declare interface TrackInfo {
|
|
|
+ ssrc: string;
|
|
|
+ codec: string;
|
|
|
+ msid?: MsidType;
|
|
|
+ type: string;
|
|
|
+ from?: string | undefined;
|
|
|
+ userdata?: string;
|
|
|
+ trackId?: string;
|
|
|
+ attr?: Record<string, any>;
|
|
|
+ pt?: number;
|
|
|
+}
|
|
|
+
|
|
|
+declare type UnSubscribeOptions = SubscribeOptions;
|
|
|
+
|
|
|
+declare interface UpdateTracksResult {
|
|
|
+ restoreSub?: boolean;
|
|
|
+}
|
|
|
+
|
|
|
+declare class User extends default_2<UserListener> {
|
|
|
+ protected uid: string;
|
|
|
+ protected name: string;
|
|
|
+ protected rtsManager: RtsManager;
|
|
|
+ callId: string;
|
|
|
+ protected audioLevelMonitor: AudioLevelMonitor;
|
|
|
+ protected audioVolumeIndicationInterval: number;
|
|
|
+ constructor(userId: string, displayname: string, rtsManager: RtsManager, interval: number);
|
|
|
+ get userId(): string;
|
|
|
+ get displayname(): string;
|
|
|
+ protected createCallId(): void;
|
|
|
+ setUserInfo(uid: string, displayName: string): void;
|
|
|
+ refreshUserInfo(uid: string): void;
|
|
|
+ /**
|
|
|
+ * 获取音频 level
|
|
|
+ */
|
|
|
+ getAudioLevel(): number;
|
|
|
+ enableAudioVolumeIndication(interval: number): void;
|
|
|
+ /**
|
|
|
+ * 销毁用户,清空数据
|
|
|
+ */
|
|
|
+ clear(): void;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface UserListener {
|
|
|
+ [DeviceStatusChange.Local]: (status: string) => void;
|
|
|
+ [DeviceStatusChange.Remote]: (event: DeviceStatusChangeType, userId: string) => void;
|
|
|
+ [ClientEventType.PullStreamStats]: (userId: string, stat: any, pullStreamUrl: string) => void;
|
|
|
+ [ClientEventType.RtsSubscribeExceeds]: (userId: string, options?: SubscribeOptions) => void;
|
|
|
+ [TrackEvent_2.VideoTrackEnded]: () => void;
|
|
|
+ [TrackEvent_2.AudioTrackEnded]: () => void;
|
|
|
+ [TrackEvent_2.ScreenTrackEnded]: () => void;
|
|
|
+ remoteTrackAvailableChange: (uid: string, aliRtcAudioTrack: AliRtcAudioTrack, aliRtcVideoTrack: AliRtcVideoTrack) => void;
|
|
|
+ audioSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number) => void;
|
|
|
+ videoSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number) => void;
|
|
|
+ screenSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number) => void;
|
|
|
+ dataSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number) => void;
|
|
|
+ audioPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number) => void;
|
|
|
+ videoPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number) => void;
|
|
|
+ dualStreamPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number) => void;
|
|
|
+ screenPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number) => void;
|
|
|
+ dataPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number) => void;
|
|
|
+ localDeviceException: (localDeviceType: AliRtcEngineLocalDeviceType, localDeviceExceptionType: AliRtcEngineLocalDeviceExceptionType, description: string) => void;
|
|
|
+ publishDataError: (error: AliRtcError) => void;
|
|
|
+ remoteAudioAutoPlayFail: (uid: string) => void;
|
|
|
+ remoteVideoAutoPlayFail: (uid: string, track: AliRtcVideoTrack) => void;
|
|
|
+ remoteAudioPlayError: (uid: string, reason?: string) => void;
|
|
|
+ remoteVideoPlayError: (uid: string, reason?: string) => void;
|
|
|
+ remoteSubscribeError: (error: AliRtcError) => void;
|
|
|
+ occurError: (error: AliRtcError) => void;
|
|
|
+ remoteDataChannelMessage: (uid: string, message: AliRtcDataChannelMsg) => void;
|
|
|
+}
|
|
|
+
|
|
|
+declare type ValidStatusMap = {
|
|
|
+ [ConnectionLatencyStage.CREATE_ENGINE]: ConnectionLatencyStatus.START | ConnectionLatencyStatus.END;
|
|
|
+ [ConnectionLatencyStage.JOIN]: ConnectionLatencyStatus.START | ConnectionLatencyStatus.SEND_SIG | ConnectionLatencyStatus.RECV_RST | ConnectionLatencyStatus.END;
|
|
|
+ [ConnectionLatencyStage.FIRST_REMOTE]: ConnectionLatencyStatus.RECEIVED | ConnectionLatencyStatus.DECODED | ConnectionLatencyStatus.PLAYED;
|
|
|
+ [ConnectionLatencyStage.RECV_NOTIFY_PUBLISH]: any;
|
|
|
+ [ConnectionLatencyStage.HANDLE_PUB_TASK]: ConnectionLatencyStatus.START | ConnectionLatencyStatus.END;
|
|
|
+ [ConnectionLatencyStage.HANDLE_SUB_TASK]: ConnectionLatencyStatus.START | ConnectionLatencyStatus.END;
|
|
|
+};
|
|
|
+
|
|
|
+declare type VideoProfileWithSendFramerate = Partial<IProfile & {
|
|
|
+ maxSendFrameRate: number;
|
|
|
+}>;
|
|
|
+
|
|
|
+declare interface VideoScaler {
|
|
|
+ getVideoTrack: () => MediaStreamTrack;
|
|
|
+ updateOptions: (options: VideoScalerOptions) => void;
|
|
|
+ dispose: () => void;
|
|
|
+}
|
|
|
+
|
|
|
+declare class VideoScalerFactory {
|
|
|
+ static isSupport(): boolean;
|
|
|
+ /**
|
|
|
+ * 获取实例
|
|
|
+ * @param {MediaStreamTrack} videoTrack
|
|
|
+ * @param {IProfile} profile
|
|
|
+ * @return {VideoScaler}
|
|
|
+ */
|
|
|
+ static getInstance(videoTrack: MediaStreamTrack, options: VideoScalerOptions): VideoScaler;
|
|
|
+}
|
|
|
+
|
|
|
+declare interface VideoScalerOptions {
|
|
|
+ width: number;
|
|
|
+ height: number;
|
|
|
+ frameRate: number;
|
|
|
+}
|
|
|
+
|
|
|
+declare enum VideoStreamSource {
|
|
|
+ Camera = 0,
|
|
|
+ Screen = 1,
|
|
|
+ Image = 2
|
|
|
+}
|
|
|
+
|
|
|
+declare const WrappedAliRtcEngine: typeof AliRtcEngine_2;
|
|
|
+
|
|
|
+declare type WrappedAliRtcEngine = InstanceType<typeof AliRtcEngine_2>;
|
|
|
+export { WrappedAliRtcEngine as AliRtcEngine }
|
|
|
+export default WrappedAliRtcEngine;
|
|
|
+
|
|
|
+export { }
|