Skip to content

vorlaxen/v-player

Repository files navigation

๐ŸŽฌ Vorlaxen's Web Player

Enterprise-grade, modular, event-driven video player engine built with TypeScript + React + Vite.

Designed to compete with production-level platforms such as Netflix, YouTube, Disney+, and Udemy โ€” with a clean architecture, plugin extensibility, and long-term scalability in mind.


๐Ÿš€ Vision

V-Player is built with a simple philosophy:

Keep the core minimal. Everything else is a plugin.

The system is engineered to deliver:

  • High performance playback
  • Seamless quality & audio switching
  • Strong type-safety with full TypeScript coverage
  • Event-driven extensibility
  • Future-ready architecture (WebCodecs, AV1, adaptive pipelines)

๐Ÿง  Architecture Overview

The project follows a Core + Plugin Architecture.

Player Core
 โ”œโ”€โ”€ EventBus (Strict Typed)
 โ”œโ”€โ”€ Engine Layer (Media + Audio)
 โ”œโ”€โ”€ Plugin Manager
 โ””โ”€โ”€ Public API

Plugins
 โ”œโ”€โ”€ Format Plugins (MP4, HLS, DASH)
 โ”œโ”€โ”€ Audio Processing
 โ”œโ”€โ”€ Metadata Providers
 โ”œโ”€โ”€ Ads / Analytics
 โ””โ”€โ”€ Debug / DevTools

Core Principles

  • Core never depends on plugins.
  • Plugins extend behavior via lifecycle hooks.
  • All communication is event-driven.
  • Every event is strictly typed.

โš™๏ธ Technology Stack

  • React (SPA Architecture)
  • TypeScript (Strict Mode)
  • Vite (Bundler)
  • Web Audio API
  • Modular Plugin System

๐Ÿงฉ Plugin System

All plugins must extend the abstract BasePlugin class.

Lifecycle

  • init(core)
  • destroy()
  • onEvent() (optional)

Plugins are:

  • Initialized by the core
  • Event-driven
  • Isolated from each other
  • Fully typed

Example Plugin Categories

Plugin Purpose
MP4Plugin Native MP4 playback
HLSPlugin Adaptive streaming via HLS
MetadataPlugin Platform-specific metadata integration
AudioPlugin Advanced audio pipeline & processing layer
SleepTimerPlugin Playback auto-stop scheduling system
ADSPlugin Advertisement system
IframeBridgePlugin Cross-window / embedded player communication

๐Ÿ”Š AudioPlugin

AudioPlugin replaces the old AudioBoost-specific design and provides a more extensible audio processing layer.

Capabilities:

  • Volume normalization
  • Dynamic gain control
  • Custom audio graph injection
  • Toggleable enhancement pipeline
  • Future support for spatial audio or advanced DSP modules

Built on top of the Web Audio API with a controlled and isolated audio graph.

The design allows stacking multiple audio processors internally without leaking implementation details to the core.


โณ SleepTimerPlugin

The SleepTimerPlugin enables timed playback shutdown.

Features:

  • Set timer (e.g., 10 / 30 / 60 minutes)
  • Emits scheduled stop events
  • Graceful pause instead of hard stop
  • Fully event-driven

Ideal for long-form content platforms (courses, podcasts, series playback).

The timer logic is isolated and does not directly control media โ€” it only emits typed events.


๐ŸชŸ IframeBridgePlugin

The IframeBridgePlugin enables secure communication between:

  • Embedded players
  • Parent windows
  • Cross-origin iframe integrations

Built on top of postMessage with strict message typing.

Capabilities:

  • Parent โ†’ Player control (play, pause, seek)
  • Player โ†’ Parent analytics events
  • Strict origin validation
  • Typed message contracts

This makes the engine embeddable in LMS systems, SaaS dashboards, or third-party platforms without modifying the core.


๐Ÿ” Event-Driven System

All interactions flow through a strictly typed EventBus.

Example Events

  • play
  • pause
  • seek
  • qualityChange
  • audioChange
  • metadataLoaded
  • sleepTimerTriggered
  • iframeMessageReceived

Each event:

  • Must exist in PlayerEventMapType
  • Cannot be emitted if not typed
  • Is fully compile-time validated

This prevents runtime inconsistencies and ensures predictable plugin behavior.


๐ŸŽฅ Multi-Format Support

Supported formats via plugins:

  • MP4
  • HLS
  • DASH (planned via plugin abstraction)

The core interacts only through the plugin interface โ€” never directly with format libraries.


๐Ÿ”„ Seamless Switching

Quality Switching

  • No playback interruption
  • Buffered data preserved
  • Adaptive switching supported

Audio Track / Dubbing Switching

  • No playback pause
  • Event-driven change
  • Independent from quality pipeline

Both systems are designed to be reusable across plugins.


๐Ÿ›ก Stability & Performance

  • Minimal core footprint
  • Strict listener cleanup
  • Memory leak prevention strategy
  • Defensive event handling
  • Controlled plugin lifecycle

Designed for long-running sessions.


๐Ÿงช Development Mode

UI is intentionally minimal.

The project includes:

  • Basic DOM test controls
  • Simple test buttons
  • Debug-ready structure

The architecture is fully UI-ready but UI implementation is intentionally separated from core logic.


๐Ÿ“ Project Structure

src/
 โ”œโ”€โ”€ core/
 โ”‚   โ”œโ”€โ”€ engine/
 โ”‚   โ”œโ”€โ”€ events/
 โ”‚   โ””โ”€โ”€ constants/
 โ”‚
 โ”œโ”€โ”€ plugins/
 โ”‚   โ”œโ”€โ”€ MP4Plugin/
 โ”‚   โ”œโ”€โ”€ HLSPlugin/
 โ”‚   โ”œโ”€โ”€ MetadataPlugin/
 โ”‚   โ”œโ”€โ”€ AudioPlugin/
 โ”‚   โ”œโ”€โ”€ SleepTimerPlugin/
 โ”‚   โ””โ”€โ”€ IframeBridgePlugin/
 โ”‚
 โ”œโ”€โ”€ components/
 โ”œโ”€โ”€ hooks/
 โ”œโ”€โ”€ types/
 โ””โ”€โ”€ utils/

Clear separation between:

  • Engine logic
  • Plugin layer
  • UI layer
  • Context layer

๐Ÿงฑ Type System

Strict TypeScript usage across the project:

  • PlayerEventMapType
  • PluginEventMap
  • EngineTypes
  • Plugin lifecycle types

No untyped event emission allowed.


๐Ÿ”ฎ Future Roadmap

  • WebCodecs integration
  • AV1 support
  • MediaCapabilities API integration
  • Analytics plugin
  • DRM abstraction layer
  • Adaptive bitrate intelligence plugin

The architecture is intentionally future-proof.


๐Ÿ›  Installation

pnpm install
pnpm dev

๐Ÿ“„ License

This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0).

๐Ÿ›ก๏ธ Commercial Use is Strictly Prohibited. If you intend to use this engine for a commercial product, please contact the author for a separate commercial license.

View License Summary


โœจ Final Note

V-Player is not a UI experiment. It is an engine-first, architecture-driven system designed for production-scale streaming platforms.

The UI is replaceable. The core is permanent.

About

Enterprise-grade, modular, event-driven video player engine!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors