@eyevinn/video-event-filter

中文文档
2.0.0发布于 2022/04/27MITTypeScriptCommonJS近 30 天下载 2.5万

Video Event Filter ===

此软件包已被标记为弃用

Package no longer maintained, we recommend migrating to @eyevinn/media-event-filter

原始使用文档
文档目录4 节
  1. Difference vs default events
  2. Implementation
  3. Events
  4. States

Video Event Filter

A simple module to filter the events sent from the video element in a way that align with what is, most probably, expected from an analytics perspective.

Difference vs default events

The main differences that this filtering brings is

  • No pause is triggered while not playing. I.e. for seek, buffering or similar.
  • Instead of waiting event we have a proper buffering and buffered event flow.
  • timeupdate is only triggered during ongoing playback.
  • A play event after pause is now called resume to differ from the play event.

Implementation

  import { VideoEventFilter } from "@eyevinn/video-event-filter";

  const videoElement = document.querySelector("video");

  const videoEventFilter = new VideoEventFilter(videoElement);
  videoEventFilter.addEventListener("*", (event, data) => {
    console.log("EVENT:", event);
  });

Events

These are exposed as an Enum PlayerEvents.

  • loading
  • loaded, video have loaded, but not started
  • play, video have started to play
  • pause
  • resume, video have started to play after a pause
  • seeking
  • seeked, video is done seeking. Continue in the state that existed before.
  • buffering
  • buffered, video is done buffering. Continue in the state that existed before.
  • timeupdate
  • ended
  • error

States

You can also fetch the current state from the player, which will match the states exposed in PlayerState.

  import { VideoEventFilter } from "@eyevinn/video-event-filter";

  const videoElement = document.querySelector("video");
  const videoEventFilter = new VideoEventFilter(videoElement);

  const currentState = videoEventFilter.getState()

版本与发布记录

@eyevinn/video-event-filter 共发布 16 个版本,首次发布于 2020/11/24;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.0.0latest2022/04/274 年前
1.2.22022/04/214 年前
1.2.12022/03/114 年前
1.2.02022/03/104 年前
1.1.52022/03/084 年前
1.1.42022/03/084 年前

关于 @eyevinn/video-event-filter 的常见问题

@eyevinn/video-event-filter 是什么?

Video Event Filter ===注意:该包已被作者标记为弃用——Package no longer maintained, we recommend migrating to @eyevinn/media-event-filter

如何安装 @eyevinn/video-event-filter?

在项目目录运行 npm install @eyevinn/video-event-filter,或使用 pnpm add / yarn add / bun add。

@eyevinn/video-event-filter 支持 TypeScript 吗?

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

@eyevinn/video-event-filter 支持 ESM 还是 CommonJS?

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

@eyevinn/video-event-filter 可以商用吗?

@eyevinn/video-event-filter 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@eyevinn/video-event-filter 的下载量有多少?

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

@eyevinn/video-event-filter 还在维护吗?

最新版本 2.0.0 发布于 2022/04/27(4 年前);至今共发布 16 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/11/24。作者已将其标记为弃用,新项目建议寻找替代方案。