UNPKG

trtc-electron-sdk

Version:

trtc electron sdk

189 lines (188 loc) 8.96 kB
/** * V2Live 关键类型定义 */ export declare enum V2LiveCode { V2LIVE_OK = 0, V2LIVE_ERROR_FAILED = -1, V2LIVE_ERROR_INVALID_PARAMETER = -2, V2LIVE_ERROR_REFUSED = -3, V2LIVE_ERROR_NOT_SUPPORTED = -4, V2LIVE_ERROR_INVALID_LICENSE = -5, V2LIVE_ERROR_REQUEST_TIMEOUT = -6, V2LIVE_ERROR_SERVER_PROCESS_FAILED = -7, V2LIVE_ERROR_DISCONNECTED = -8, V2LIVE_ERROR_NO_AVAILABLE_HEVC_DECODERS = -2304, V2LIVE_WARNING_NETWORK_BUSY = 1101, V2LIVE_WARNING_VIDEO_BLOCK = 2105 } export declare enum V2LiveMode { V2LiveModeRTMP = 0, V2LiveModeRTC = 1 } /** * @namespace V2LivePusherEvent * @description V2LivePusher 事件定义 * */ export declare enum V2LivePusherEvent { /** * @description 错误回调:SDK 不可恢复的错误,一定要监听,并分情况给用户适当的界面提示。 * * @event V2LivePusherEvent#onError * @param {Number} errCode - 错误码 * @param {String} errMsg - 错误信息 */ onError = "onError", /** * @description 警告回调:SDK 可恢复的错误,需要监听,并给用户适当的界面提示。 * * @event V2LivePusherEvent#onWarning * @param {Number} warnCode - 警告码 * @param {String} warnMsg - 警告信息 */ onWarning = "onWarning", /** * @description 音频采集状态回调:音频采集状态回调。 * * @event V2LivePusherEvent#onCaptureFirstAudioFrame */ onCaptureFirstAudioFrame = "onCaptureFirstAudioFrame", /** * @description 视频采集状态回调:视频采集状态回调。 * * @event V2LivePusherEvent#onCaptureFirstVideoFrame */ onCaptureFirstVideoFrame = "onCaptureFirstVideoFrame", /** * @description 麦克风音量回调:麦克风音量回调。 * * @event V2LivePusherEvent#onMicrophoneVolumeUpdate * @param {Number} volume - 麦克风音量 */ onMicrophoneVolumeUpdate = "onMicrophoneVolumeUpdate", /** * @description 推流状态更新回调:推流状态更新回调。 * * @event V2LivePusherEvent#onPushStatusUpdate * @param {Number} status - 推流状态 * @param {String} message - 推流状态信息 */ onPushStatusUpdate = "onPushStatusUpdate", /** * @description 推流统计回调:推流统计信息变化时,会回调该接口。 * * @event V2LivePusherEvent#onStatisticsUpdate * @param {V2LivePusherStatistics} statistics - 推流统计信息 */ onStatisticsUpdate = "onStatisticsUpdate" } export declare enum V2LiveVideoResolution { V2LiveVideoResolution160x160 = 0, V2LiveVideoResolution270x270 = 1, V2LiveVideoResolution480x480 = 2, V2LiveVideoResolution320x240 = 3, V2LiveVideoResolution480x360 = 4, V2LiveVideoResolution640x480 = 5, V2LiveVideoResolution320x180 = 6, V2LiveVideoResolution480x270 = 7, V2LiveVideoResolution640x360 = 8, V2LiveVideoResolution960x540 = 9, V2LiveVideoResolution1280x720 = 10, V2LiveVideoResolution1920x1080 = 11 } export declare enum V2LiveVideoResolutionMode { V2LiveVideoResolutionModeLandscape = 0, V2LiveVideoResolutionModePortrait = 1 } /** * 视频编码参数 * * 该设置决定远端用户看到的画面质量。、 * * @param {V2LiveVideoResolution} videoResolution - 【字段含义】 视频分辨率。 * - 【特别说明】如需使用竖屏分辨率,请指定 videoResolutionMode 为 Portrait,例如: 640 × 360 + Portrait = 360 × 640。 * - 【推荐取值】 * - 注意:桌面平台(Win + Mac):建议选择 640 × 360 及以上分辨率,videoResolutionMode 选择 Landscape,即横屏分辨率。 * @param {V2LiveVideoResolutionMode} videoResolutionMode - 【字段含义】分辨率模式(横屏分辨率 or 竖屏分辨率)。 * - 【推荐取值】桌面平台(Windows、Mac)建议选择 Landscape。 * - 【特别说明】如需使用竖屏分辨率,请指定 resMode 为 Portrait,例如: 640 × 360 + Portrait = 360 × 640。 * @param {Number} videoFps - 【字段含义】视频采集帧率。 * - 【推荐取值】15fps 或 20fps。5fps 以下,卡顿感明显。10fps 以下,会有轻微卡顿感。20fps 以上,会浪费带宽(电影的帧率为 24fps)。 * @param {Number} videoBitrate - 【字段含义】目标视频码率,SDK 会按照目标码率进行编码,只有在弱网络环境下才会主动降低视频码率。 * - 【推荐取值】请参考 V2LiveVideoResolution 在各档位注释的最佳码率,也可以在此基础上适当调高。 * - 比如:V2LiveVideoResolution1280x720 对应 1200kbps 的目标码率,您也可以设置为 1500kbps 用来获得更好的观感清晰度。 * - 【特别说明】您可以通过同时设置 videoBitrate 和 minVideoBitrate 两个参数,用于约束 SDK 对视频码率的调整范围: * - 如果您将 videoBitrate 和 minVideoBitrate 设置为同一个值,等价于关闭 SDK 对视频码率的自适应调节能力。 * @param {Number} minVideoBitrate - 【字段含义】最低视频码率,SDK 会在网络不佳的情况下主动降低视频码率以保持流畅度,最低会降至 minVideoBitrate 所设定的数值。 * - 【推荐取值】您可以通过同时设置 videoBitrate 和 minVideoBitrate 两个参数,用于约束 SDK 对视频码率的调整范围: * - 如果您将 videoBitrate 和 minVideoBitrate 设置为同一个值,等价于关闭 SDK 对视频码率的自适应调节能力。 */ export declare class V2LiveVideoEncoderParam { videoResolution: V2LiveVideoResolution; videoResolutionMode: V2LiveVideoResolutionMode; videoFps: number; videoBitrate: number; minVideoBitrate: number; constructor(videoResolution?: V2LiveVideoResolution, videoResolutionMode?: V2LiveVideoResolutionMode, videoFps?: number, videoBitrate?: number, minVideoBitrate?: number); } export declare enum V2LiveMirrorType { V2LiveMirrorTypeAuto = 0, V2LiveMirrorTypeEnable = 1, V2LiveMirrorTypeDisable = 2 } export declare enum V2LiveFillMode { V2LiveFillModeFill = 0, V2LiveFillModeFit = 1 } export declare enum V2LiveRotation { V2LiveRotation0 = 0, V2LiveRotation90 = 1, V2LiveRotation180 = 2, V2LiveRotation270 = 3 } export declare enum V2LivePixelFormat { V2LivePixelFormatUnknown = 0, V2LivePixelFormatI420 = 1, V2LivePixelFormatBGRA32 = 2, V2LivePixelFormatRGBA32 = 3 } export declare enum V2LiveBufferType { V2LiveBufferTypeUnknown = 0, V2LiveBufferTypeByteBuffer = 1 } export declare enum V2LiveAudioQuality { V2LiveAudioQualitySpeech = 0, V2LiveAudioQualityDefault = 1, V2LiveAudioQualityMusic = 2 } /** * 推流器的统计数据 * * @param {Number} appCpu - 当前 App 的 CPU 使用率(%) * @param {Number} systemCpu - 当前系统的 CPU 使用率(%) * @param {Number} width - 视频宽度 * @param {Number} height - 视频高度 * @param {Number} fps - 帧率(fps) * @param {Number} videoBitrate - 视频码率(Kbps) * @param {Number} audioBitrate - 音频码率(Kbps) * @param {Number} rtt - 从 SDK 到云端的往返延时(ms) * @param {Number} netSpeed - 上行速度(kbps) */ export declare class V2LivePusherStatistics { appCpu: number; systemCpu: number; width: number; height: number; fps: number; videoBitrate: number; audioBitrate: number; rtt: number; netSpeed: number; constructor(appCpu?: number, systemCpu?: number, width?: number, height?: number, fps?: number, videoBitrate?: number, audioBitrate?: number, rtt?: number, netSpeed?: number); } export declare enum V2LivePushStatus { V2LivePushStatusDisconnected = 0, V2LivePushStatusConnecting = 1, V2LivePushStatusConnectSuccess = 2, V2LivePushStatusReconnecting = 3 }