mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-21 04:31:20 -08:00
- 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.
1.9 KiB
1.9 KiB
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
npm install artplayer-proxy-mediabunny
Usage
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
Browser Support
Requires browsers with WebCodecs API support:
- Chrome 94+
- Edge 94+
- Opera 80+
License
MIT © Harvey Zack