@warmerdam-ai/core
v0.2.0
Published
Core engine, playlist management, and media playback for WebPlayer
Readme
@warmerdam-ai/core
Core engine, playlist management, media playback, event bus, and DOM scanning for WebPlayer.
Note: Most users should install the
webplayerpackage instead, which bundles this package together with the UI layer.
Install
npm install @warmerdam-ai/coreWhat's Included
| Export | Description |
| ------------------ | ----------------------------------------------------- |
| EventBus | Typed publish/subscribe event system |
| ConfigManager | Player configuration and publisher settings |
| Playlist | Playlist state, ordering, shuffle, and repeat |
| Track | Individual track model with metadata and state |
| EngineManager | Manages HTML5 audio/video and YouTube playback engines |
| DOMScanner | Scans the page for media links and playlist files |
| PublicAPI | High-level player API (init, play, pause, skip, etc.) |
| MediaSessionBridge | Integrates with the Media Session API for OS controls |
| WebPlayerAPIClient | Client for the WebPlayer search and entity APIs |
Playlist parsers (parseXSPF, parseM3U, parsePLS) and URL utilities are also exported.
Basic Usage
import { PublicAPI, ConfigManager, EventBus } from '@warmerdam-ai/core';
const player = new PublicAPI();
player.init({ source: 'youtube' });
// Listen to events
const bus = new EventBus();
bus.on('track:change', (track) => {
console.log('Now playing:', track.title);
});Links
- webplayer package -- the recommended install for most users
- Full documentation
License
MIT
