How avatarchik/360dashplayer works
Based on both the file tree and the README, the project is a demonstration tool for merging split HEVC tiles. It is written in pure JavaScript (with some TypeScript for the demo player) and works both in the browser and under NodeJS. The purpose is to allow tiled and split HEVC content—whose tiles might be fetched in different qualities based on user interaction—to be merged into a single tiled (but unsplit) segment that can be natively decoded by browsers like Edge.
Main Components
• User Interface & Presentation Layer:
• HTML files (index.html and demo.html) serve as entry points.
• CSS folder for styling.
• These files are responsible for presenting the video player, quality controls (grid view or button modes), and handling URL parameters (like content-index, grid-index, mode, etc.) that initialize the demo.
• Client-Side Logic & Interaction:
• The js folder contains the bulk of the JavaScript functionality.
• The demo player is central—implemented partly in TypeScript (js/demo_player.ts) and then built to demo_player.js. It handles parameter parsing, controlling the video element, monitoring playback, and managing quality changes.
• HEVC Merging Engine:
• Located inside the libs folder (specifically, hevc_merger.js). This module contains the core functions:
• The other merges the video segments for a given set of tiles.
• These operations are essential to convert the split tiled content into a format that the native decoder can handle.
• External Dependencies & Libraries:
• When running under NodeJS, the project uses packages (as seen in js/package.json and the instructions on installing NodeJS and TypeScript).
• Users load the demo page via index.html; URL hash parameters are parsed to determine content and grid selection.
• UI to the Client-Side Logic:
• JS components are responsible for reading the parameters, updating the video player, and triggering quality updates.
• Merging process:
• That this component processes multiple ArrayBuffers corresponding to the split tiles/segments (with the base track and additional tile tracks).
• External Libraries Integration:
→ ISOBoxer assists in parsing/adjusting MP4/DASH init segments.
→ Chart.js is used for on-screen demonstrations (like quality metrics or grid overlays) but is optional/auxiliary.
• A note about NodeJS usage that may influence how buffers are handled (conversion between Buffer and ArrayBuffer).
Architectural Patterns & Technology Stack
• Separation of Concerns:
• Modular Design:
• Each module is independent (for instance, media parameter handling in index.html, UI control logic in the demo player, and tile merging in libs/hevc_merger.js).
• Build Process:
• Build step that compiles the TypeScript file (demo_player.ts) into JavaScript (demo_player.js) using NodeJS/NPM scripts. This is essential for both development and production deployment.