录制媒体流 MediaStream,生成 MP4 文件流

如果你期望录制为 WebM 格式,请使用 MediaRecorder

Example

const recorder = new AVRecorder(
await navigator.mediaDevices.getUserMedia({
video: true,
audio: true,
})
);

recorder.start() // => ReadableStream

See

录制摄像头

Constructors

Properties

#conf: Omit<IRecordeOpts, "timeSlice">
#evtTool: EventTool<{
    stateChange: ((state) => void);
}> = ...

Type declaration

  • stateChange: ((state) => void)
      • (state): void
      • Parameters

        • state: TState

        Returns void

#recoderPauseCtrl: RecoderPauseCtrl
#state: TState = 'inactive'
on: (<Type>(type, listener) => (() => void)) = ...

Type declaration

    • <Type>(type, listener): (() => void)
    • 监听 EventType 中定义的事件

      Type Parameters

      • Type extends "stateChange"

      Parameters

      • type: Type
      • listener: {
            stateChange: ((state) => void);
        }[Type]

      Returns (() => void)

        • (): void
        • Returns void

Accessors

Methods

  • 开始录制,返回 MP4 文件流

    Parameters

    • timeSlice: number = 500

      控制流输出数据的时间间隔,单位毫秒

    Returns ReadableStream<Uint8Array>