@een/live-video-web-sdk

中文文档
1.10.2发布于 2025/07/08UNLICENSEDTypeScriptCommonJS零依赖近 30 天下载 2.2万

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.

原始使用文档
文档目录7 节
  1. Installation
  2. Quick Start
  3. Configuration Options
  4. API Methods
  5. Core Methods
  6. Audio Control (WebCodecs only)
  7. Buffer Management (WebCodecs only)

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-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

版本与发布记录

@een/live-video-web-sdk 共发布 48 个版本,首次发布于 2023/02/20;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.10.2latest2025/07/081.3 年前
1.10.12025/07/031.4 年前
1.10.02025/06/241.4 年前
1.9.22025/06/191.4 年前
1.9.12025/06/161.4 年前
1.9.02025/06/121.4 年前

其他发布通道:next → 1.6.1。

关于 @een/live-video-web-sdk 的常见问题

@een/live-video-web-sdk 是什么?

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.

如何安装 @een/live-video-web-sdk?

在项目目录运行 npm install @een/live-video-web-sdk,或使用 pnpm add / yarn add / bun add。

@een/live-video-web-sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@een/live-video-web-sdk 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@een/live-video-web-sdk 可以商用吗?

@een/live-video-web-sdk 使用 UNLICENSED 许可。作者声明为 UNLICENSED,即不授予公开使用许可(与公共领域的 Unlicense 不同)。使用前需获得作者授权。以上为概括,不构成法律意见,请以许可原文为准。

@een/live-video-web-sdk 的下载量有多少?

根据 npm 官方下载统计,@een/live-video-web-sdk 在 2026/10/13 – 2026/11/11 这 30 天内被下载 21,530 次,日均约 718 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@een/live-video-web-sdk 还在维护吗?

最新版本 1.10.2 发布于 2025/07/08(1.3 年前);至今共发布 48 个版本,其中过去 12 个月发布了 0 个;首次发布于 2023/02/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。