import { MediaType } from '@urtc/sdk-web'; /** * 音视频源的添加模式,有 'automatic' | 'manual' 两种可填,分别代表:自动添加(有新流时) | 手动添加,不指定时,默认为 'automatic'。 * @public */ export declare type MixStreamAddMode = 'automatic' | 'manual'; /** * 输出音视频的混流布局风格,分别有 'flow' | 'main' | 'single' | 'flow2' | 'main2' | 'custom',分别代表: * * 1. 平铺风格,用户平铺在底图上,默认最大支持9个用户画面; * 2. 垂直风格,讲课模式,主讲人占大部分屏幕,其他人小屏居于右侧,最多支持9个用户画面; * 3. 单画面风格,只显示主画面,其他画面不显示,只对声音进行混音,最多支持9个用户画面; * 4. 平铺风格2,用户完全等分的平铺在底图上,最多支持9个用户画面; * 5. 垂直风格2,主讲人占大部分屏幕,其他人小屏居于底部; * 6. 自定义布局风格,可参照 RFC5707 Media Server Markup Language (MSML) 指定布局; * * 不指定时,默认为 'flow',更多请参考[风格详细说明](https://docs.ucloud.cn/urtc/cdnSteaming/Laylout)。 */ export declare type MixLayoutType = 'flow' | 'main' | 'single' | 'flow2' | 'main2' | 'custom'; /** * 输出音视频的音频编码格式,'aac'。 */ export declare type MixAudioCodec = 'aac'; /** * 输出音视频的视频编码格式,有 'h264' | 'h265' 两种,不指定时,默认 'h264'。 */ export declare type MixVideoCodec = 'h264' | 'h265'; /** * 输出音视频的视频质量,当输出视频编码格式为 h264 时,此项起作用,有 'B' | 'CB' | 'M' | 'E' | 'H' 几种,不指定时,默认为 'CB'。 */ export declare type H264Quality = 'B' | 'CB' | 'M' | 'E' | 'H'; /** * 输出音视频的模式,有 'audio-video' | 'audio' 两种,分别代表:输出音视频 | 只输出音频,不指定时,默认为 'audio-video'。 */ export declare type MixOutputMode = 'audio-video' | 'audio'; /** * 输出音视频的水印类型,有 'time' | 'image' | 'text' 几种,分别对应时间水印、图片水印、文字水印,默认不添加水印。 */ export declare type WaterMarkType = 'time' | 'image' | 'text'; /** * 输出音视频的水印位置,有 'left-top' | 'left-bottom' | 'right-top' | 'right-bottom' 几种,分别对应 左上,左下,右上,右下,默认 'left-top'。 */ export declare type WaterMarkPosition = 'left-top' | 'left-bottom' | 'right-top' | 'right-bottom'; /** * 指定需要添加进行混流的的音视频流。 */ export interface MixStream { /** * 用户ID。 */ userId: string; /** * 用户推流的类型,"camera" | "screen" 两种 {@link MediaType}。 */ mediaType: MediaType; } /** * 输出音视频的混流布局设置。 */ export interface MixLayoutOptions { /** * 布局风格,参见{@link MixLayoutType},默认 'flow'。 */ type: MixLayoutType; /** * 指定待切换的布局风格,针对直播中有切换布局的需求,可在启动时指定待切换的布局,未指定的无法切换,且最多可指定两种可切换的类型(不包含 type 中指定的,即一次转推任务最多有三种布局可相互切换),多余的将被忽略。 * @example * ```js * { * type: 'flow', * standbyTypes: ['main', 'main2'], * ... * } * ``` * 特别地,由于 'custom' 布局风格的特殊性,待切换的布局中不可包含该类型的布局,若填写,则会被忽略。 */ standbyTypes?: MixLayoutType[]; /** * 选择自定义布局风格时,需要由此参数指定布局,格式参照RFC5707 Media Server Markup Language (MSML)。 */ custom?: Record[]; /** * 主画面用户,指定某用户的流为输入音视频的主画面,如当 type 为 'main' 或 'main2' 时,指定某用户的流将占据大部分画面,不指定时,默认为当前用户。 */ mainViewUId?: string; /** * 主画面流类型,指定用户某类型的流为主画面,默认 'camera'。 */ mainViewType?: MediaType; } /** * 输出音视频的水印设置。 */ export interface WaterMarkOptions { /** * 水印类型,详见 {@link WaterMarkType}。 */ type?: WaterMarkType; /** * 水印位置,详见 {@link WaterMarkPosition}。 */ position?: WaterMarkPosition; /** * 水印备注,当为时间水印时,不需要传,当为图片水印时,此处需为图片的 URL(此时必传),当为文字水印时,此处需为水印文字。 */ remarks?: string; } /** * 输出音视频的音频设置。 */ export interface MixAudioOptions { /** * 音频编码格式,详见 {@link MixAudioCodec}。 */ codec: MixAudioCodec; } /** * 输出音视频的视频设置。 */ export interface MixVideoOptions { /** * 视频编码格式,详见 {@link MixVideoCodec}。 */ codec: MixVideoCodec; /** * 视频质量,详见 {@link H264Quality},注:当视频编码格式为 'h264' 时,此项起作用。 */ quality?: H264Quality; /** * 视频帧率,可选值 6 | 12 | 15 | 24 | 30 | 48 | 60,默认为 15。 */ frameRate?: number; /** * 视频码率,默认为 500。 */ bitRate?: number; } /** * 输出音视频的背景颜色设置。 */ export interface BackgroundColorOptions { /** * 红(R)色通道值,范围 [0, 255],默认 0。 */ r: number; /** * 绿(G)色通道值,范围 [0, 255],默认 0。 */ g: number; /** * 蓝(B)色通道值,范围 [0, 255],默认 0。 */ b: number; } /** * 混流输入参数设置。 */ export interface MixInputOptions { /** * 音视频源的添加模式,详见 {@link MixStreamAddMode},默认为 'automatic'。 */ mode?: MixStreamAddMode; /** * 指定需要添加进行混流的的音视频流,参见 {@link MixStream}。 */ streams?: MixStream[]; } /** * 混流输出参数设置。 */ export interface MixOutputOptions { /** * 输出音视频的模式,{@link MixOutputMode} 默认为 'audio-video'。 */ mode?: MixOutputMode; /** * 输出音视频的宽度,默认 1280。 */ width?: number; /** * 输出音视频的高度,默认 720。 */ height?: number; /** * 输出音视频的背景颜色设置,详见 {@link BackgroundColorOptions},默认 {r: 0, g: 0, b:0}。 */ backgroundColor?: BackgroundColorOptions; /** * 输出音视频的音频设置,详见 {@link MixAudioOptions}。 */ audio?: MixAudioOptions; /** * 输出音视频的视频设置,详见 {@link MixVideoOptions}。 */ video?: MixVideoOptions; /** * 输出音视频的混流布局设置,详见 {@link MixLayoutOptions}。 */ layout?: MixLayoutOptions; /** * 输出音视频的水印设置,详见 {@link WaterMarkOptions}。 */ waterMark?: WaterMarkOptions; } /** * 混流高级参数设置。 */ export interface MixAdvancesOptions { /** * 等待流添加的超时周期,混流任务检测到没有(指定)流后开始计时,若超过此时间仍未有(指定)流添加,任务将自动停止,单位是s,最长24小时,默认 60。 */ timeoutPeriod?: number; /** * 指定关键用户(指定流),若关键用户退出房间后,混流任务将自动停止。 */ keyUser?: string; } /** * 混流参数设置。 */ export interface MixOptions { /** * 输入设置,详见 {@link MixInputOptions}。 * @example * ```js * { * input: { * mode: 'manual', * streams: [ * { userId: 'user_xxx', mediaType: 'camera' }, * { userId: 'user_yyy', mediaType: 'screen' }, * ] * }, * ... * } * ``` */ input?: MixInputOptions; /** * 输出设置,详见 {@link MixOutputOptions}。 * @example * ```js * { * output: { * mode: 'audio-video', * width: 1920, * height: 1080, * layout: { * type: 'main', * mainViewUId: 'user_xxx', * mainViewType: 'camera', * }, * ... * }, * ... * } * ``` */ output?: MixOutputOptions; /** * 更多设置,详见 {@link MixAdvancesOptions}。 * @example * ```js * { * advances: { * keyUser: 'user_xxx', * ... * }, * ... * } * ``` */ advances?: MixAdvancesOptions; } /** * 开始录制的参数设置。 */ export interface StartRecordOptions extends MixOptions { /** * 存储设置。 * @example * ```js * { * storage: { * bucket: 'test-record', * region: 'cn-bj' * }, * ... * } * ``` */ storage: { /** * 存储的 bucket, 使用 UCloud 的 UFile 产品进行在存储,相关信息见控制台操作文档。 */ bucket: string; /** * 存储服务所在的地域。 */ region: string; }; } /** * 开启录制时返回的结果。 */ export interface StartRecordResult { /** * 生成的录制文件的文件名。 */ FileName: string; } /** * 更新录制部分设置。 */ export interface UpdateRecordOptions { /** * 输入设置,详见 {@link MixInputOptions}。 */ input?: MixInputOptions; /** * 输出设置。 */ output?: { /** * 输出音视频的混流布局设置,详见 {@link MixLayoutOptions}。 */ layout: MixLayoutOptions; }; } /** * 开始转推的参数设置。 */ export interface StartRelayOptions extends MixOptions { /** * 转推设置。 * @example * ```js * { * relay: { * pushURL: [`rtmp://push.xxxxx.com/xxx/${this.roomId}`] * }, * ... * } * ``` */ relay: { /** * 转推地址,rtmp 地址。 */ pushURL: string[]; }; } export declare type UpdateRelayOptions = UpdateRecordOptions;