@dolby-optiview/ads-sdk-adapter-theoplayer

中文文档
1.6.0发布于 2026/11/13SEE LICENSE AT https://optiview.dolby.com/policies/terms-of-service/TypeScriptCommonJS近 30 天下载 2.8万

THEOplayer adapter for OptiView Ads SDK

原始使用文档
文档目录5 节
  1. Installation
  2. Usage
  3. THEOlive sources
  4. Documentation
  5. License

@dolby-optiview/ads-sdk-adapter-theoplayer

THEOplayer Web SDK PlayerAdapter for the OptiView Ads SDK. It connects a ChromelessPlayer (or full Player) and its mount element to the SDK core, either as the content player or as the ad player.

Installation

npm install @dolby-optiview/ads-sdk-core @dolby-optiview/ads-sdk-adapter-theoplayer theoplayer

theoplayer 9.0.0 or newer is a peer dependency. The adapter is typed against the structural THEOplayerLike interface, so it also works with a THEOplayer build loaded from a script tag. A THEOplayer license is required.

Usage

import { ChromelessPlayer } from 'theoplayer';
import { OptiViewAds } from '@dolby-optiview/ads-sdk-core';
import { THEOplayerAdapter } from '@dolby-optiview/ads-sdk-adapter-theoplayer';

const config = { license: LICENSE, libraryLocation: LIB, mutedAutoplay: 'all' };

const playerDiv = document.getElementById('player') as HTMLElement;
const player = new ChromelessPlayer(playerDiv, config);

const sdk = new OptiViewAds({
  player: new THEOplayerAdapter(player, playerDiv),
  container: document.getElementById('container')!,
  createAdAdapter: (adContainer) => {
    const adPlayer = new ChromelessPlayer(adContainer, config);
    return new THEOplayerAdapter(adPlayer, adContainer);
  },
});

await sdk.startSession({
  manifestUrl: 'https://manifest.example.com/v1/your-org/channels/your-channel',
});
player.source = { sources: [{ src: 'https://example.com/live.m3u8' }] };
player.play();

THEOlive sources

For a THEOlive source the adapter reads the ads manifest URL from the THEOlive discovery response, so manifestUrl can be omitted. Opt in with manifestUrlDiscovery: true (off by default) and create the SDK before you set the source:

const sdk = new OptiViewAds({ player: new THEOplayerAdapter(player, playerDiv), manifestUrlDiscovery: true /* … */ });
player.source = { sources: [{ type: 'theolive', src: 'your-distribution-id' }] };
await sdk.startSession({});

startSession() waits up to 10 seconds for discovery and rejects when the response has no ads manifest URL. An explicit manifestUrl always wins.

For React Native apps using react-native-theoplayer, use @dolby-optiview/ads-sdk-react-native instead of this package.

Documentation

License

See https://optiview.dolby.com/policies/terms-of-service/.

版本与发布记录

@dolby-optiview/ads-sdk-adapter-theoplayer 共发布 15 个版本,首次发布于 2026/09/09;过去 12 个月发布了 15 个版本。

版本发布日期距今
1.6.0latest2026/11/13今天
1.5.12026/11/067 天前
1.4.02026/11/058 天前
1.3.02026/10/2816 天前
1.2.12026/10/2321 天前
1.2.02026/10/2321 天前

其他发布通道:next → 1.0.0-beta.6。

关于 @dolby-optiview/ads-sdk-adapter-theoplayer 的常见问题

@dolby-optiview/ads-sdk-adapter-theoplayer 是什么?

THEOplayer adapter for OptiView Ads SDK

如何安装 @dolby-optiview/ads-sdk-adapter-theoplayer?

在项目目录运行 npm install @dolby-optiview/ads-sdk-adapter-theoplayer,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:theoplayer(>=9.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@dolby-optiview/ads-sdk-adapter-theoplayer 支持 TypeScript 吗?

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

@dolby-optiview/ads-sdk-adapter-theoplayer 支持 ESM 还是 CommonJS?

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

@dolby-optiview/ads-sdk-adapter-theoplayer 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@dolby-optiview/ads-sdk-adapter-theoplayer 可以商用吗?

@dolby-optiview/ads-sdk-adapter-theoplayer 使用 SEE LICENSE AT https://optiview.dolby.com/policies/terms-of-service/ 许可。声明的许可为 SEE LICENSE AT https://optiview.dolby.com/policies/terms-of-service/,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@dolby-optiview/ads-sdk-adapter-theoplayer 的下载量有多少?

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

@dolby-optiview/ads-sdk-adapter-theoplayer 还在维护吗?

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