Unified Video Framework
Unified Video Framework, currently at version 1.4.570, is a cross-platform video player SDK developed by Flicknexs. It aims to provide a single, unified API for building OTT, FAST, VOD, and Live Streaming applications across various platforms, thereby eliminating the need to maintain separate players for different environments. While it supports Web (all modern browsers), its native implementations for iOS, Android (including React Native), Smart TVs (Samsung Tizen, LG webOS), and streaming devices (Roku, Android TV, Apple TV) are noted as "On Progress." This indicates active development and ongoing feature completion for these platforms. The framework differentiates itself by targeting comprehensive streaming use cases and offering a centralized solution for video platforms, supported by Flicknexs's broader white-label OTT infrastructure.
Common errors
-
Player element not found: #unified-player
cause The HTML element specified as the player container (`config.container`) does not exist in the DOM when the player is initialized, or its ID is incorrect.fixEnsure the target HTML element is rendered before the player initialization script runs. Verify the ID matches exactly, e.g., `<div id="unified-player"></div>`. -
Error: Unsupported video format or codec.
cause The provided video `source.url` points to a file with an unsupported format or codec for the current browser/platform, or the `source.type` is incorrect.fixVerify the video URL is accessible and the content type (`video/mp4`, `application/x-mpegURL`, `application/dash+xml`) matches the actual media format. Test with commonly supported formats first. Ensure any required DRM or adaptive streaming configurations are correctly applied. -
TypeScript Error: Property 'on' does not exist on type 'UnifiedVideoPlayer'.
cause The `UnifiedVideoPlayer` instance's event listener methods are not recognized, often due to an outdated type definition, incorrect import, or a change in the API for event handling.fixEnsure you are using the correct version of `@types/unified-video-framework` (if a separate types package exists) or that the `unified-video-framework` package is up-to-date. Refer to the official documentation for the correct event subscription API (e.g., `player.addEventListener('play', ...)` or `player.on('play', ...)`).
Warnings
- gotcha Key platforms like iOS/Android (Native/React Native), Smart TVs (Tizen, webOS), and Streaming Devices (Roku, Apple TV, Android TV) are explicitly listed as 'On Progress' in the README. This implies that the SDK's functionality, stability, and feature completeness on these platforms may not be fully mature or may change significantly.
- breaking Due to the 'On Progress' status for several core platforms, minor version updates may introduce breaking changes or require significant refactoring for platform-specific integrations as the API evolves and stabilizes. Always review release notes carefully.
- gotcha The framework's core value proposition is a 'unified API' across platforms. However, platform-specific integrations (e.g., DRM, advertising, native UI overlays) may still require platform-specific code or configurations that diverge from the unified API, especially for 'On Progress' platforms.
Install
-
npm install unified-video-framework -
yarn add unified-video-framework -
pnpm add unified-video-framework
Imports
- UnifiedVideoPlayer
const UnifiedVideoPlayer = require('unified-video-framework');import { UnifiedVideoPlayer } from 'unified-video-framework'; - PlayerConfig
import type { PlayerConfig } from 'unified-video-framework'; - VideoSource
import { UnifiedVideoPlayer, type VideoSource } from 'unified-video-framework';
Quickstart
import { UnifiedVideoPlayer } from 'unified-video-framework';
document.addEventListener('DOMContentLoaded', () => {
const playerElement = document.getElementById('unified-player');
if (!playerElement) {
console.error('Player element #unified-player not found in DOM.');
return;
}
// Example configuration, adjust as per actual API documentation
const config = {
container: playerElement,
source: {
url: 'https://cdn.example.com/your-video.mp4',
type: 'video/mp4' // Or 'application/x-mpegURL' for HLS, 'application/dash+xml' for DASH
},
autoplay: true,
controls: true,
// An API key might be required for certain features or backend services
// apiKey: process.env.UNIFIED_PLAYER_API_KEY ?? ''
};
try {
const player = new UnifiedVideoPlayer(config);
player.on('play', () => console.log('Video started playing.'));
player.on('ended', () => console.log('Video ended.'));
console.log('Unified Video Player initialized successfully.');
} catch (error) {
console.error('Failed to initialize Unified Video Player:', error);
}
});