1.9.0 • Published 4 months ago

@een/live-video-web-sdk v1.9.0

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
4 months ago

Eagle Eye Networks Live Video Web SDK

Copyright (C) 2025 Eagle Eye Network B.V. - sales@een.com
This package allows EEN users to incorporate live video on their web solution. Copyright (C) 2025 Eagle Eye Network B.V. - sales@een.com 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-sdk

Quick 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 token
  • CONFIG_INVALID_VIDEO_TECH - Invalid video technology specified
  • CONFIG_CANVAS_WITHOUT_WEBCODECS - Canvas element used without WebCodecs
  • CONFIG_DUAL_VIDEO_TARGETS - Both video element and canvas provided
  • CONFIG_INVALID_BUFFER_SIZE - Buffer size outside valid range
  • CONFIG_MISSING_FEED_PARAMS - Missing required feed parameters

Network Errors

  • NETWORK_FEED_FETCH_ERROR - Failed to fetch video feed
  • NETWORK_JWT_DECODE_ERROR - JWT decoding failed
  • NETWORK_STREAM_REQUEST_ERROR - Stream request failed
  • NETWORK_CONNECTION_ERROR - Network connection error
  • NETWORK_STREAM_WARNING - Stream warning (non-fatal)

Player Errors

  • PLAYER_START_WHILE_PLAYING - Attempted to start while already playing
  • PLAYER_MULTIPART_STREAM_ERROR - Multipart stream error
  • PLAYER_FLV_START_ERROR - FLV player initialization error
  • PLAYER_HARDWARE_ACCELERATION_ERROR - Hardware acceleration error

WebCodecs Errors

  • WEBCODECS_VIDEO_DECODER_ERROR - Video decoder error
  • WEBCODECS_AUDIO_DECODER_ERROR - Audio decoder error
  • WEBCODECS_AUDIO_RENDER_ERROR - Audio rendering error
  • WEBCODECS_VIDEO_RENDER_ERROR - Video rendering error
  • WEBCODECS_AUDIO_CONFIG_ERROR - Audio configuration error
  • WEBCODECS_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(): boolean

Audio 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(): any

Buffer Management (WebCodecs only)

// Buffer configuration
player.setMaxBuffer(ms: number): void
player.setMinBuffer(ms: number): void
player.getBufferLength(): number
1.5.5

9 months ago

1.9.0

4 months ago

1.8.1

4 months ago

1.6.3

4 months ago

1.5.4

9 months ago

1.8.0

4 months ago

1.6.2

4 months ago

1.7.0

4 months ago

1.6.1

5 months ago

1.6.0

5 months ago

1.5.1

11 months ago

1.5.9

5 months ago

1.5.8

5 months ago

1.5.7

5 months ago

1.5.6

9 months ago

1.5.3

1 year ago

1.5.2

1 year ago

1.5.0

1 year ago

1.4.16

1 year ago

1.4.15

1 year ago

1.4.14

2 years ago

1.4.13

2 years ago

1.4.12

2 years ago

1.4.11

2 years ago

1.4.10

2 years ago

1.4.6

2 years ago

1.4.5

2 years ago

1.4.4

2 years ago

1.4.3

2 years ago

1.4.9

2 years ago

1.4.8

2 years ago

1.3.7

3 years ago

1.3.5

3 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.10

3 years ago

1.3.9

3 years ago

1.3.8

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago