Files
ArtPlayer/packages/artplayer-proxy-mediabunny/README.md
T
Harvey Zhao be44c1f8dd Enhance property handling in artplayerProxyMediabunny
- Updated the way properties from the shim instance and its prototype are retrieved.
- Replaced the for-in loop with a Set to ensure all properties, including inherited ones, are considered.
- Excluded the 'constructor' property from being added to the canvas.

refactor: remove unused utility functions and streamline event handling

- Deleted `videoEvents.js`, `clamp.js`, and `sleep.js` as they were not utilized.
- Introduced a new `EventTarget` class to manage event listeners more efficiently.
- Enhanced `MediaBunnyEngine`, `AudioEngine`, `VideoEngine`, and `VideoShim` to utilize the new event system.
- Updated type definitions in `artplayer-proxy-mediabunny.d.ts` to include new configuration options.
- Added comprehensive architecture documentation to clarify the structure and flow of the MediaBunny engine.
- Refactored the codebase for improved readability and maintainability, including better naming conventions and JSDoc comments.
2026-01-01 17:03:44 +08:00

71 lines
1.9 KiB
Markdown

# artplayer-proxy-mediabunny
MediaBunny proxy for ArtPlayer - A high-performance video playback solution using WebCodecs and Canvas.
## Features
- 🚀 Hardware-accelerated video decoding via WebCodecs API
- 🎨 Canvas-based rendering for maximum flexibility
- 🎵 Web Audio API for audio playback
- 🔄 Precise audio-video synchronization
- 📦 Support for multiple media formats
- ⚡ Optimized for modern browsers
## Installation
```bash
npm install artplayer-proxy-mediabunny
```
## Usage
```js
import Artplayer from 'artplayer'
import artplayerProxyMediabunny from 'artplayer-proxy-mediabunny'
const art = new Artplayer({
container: '.artplayer-app',
url: 'path/to/video.mp4',
customType: {
mediabunny: artplayerProxyMediabunny({
// Options
loadTimeout: 12000,
timeupdateInterval: 250,
avSyncTolerance: 0.12,
dropLateFrames: false,
poster: 'path/to/poster.jpg',
}),
},
type: 'mediabunny',
})
```
## Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `loadTimeout` | `number` | `12000` | Timeout for loading media (ms) |
| `timeupdateInterval` | `number` | `250` | Interval for timeupdate events (ms) |
| `avSyncTolerance` | `number` | `0.12` | Audio-video sync tolerance (seconds) |
| `dropLateFrames` | `boolean` | `false` | Drop late video frames |
| `poster` | `string` | `''` | Poster image URL |
| `source` | `string\|Blob\|ReadableStream` | - | Media source |
| `preflightRange` | `boolean` | `false` | Check range support before loading |
| `volume` | `number` | `0.7` | Initial volume (0-1) |
| `muted` | `boolean` | `false` | Initial muted state |
## Demo
[https://artplayer.org](https://artplayer.org/?libs=./uncompiled/artplayer-proxy-mediabunny/index.js&example=mediabunny)
## Browser Support
Requires browsers with WebCodecs API support:
- Chrome 94+
- Edge 94+
- Opera 80+
## License
MIT © Harvey Zack