How artoriasphereorg/yasai works
Project type and purpose
• This is a front-end JavaScript library (a “drop-in” HLS/HTTP-live-streaming player) that developers embed in their web pages to render live or on-demand video via MediaSource Extensions. It is not a full-stack app, but a single-page integration library.
File structure
• Demo.html: example integration, shows how to embed the player in a page.
• YasaiPlayer.js: the core player code (loader, parser, buffer manager, event emitter).
• yasaiDesignV3.css: styling for the player UI.
• README.md: usage instructions, supported settings, event list.
• LICENSE: open-source license.
Extract architecture insights from the README
• The library initializes via new YasaiLivePlayer().
• It attaches to a given <video> element.
• It fetches an HLS manifest (m3u8) and segment files (.ts or fMP4).
• It uses configurable retry/time-out parameters.
• It emits events at each stage: segment appending, flushing, parsing, errors.
Main components
a. Client Page (Demo.html or any host page)
b. YasaiPlayer JS Library
• Loader Module (fetch manifest + segments)
• Parser/Demuxer Module (parse TS/fMP4 into raw samples)
• Buffer Manager (SourceBuffer via MediaSource API)
• Event Emitter (yasaiSegAppending, yasaiEr, etc.)
c. Browser’s MediaSource Extensions (MSE)
d. HTMLVideoElement
e. Streaming Origin / CDN (HTTP server hosting m3u8 + segment files)
f. Configuration (fragLoadingTimeOut, retry settings)
g. CSS/UI Layer (yasaiDesignV3.css)
Relationships and data flow
• Manifest request: YasaiPlayer.Loader → Streaming Origin
• Segment requests: Loader → Streaming Origin → (responses) → Parser
• Parsed media → Buffer Manager → MediaSource → Video
• Event callbacks: Internal Modules → Event Emitter → Client Page
• Configuration flows from Client Page to Loader/Parser modules.
Architectural patterns & design principles
• Modular pipeline: separate loader, parser, buffer, UI.
• Event-driven: all state transitions and errors are emitted as events.
• Retry/time-out strategy for network resiliency.
• DOM-agnostic core with pluggable UI (CSS).
Essential elements
• Component names and responsibilities.
• MediaSource API boundary.
• CSS styling layer around the player UI.