@een/live-video-web-sdk
v1.10.2
Published
This package allows EEN users to incorporate live video on their web solution. Copyright (C) 2025 Eagle Eye Network B.V. - [email protected]. This software can not be copied and/or distributed without the express permission of Eagle Eye Networks.
Keywords
Readme
Eagle Eye Networks Live Video Web SDK
Copyright (C) 2025 Eagle Eye Network B.V. - [email protected]
This package allows EEN users to incorporate live video on their web solution. Copyright (C)
2025 Eagle Eye Network B.V. - [email protected] This software can not be copied and/or distributed
without the express permission of Eagle Eye Networks.
Installation
Note: This is the development documentation. For the npm package documentation, please refer to the README.md file included in the published package.
npm install @een/live-video-web-sdkQuick Start
import VideoPlayer from '@een/live-video-web-sdk';
const player = new VideoPlayer({
jwt: 'your-jwt-token',
cameraId: 'your-camera-id',
videoElement: document.getElementById('video') as HTMLVideoElement,
onError: (error) => console.error('Player error:', error),
onFrame: (time) => console.log('Frame rendered at:', time)
});
await player.start();Configuration Options
interface Config {
cameraId?: string; // Camera identifier
jwt: string; // Authentication JWT token
videoElement?: HTMLVideoElement; // Target video element
canvasElement?: HTMLCanvasElement; // Target canvas (WebCodecs only)
maxBuffer?: number; // Maximum buffer size (0-10000ms)
minBuffer?: number; // Minimum buffer size (default: 1000ms)
videoTech?: "WebCodecs" | "FLV"; // Preferred playback technology
feedUrl?: string; // Direct feed URL (optional)
baseUrl?: string; // API base URL (auto-detected from JWT)
eenUniqueId?: string; // EEN system unique identifier
// Event Callbacks
onFrame?: (time: number) => void;
onStop?: () => void;
onAudio?: () => void;
onSwitchToFlv?: () => void;
onError?: (error: VideoPlayerError) => void;
onWarning?: (warning: VideoPlayerWarning) => void;
}The SDK provides comprehensive error categorization:
Configuration Errors
CONFIG_INVALID_JWT- Invalid or missing JWT tokenCONFIG_INVALID_VIDEO_TECH- Invalid video technology specifiedCONFIG_CANVAS_WITHOUT_WEBCODECS- Canvas element used without WebCodecsCONFIG_DUAL_VIDEO_TARGETS- Both video element and canvas providedCONFIG_INVALID_BUFFER_SIZE- Buffer size outside valid rangeCONFIG_MISSING_FEED_PARAMS- Missing required feed parameters
Network Errors
NETWORK_FEED_FETCH_ERROR- Failed to fetch video feedNETWORK_JWT_DECODE_ERROR- JWT decoding failedNETWORK_STREAM_REQUEST_ERROR- Stream request failedNETWORK_CONNECTION_ERROR- Network connection errorNETWORK_STREAM_WARNING- Stream warning (non-fatal)
Player Errors
PLAYER_START_WHILE_PLAYING- Attempted to start while already playingPLAYER_MULTIPART_STREAM_ERROR- Multipart stream errorPLAYER_FLV_START_ERROR- FLV player initialization errorPLAYER_HARDWARE_ACCELERATION_ERROR- Hardware acceleration error
WebCodecs Errors
WEBCODECS_VIDEO_DECODER_ERROR- Video decoder errorWEBCODECS_AUDIO_DECODER_ERROR- Audio decoder errorWEBCODECS_AUDIO_RENDER_ERROR- Audio rendering errorWEBCODECS_VIDEO_RENDER_ERROR- Video rendering errorWEBCODECS_AUDIO_CONFIG_ERROR- Audio configuration errorWEBCODECS_FRAME_PROCESSING_ERROR- Frame processing error
API Methods
Core Methods
// Start video playback
await player.start(config?: Config): Promise<void>
// Stop video playback
player.stop(): void
// Check if currently playing
player.isPlaying(): booleanAudio Control (WebCodecs only)
// Audio muting
player.getAudioMuted(): boolean
player.setAudioMuted(muted: boolean): void
player.toggleMute(): void
// Volume control (0.0 - 1.0)
player.getAudioVolume(): number
player.setAudioVolume(volume: number): void
// Audio error checking
player.getAudioPlaybackError(): anyBuffer Management (WebCodecs only)
// Buffer configuration
player.setMaxBuffer(ms: number): void
player.setMinBuffer(ms: number): void
player.getBufferLength(): number