UNPKG

video-stream-snap

Version:

Capture the first frame from video streams (HLS/RTMP/FLV)

35 lines (31 loc) 916 B
import flvjs from 'flv.js'; import Hls from 'hls.js'; import * as dashjs from 'dashjs'; interface StreamSnapOptions { /** 超时时间(毫秒) */ timeout?: number; /** 输出图片质量(0-1) */ quality?: number; /** 输出图片类型 */ mimeType?: 'image/jpeg' | 'image/png' | 'image/webp'; /** 跳过黑帧检测 */ skipBlackFrame?: boolean; /** 自定义视频元素 */ videoElement?: HTMLVideoElement; } declare global { interface Window { flvjs?: typeof flvjs; Hls?: typeof Hls; dashjs?: typeof dashjs; } } declare class StreamSnap { private static ensureCrossOrigin; static capture(streamUrl: string, options?: StreamSnapOptions): Promise<string>; private static captureNormal; private static captureWithFLVJS; private static captureWithHLS; private static captureWithDASH; } export { StreamSnap as default };