diff --git a/README.md b/README.md index 9a7b597..1855966 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,10 @@ Parameters: - `streamType`: The type of media stream, defaults to 0, which is the video stream. 1 is audio stream. See `AVMediaType` for more details. - `streamIndex`: The index of the media stream, defaults to -1, which is to automatically select. +Simplified methods based on the semantics of `readAVPacket`: +- `readVideoPacket(start?: number, end?: number): ReadableStream` +- `readAudioPacket(start?: number, end?: number): ReadableStream` + ```typescript getAVStream(streamType?: AVMediaType, streamIndex?: number): Promise ``` @@ -150,8 +154,6 @@ Parameters: Simplified methods based on the semantics of `getAVPacket`: - `seekVideoPacket(time: number): Promise` - `seekAudioPacket(time: number): Promise` -- `readVideoPacket(start?: number, end?: number): ReadableStream` -- `readAudioPacket(start?: number, end?: number): ReadableStream` ```typescript getAVPackets(time: number): Promise diff --git a/README_CN.md b/README_CN.md index 4461daa..105103d 100644 --- a/README_CN.md +++ b/README_CN.md @@ -120,6 +120,10 @@ readAVPacket(start?: number, end?: number, streamType?: AVMediaType, streamIndex - `streamType`: 媒体流类型,默认值为0, 即视频流,1为音频流。其他具体见`AVMediaType` - `streamIndex`: 媒体流索引,默认值为-1,即自动选择 +基于`readAVPacket`的语义简化方法: +- `readVideoPacket(start?: number, end?: number): ReadableStream` +- `readAudioPacket(start?: number, end?: number): ReadableStream` + ```typescript getAVStream(streamType?: AVMediaType, streamIndex?: number): Promise ``` @@ -151,8 +155,6 @@ getAVPacket(time: number, streamType?: AVMediaType, streamIndex?: number): Promi 基于`getAVPacket`的语义简化方法: - `seekVideoPacket(time: number): Promise` - `seekAudioPacket(time: number): Promise` -- `readVideoPacket(start?: number, end?: number): ReadableStream` -- `readAudioPacket(start?: number, end?: number): ReadableStream` ```typescript getAVPackets(time: number): Promise diff --git a/index.html b/index.html index dff4626..e5032c6 100644 --- a/index.html +++ b/index.html @@ -123,7 +123,7 @@

Get All Video Packets

const { WebDemuxer } = isDEV ? await import('./src') : await import('https://cdn.jsdelivr.net/npm/web-demuxer/+esm') const demuxer = new WebDemuxer({ - wasmLoaderPath: isDEV ? "http://localhost:5173/src/lib/ffmpeg.js" : "https://cdn.jsdelivr.net/npm/web-demuxer@latest/dist/wasm-files/ffmpeg.min.js", + wasmLoaderPath: isDEV ? `${window.location.origin}/src/lib/ffmpeg.js` : "https://cdn.jsdelivr.net/npm/web-demuxer@latest/dist/wasm-files/ffmpeg.min.js", }) document.getElementById('example-seek-btn').addEventListener('click', async (e) => {