@criteo/video-player

中文文档
1.4.3发布于 2026/03/30TypeScriptES Module零依赖构建来源已验证近 30 天下载 3107

Lightweight video player with ad support

原始使用文档
文档目录5 节
  1. Criteo video player
  2. Purpose
  3. Usage
  4. Viewability measurement
  5. Integration Guide

Criteo video player

Purpose

This library aims at rendering ad videos with a vast file (either by content or by URL). You can import this library as a package or as a file. Both are provided in the examples

Usage

There are two examples in the examples/ folder of how to use the library. You could either install it with npm or you can directly include the bundled script file and css in an html file.

The package provides two APIs to render your videos.

  • From URL: criteoVideoPlayerFromUrl. The script will fetch the VAST file from the URL and afterwards display the video.
  • From content: criteoVideoPlayerFromContent. The script will use the passed file content (expecting a stringified XML) and afterwards display the video.

For each, you should provide a video element which should be an HTML element in which you want the video to be rendered.

Viewability measurement

To support viewability measurement, the IAB Open Measurement SDK (OM SDK) for Web requires two scripts:

  • omweb-v1.js – the OMID JS library for the web context.
  • omid-session-client-v1.js – used by integration partners to perform ad session activities in the JavaScript layer.

Per IAB requirements, each retailer must obtain their own build of these scripts from the IAB Tech Lab Tools Portal. This ensures the SDK is correctly registered to your organization and remains up to date with the official specification.

Steps to download your scripts:

  1. Log in or register at the IAB Tech Lab Tools Portal.
  2. Navigate to the Open Measurement SDK for Web section.
  3. Generate and download your OMSDK_<YourRetailerName> package.
  4. Host the downloaded files in your environment or reference them from your own CDN.

Integration Guide

Learn more in our Criteo-Owned Video Player Integration guide to integrate this video player into your website to run video ads in web apps.

版本与发布记录

@criteo/video-player 共发布 15 个版本,首次发布于 2025/08/20;过去 12 个月发布了 6 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.4.3latest2026/03/307 个月前
1.4.22026/03/247 个月前
1.4.12026/01/139 个月前
1.4.02026/01/0710 个月前
1.3.02025/12/0911 个月前
1.2.22025/12/0611 个月前

关于 @criteo/video-player 的常见问题

@criteo/video-player 是什么?

Lightweight video player with ad support

如何安装 @criteo/video-player?

在项目目录运行 npm install @criteo/video-player,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:preact(^10.28.2)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@criteo/video-player 支持 TypeScript 吗?

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

@criteo/video-player 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@criteo/video-player 可以商用吗?

@criteo/video-player 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@criteo/video-player 的下载量有多少?

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

@criteo/video-player 还在维护吗?

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