Skip to content

Commit

Permalink
docs: update methods about readAVPacket
Browse files Browse the repository at this point in the history
  • Loading branch information
ForeverSc committed Aug 14, 2024
1 parent 0f68a30 commit caa7422
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<WebAVPacket>`
- `readAudioPacket(start?: number, end?: number): ReadableStream<WebAVPacket>`

```typescript
getAVStream(streamType?: AVMediaType, streamIndex?: number): Promise<WebAVStream>
```
Expand Down Expand Up @@ -150,8 +154,6 @@ Parameters:
Simplified methods based on the semantics of `getAVPacket`:
- `seekVideoPacket(time: number): Promise<WebAVPacket>`
- `seekAudioPacket(time: number): Promise<WebAVPacket>`
- `readVideoPacket(start?: number, end?: number): ReadableStream<WebAVPacket>`
- `readAudioPacket(start?: number, end?: number): ReadableStream<WebAVPacket>`

```typescript
getAVPackets(time: number): Promise<WebAVPacket[]>
Expand Down
6 changes: 4 additions & 2 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<WebAVPacket>`
- `readAudioPacket(start?: number, end?: number): ReadableStream<WebAVPacket>`

```typescript
getAVStream(streamType?: AVMediaType, streamIndex?: number): Promise<WebAVStream>
```
Expand Down Expand Up @@ -151,8 +155,6 @@ getAVPacket(time: number, streamType?: AVMediaType, streamIndex?: number): Promi
基于`getAVPacket`的语义简化方法:
- `seekVideoPacket(time: number): Promise<WebAVPacket>`
- `seekAudioPacket(time: number): Promise<WebAVPacket>`
- `readVideoPacket(start?: number, end?: number): ReadableStream<WebAVPacket>`
- `readAudioPacket(start?: number, end?: number): ReadableStream<WebAVPacket>`

```typescript
getAVPackets(time: number): Promise<WebAVPacket[]>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ <h3>Get All Video Packets</h3>
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) => {
Expand Down

0 comments on commit caa7422

Please sign in to comment.