Developer Documentation & SDK Integration Guide
Comprehensive technical reference from binary container packaging (CLI/GUI) to zero-DOM client Web Player embedding and secure backend token authentication.
VSNX Container Overview & Architecture
VSNX (Video Stream Native eXclusive) is a proprietary encrypted binary container engineered to permanently eradicate web video piracy, unauthorized scraping, and illegal redistribution across LMS and educational platforms.
Binary Multiplex Structure
Bypasses standard MP4 atom boxes and TS segments. Features cryptographically signed headers with segregated audio/video chunks.
AES-256 CTR/GCM Ciphers
Every individual frame block is encrypted using unique dynamic initialization vectors (IV), preventing replay and bit-flipping attacks.
Canvas GPU Blitting
Zero DOM <video> tags and zero exposed blob URLs. Frames are decoded within volatile RAM and painted directly to GPU Canvas.
VSNX CLI Converter (vsnx2_converter.exe)
The standalone native binary vsnx2_converter.exe (C++ Native, OpenMP bounded multi-threading) handles automated encoding, binary encryption, and restoration workflows in CI/CD pipelines, Windows Server, and Linux worker environments.
Production Terminal Syntax:
Complete 13 Technical CLI Parameters Reference:
| Parameter / Flag | Type | Technical Function & Description | Default Value |
|---|---|---|---|
| encode <in> <out> | Subcommand | Packages and encrypts source media (MP4, MOV ProRes, MKV, FLV) into binary .vsnx. |
Required |
| decode <in> <out> | Subcommand | Decrypts and restores a .vsnx container back into standard MP4 (requires key if encrypted). |
Optional |
| --password <str> | String | Binary AES-256 CTR block cipher password. If omitted, file operates in Zero-Leak Public mode. | None (Public) |
| --vfr | Flag | Enables adaptive Variable Frame Rate, reducing static slide lecture bandwidth by up to 60%. | false |
| --gabor | Flag | Injects pseudo-random Gabor micro-texture noise to defeat screen recording encoders & compression. | false |
| --fast-start | Flag | Places container header metadata at file start, enabling instantaneous playback over HTTP byte ranges. | false |
| --cclc | Flag | Applies Color Curve & Luminance Compression for optimized visual contrast. | false |
| --watermark <str> | String | Embeds invisible steganographic forensic watermark (Tier 2) into the DCT/pixel domain to trace leaks. | None |
| --quality <1-100> | Integer | Quantizer compression rate (CRF). Range from 1 (maximum compression) to 100 (ProRes lossless). | 80 |
| --gop <frames> | Integer | Group of Pictures keyframe distance. Dictates sub-frame seeking latency across timelines. | 30 |
| --audio-preset <p> | String | Audio pipeline profile: standard (128k), voice (64k noise-gate), high (256k), lossless. |
standard |
| --audio-codec <c> | String | Target audio encoder codec: aac, opus, pcm. |
aac |
| --threads <n> | Integer | Concurrent CPU worker threads (OpenMP bounded with memory exhaustion prevention guards). | 4 |
Studio GUI Converter (gui_converter.exe)
Native Win32 C++ desktop application tailored for course instructors and video editors. Boots in 0.1s, consumes under 20MB RAM, and delivers granular encoding controls through an intuitive graphical interface without bloated Electron layers.
Advanced Win32 Parameter Controls:
- • Quality Slider (1 - 100): Smooth real-time quantization control for high-fidelity exports.
- • GOP Keyframe Spin-box: Custom keyframe intervals optimized for instant sub-second timeline seeking.
-
•
Proprietary Technology Toggles: Dedicated checkboxes for
VFR Mode,Gabor Noise,Fast-Start, andCCLC Optimization. - • Audio Presets & Forensic Watermark: Dropdown audio pipeline selection and Steganographic Invisible Watermark entry field.
Instant Validation via Desktop Player:
Features a 1-click "Open in Player" test button. Upon encode completion, the app immediately launches the native offline player vsnx2_player_gui.exe to verify encrypted playback, audio streams, and watermarks directly in volatile RAM before uploading to the cloud.
Embedding VSNX Web Player
The vsnx2-player.js library is a zero-dependency, standalone JavaScript SDK with zero third-party requirements.
Visual HTML Tags & Code Implementations:
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2-Tier Watermark Security Architecture
VSNX delivers defense-in-depth through dual watermark security: Tier 1 (Visual Dynamic WebGL Canvas) for real-time visual deterrence on client browsers, and Tier 2 (Invisible Forensic Steganography) embedded into video DCT pixels for immutable leak provenance.
Tier 1: Dynamic Canvas Watermark
Client WebGLRendered directly within the WebGL Canvas GPU context in real time. Coordinates drift pseudo-randomly across the viewport every few seconds. Non-existent in the DOM tree, neutralizing 100% of DevTools manipulation and ad-blockers.
Tier 2: Forensic Invisible Steganography
Native Pixel CoreConcealed watermark permanently embedded into the DCT frequency domain during encoding. Imperceptible to the human eye, yet resilient against off-angle smartphone screen recordings, aggressive re-encoding, and cropping.
Tier 1 Watermark Configuration (Visual Dynamic WebGL):
Tier 2 Forensic Extraction (vsnx2_forensic_extract.exe):
When a pirated or leaked video recording is discovered, run the native forensic extractor to recover concealed student attribution payloads:
Backend Authentication API (Private Tokens)
For private video assets, the decryption key is never hardcoded. Instead, the player exchanges a short-lived, signed JWT session token with your backend auth endpoint via volatile RAM.
decryption_key only exists within the active Web Worker execution context. The moment playback terminates or the browser tab closes, in-memory keys are purged instantly with zero trace in local storage or browser caches.
JavaScript API Reference & Keyboard Shortcuts
Comprehensive developer documentation for the VSNX Web Player SDK v2.4. Complete programmatic control over memory-isolated Canvas video decoding, dynamic AES-256 CTR decryption key injection, sub-frame seeking, mini playlists, multi-track subtitles, lossless 1:1 PNG snapshots, and a full suite of keyboard shortcuts.
7.1 Player Initialization (Constructor & Options)
Instantiate the player using new VsnxPlayer(options) with comprehensive configuration parameters controlling canvas rendering, encrypted binary streams, and security watermarks.
| Option | Type | Default | Description |
|---|---|---|---|
| container | string | HTMLElement | Required | CSS Selector (e.g., "#vsnx-viewport") or DOM element hosting the Canvas Player. |
| src | string | Required | Direct URL or relative path to the encrypted .vsnx binary container file. |
| credentials | string | "" | AES-256 CTR decryption key or session token injected strictly into volatile RAM. |
| autoplay | boolean | false | Starts playback immediately upon binary header validation (subject to browser autoplay policies). |
| loop | boolean | false | Automatically rewinds and replays from frame 0 when the video reaches its final frame. |
| volume | number | 1.0 | Initial Web Audio master volume level, normalized between 0.0 (muted) and 1.0 (max). |
| playbackRate | number | 1.0 | Initial playback speed rate (supports continuous speed range from 0.25x to 3.0x). |
| watermark | object | null | Dynamic anti-screen recording watermark: { text, dynamic, interval, opacity, fontSize }. |
| subtitles | Array<Track> | [] | Initial subtitle tracks array: [{ id, label, lang, default, cues }]. |
| playlist | Array<Item> | [] | Course lesson items array: [{ title, src, credentials }]. |
| controls | object | defaultConfig | Custom visibility map for bottom toolbar action buttons and controls. |
const player = new VsnxPlayer({
container: '#video-container',
src: 'https://cdn.example.com/courses/lesson_01.vsnx',
credentials: 'Aes256SecretDecryptionKey2026',
autoplay: false,
loop: false,
volume: 0.85,
playbackRate: 1.0,
watermark: {
text: 'STUDENT: John Doe • ID: 10892',
dynamic: true,
interval: 4000,
opacity: 0.3
}
});
7.2 Method Reference Suite (10 Core API Categories)
1. Playback & Seeking Controls
| Method | Parameters | Returns | Description |
|---|---|---|---|
| player.play() | None | Promise<void> | Starts or resumes in-memory binary decoding and Canvas/Audio rendering. |
| player.pause() | None | void | Pauses video frame decoding, suspends Web Audio context, and freezes current canvas. |
| player.togglePlay() | None | void | Toggles between play and pause states. |
| player.seek(seconds) | seconds: number | void | Executes sub-frame precision seek to exact timestamp with ultra-low latency (<8ms). |
| player.skip(offset) | offset: number | void | Jumps relative forward or backward by seconds (e.g. +10, -10, +5, -5). |
2. Audio Pipeline Controls
| Method | Parameters | Returns | Description |
|---|---|---|---|
| player.setVolume(level) | level: number (0.0 - 1.0) | void | Sets linear master gain output on the Web Audio API context. |
| player.getVolume() | None | number | Returns current volume level between 0.0 and 1.0. |
| player.toggleMute() | None | boolean | Toggles audio mute state. Returns true if currently muted. |
3. Playback Rate & Canvas Display
| Method | Parameters | Returns | Description |
|---|---|---|---|
| player.setPlaybackRate(rate) | rate: number (0.25 - 3.0) | void | Adjusts continuous playback speed between 0.25x and 3.0x with active pitch preservation. |
| player.getPlaybackRate() | None | number | Returns current playback speed multiplier (default: 1.0). |
| player.toggleFlip() | None | void | Flips canvas video rendering horizontally (Mirror Flip), ideal for dance, fitness, and training courses. |
4. Multi-Track Subtitles API
| Method | Parameters | Returns | Description |
|---|---|---|---|
| player.addSubtitleTrack(track) | track: object | void | Dynamically registers a subtitle track: { id, label, lang, cues: [{ start, end, text }] }. |
| player.setSubtitleTrack(trackId) | trackId: string | void | Activates a subtitle track by ID (e.g. 'en', 'vi') or pass 'none' to disable. |
| player.getSubtitleTracks() | None | Array<Track> | Returns an array of all registered subtitle tracks. |
| player.getCurrentSubtitleTrack() | None | Track | null | Returns the active subtitle track object rendered onto the canvas. |
| player.toggleSubtitles() | None | void | Quick toggle for turning current subtitles on or off. |
5. Mini Playlist API
| Method | Parameters | Returns | Description |
|---|---|---|---|
| player.setPlaylist(items) | items: Array<Item> | void | Loads multi-video course playlist with distinct credentials: [{ title, src, credentials }]. |
| player.next() | None | void | Advances to the next video item in the active playlist. |
| player.prev() | None | void | Returns to previous video item in the playlist. |
| player.playIndex(index) | index: number | void | Plays specific lesson at zero-based index within the playlist. |
| player.togglePlaylist() | None | void | Toggles the Mini Playlist sliding overlay drawer open or closed. |
6. Security, Credentials & RAM Buffer
| Method | Parameters | Returns | Description |
|---|---|---|---|
| player.setCredentials(key) | key: string | void | Injects AES-256 CTR decryption key directly into worker RAM to unlock protected streams. |
| player.load(src, credentials) | src: string, key?: string | Promise<void> | Loads new .vsnx video stream and credentials without page reloads. |
| player.getLoadedProgress() | None | number (0.0 - 1.0) | Returns current buffered binary chunk percentage in memory (ratio 0.0 to 1.0). |
| player.setLoadedProgress(pct) | pct: number (0.0 - 1.0) | void | Updates UI buffer progress indicator when chunks arrive from Web Worker. |
7. UI, Snapshot & PiP Utilities
| Method | Parameters | Returns | Description |
|---|---|---|---|
| player.takeSnapshot() | None | string (DataURL) | Captures current Canvas frame as lossless 1:1 PNG file and triggers instant download. |
| player.togglePip() | None | Promise<void> | Requests or exits native browser Picture-in-Picture window mode. |
| player.toggleFullscreen() | None | void | Toggles full-screen display mode for the player container. |
| player.toggleLoop() | None | boolean | Toggles infinite loop replay mode. Returns new loop state. |
| player.toggleStats() | None | void | Toggles real-time HUD performance overlay (FPS, Dropped Frames, Bitrate, Memory). |
| player.setLanguage(lang) | lang: 'en' | 'vi' | void | Switches toolbar UI and tooltip language localization. |
8. Controls Toolbar Customization
| Method | Parameters | Returns | Description |
|---|---|---|---|
| player.setControlVisibility(name, show) | name: string, show: boolean | void | Hides or shows specific control button ('play', 'volume', 'speed', 'subtitles', 'snapshot', 'pip', 'fullscreen', 'flip'). |
| player.setControlsConfig(config) | config: object | void | Batch updates the visibility configuration of all toolbar buttons. |
| player.getControlsConfig() | None | object | Returns current toolbar button visibility settings map. |
| player.resetControlsConfig() | None | void | Restores all toolbar controls to factory default visibility. |
9. Lifecycle & Resource Deallocation
| Method | Parameters | Returns | Description |
|---|---|---|---|
| player.destroy() | None | void | Terminates Web Workers, cleans WebGL/2D context, wipes AES keys from RAM, and removes all DOM event listeners. |
7.3 Player Events & Callbacks
Listen to playback lifecycle events using player.on(eventName, callback) or define handlers directly inside constructor options.
| Event Name | Callback Parameters | Trigger Condition |
|---|---|---|
| onReady | None | Fires when VSNX binary headers are parsed and first frame is ready to render. |
| onPlay | None | Fires when video stream starts or resumes playback. |
| onPause | None | Fires when playback is paused by user or programmatically. |
| onTimeUpdate | (currentTime, duration) | Fires on every rendered frame with current playback timestamp and total duration. |
| onProgress | (bufferedRatio) | Fires when binary chunk is buffered into memory (value between 0.0 and 1.0). |
| onEnded | None | Fires when video reaches the final frame (when loop is disabled). |
| onError | (error: { code, message }) | Fires when stream encounters decryption failure, invalid format magic, or network errors. |
7.4 Exhaustive Keyboard Shortcuts Reference
VSNX Web Player incorporates standard international video keyboard controls, enabling rapid hotkey navigation for high-efficiency learning workflows:
| Shortcut Key | Action | Description |
|---|---|---|
| Space or K | Play / Pause | Toggles video playback instantly with zero frame stutter. |
| ← / → | Seek ±5 seconds | Seeks backward or forward by 5 seconds with sub-8ms latency. |
| J / L | Seek ±10 seconds | Quick-jump rewind 10s (J) or forward 10s (L). |
| ↑ / ↓ | Volume ±5% | Increases or decreases audio output volume by 5% with HUD indicator. |
| M | Mute / Unmute | Toggles audio output mute status on and off. |
| F | Fullscreen | Toggles canvas container fullscreen view mode. |
| P | Picture-in-Picture | Toggles floating Picture-in-Picture overlay window. |
| S | Capture Snapshot | Instantly captures current canvas frame as a lossless 1:1 PNG image. |
| > / < | Speed ±0.25x | Increases or decreases playback speed (Shift + . or Shift + ,) across 0.25x - 3.0x. |
| D | Toggle Subtitles | Cycles through available subtitle tracks or turns them off. |
| I | HUD Technical Stats | Toggles overlay displaying real-time FPS, dropped frame count, and RAM cache. |
| 0 – 9 | Jump to % Duration | Instantly jumps to position from 0% (beginning) to 90% of total video duration. |
| Home / End | Beginning / End | Seeks to frame 0 or jumps to the last frame of the video. |
| Right Click | Anti-Theft Context Menu | Suppresses browser inspection and video saving options; displays proprietary VSNX menu. |
Troubleshooting & FAQ
CORS Issue When Loading .vsnx from CDN?
Because the player requests binary byte ranges via fetch(), your CDN bucket (S3, R2) must allow:
Access-Control-Allow-Origin: * and Access-Control-Allow-Headers: Range.
Audio Not Playing on iOS Safari Without User Interaction?
iOS Safari enforces strict autoplay restrictions on the Web Audio API. Audio playback resumes automatically upon the first viewer tap on the canvas play control.
How Does VSNX Handle Browser DevTools (F12) Opening?
The player monitors window dimensions and debugger breakpoints. When developer tools are opened, the canvas buffer instantly blurs or freezes with an alert overlay.