@bitmovin/player-integration-conviva

中文文档
6.3.0发布于 2026/06/18MITTypeScriptCommonJS零依赖近 30 天下载 2万

Conviva analytics integration for the Bitmovin Player

原始使用文档
文档目录11 节
  1. Maintenance and Update
  2. Contributions to this project
  3. Reporting player bugs
  4. Need more help?
  5. Support and SLA Disclaimer
  6. Compatibility
  7. Getting Started
  8. Installation
  9. Developing
  10. Usage
  11. Advanced Usage

Bitmovin Player Conviva Analytics Integration

This is an open-source project to enable the use of a third-party component (Conviva) with the Bitmovin Player Web SDK.

Maintenance and Update

This project is not part of a regular maintenance or update schedule and is updated once yearly to conform with the latest product versions. For additional update requests, please take a look at the guidance further below.

Contributions to this project

As an open-source project, we are pleased to accept any and all changes, updates and fixes from the community wishing to use this project. Please see CONTRIBUTING.md for more details on how to contribute.

Reporting player bugs

If you come across a bug related to the player, please raise this through your support ticketing system.

Need more help?

Should you want some help updating this project (update, modify, fix or otherwise) and cant contribute for any reason, please raise your request to your bitmovin account team, who can discuss your request.

Support and SLA Disclaimer

As an open-source project and not a core product offering, any request, issue or query related to this project is excluded from any SLA and Support terms that a customer might have with either Bitmovin or another third-party service provider or Company contributing to this project. Any and all updates are purely at the contributor's discretion.

Thank you for your contributions!

Compatibility

This version of the Conviva Analytics Integration works only with Player Version >= 8.31.x. The recommended and tested version of the Conviva SDK is 4.5.7. See CHANGELOG.md for details.

Getting Started

Installation

Using NPM

Install the npm package:

npm i @bitmovin/player-integration-conviva --save-dev

Using custom build

Build the JS file by running npm run build

Developing

  1. Clone Git repository
  2. Install node.js
  3. Install required npm packages: npm install
  4. Run tasks:
  • npm run lint to lint TypeScript files as well as CHANGELOG.md
  • npm run build to build project into dist directory
  • npm run start to open test page in browser, build and reload changed files automatically
  • npm run format to run prettier and auto-format all code files
  • npm run test to run tests

Usage

  1. Include conviva-core-sdk.min.js as first of all scripts in your HTML document

  2. Create an instance of ConvivaAnalytics before calling player.load(...) and pass in your Conviva CUSTOMER_KEY and optional configuration properties:

    1. Using NPM import:

      1. Import ConvivaAnalytics:

        import { ConvivaAnalytics } from '@bitmovin/player-integration-conviva';
        
      2. Usage

        const playerConfig = {
          key: 'YOUR-PLAYER-KEY',
          // ...
        };
        
        const player = new Player(document.getElementById('player'), playerConfig);
        const conviva = new ConvivaAnalytics(player, 'CUSTOMER_KEY', {
          debugLoggingEnabled: true, // optional
          gatewayUrl: 'https://youraccount-test.testonly.conviva.com', // optional, TOUCHSTONE_SERVICE_URL for testing
          deviceCategory: Conviva.Client.DeviceCategory.WEB, // optional, deprecated (Use deviceMetadata.category) (default: WEB)
          deviceMetadata: {
            // optional (default: let Conviva backend infer these fields from User Agent string)
            category: Conviva.Client.DeviceCategory.WEB, // optional (default: WEB)
            brand: 'Device brand', // optional
            manufacturer: 'Device Manufacturer', // optional
            model: 'Device Model', // optional
            type: Conviva.Client.DeviceType.DESKTOP, // optional
            version: 'Device version', // optional
            osName: 'Operating system name', // optional
            osVersion: 'Operating system version', // optional
          },
        });
        
        var sourceConfig = {
          // ...
        };
        
        player.load(sourceConfig).then(
          function () {
            console.log('player loaded');
          },
          function (reason) {
            console.error('player setup failed', reason);
          },
        );
        
    2. Using custom Build:

      1. Include bitmovinplayer-analytics-conviva.js after conviva-core-sdk.min.js in your HTML document

      2. Usage

        var playerConfig = {
          key: 'YOUR-PLAYER-KEY',
          // ...
        };
        
        var container = document.getElementById('player');
        var player = new bitmovin.player.Player(container, playerConfig);
        
        // A ConvivaAnalytics instance is always tied to one player instance
        var conviva = new bitmovin.player.analytics.ConvivaAnalytics(player, 'CUSTOMER_KEY', {
          debugLoggingEnabled: true, // optional
          gatewayUrl: 'https://youraccount-test.testonly.conviva.com', // optional, TOUCHSTONE_SERVICE_URL for testing
          deviceCategory: Conviva.Client.DeviceCategory.WEB, // optional, (default: WEB)
        });
        
        var sourceConfig = {
          // ...
        };
        
        player.load(sourceConfig).then(
          function () {
            console.log('player loaded');
          },
          function (reason) {
            console.error('player setup failed', reason);
          },
        );
        
  3. Release the instance by calling conviva.release() before destroying the player by calling player.destroy()

Advanced Usage

VPF tracking

If you would like to track custom VPF (Video Playback Failures) events when no actual player error happens (e.g. the server closes the connection and return net::ERR_EMPTY_RESPONSE or after a certain time of stalling) you can use following API to track those deficiencies.

conviva.reportPlaybackDeficiency('Some Error Message', Conviva.Client.ErrorSeverity.FATAL);

See ConvivaAnalytics.ts for parameter details.

Conviva suggests an timeout of about ~10 seconds and before reporting an error to conviva and providing feedback the user.

Content Metadata handling

If you want to override some content metadata attributes you can do so by adding the following:

let metadataOverrides = {
  applicationName: 'App Name',
  viewerId: 'uniqueViewerId',
  custom: {
    customTag: 'customValue',
  },
  // Find the list here https://pulse.conviva.com/learning-center/content/sensor_developer_center/sensor_integration/javascript/js_quick_integration.htm
  // under "Constants for Pre-defined Video and Content Metadata"
  additionalStandardTags: {
    'c3.cm.channel': 'Test Channel',
    'c3.cm.brand': 'Test Brand',
  },
  encodedFrameRate: 24,
  // …
};

// …
// Initialize ConvivaAnalytics
// …

conviva.updateContentMetadata(metadataOverrides);

Those values will be cleaned up after the session is closed.

See ConvivaAnalytics.ts for details about more attributes.

If you need to configure Conviva-managed metadata separately from custom metadata, use the dedicated APIs:

conviva.updateRequiredContentMetadata({
  assetName: 'My Asset',
  viewerId: 'uniqueViewerId',
  streamType: Conviva.ContentMetadata.StreamType.UNKNOWN,
});

conviva.updateCustomContentMetadata({
  custom: {
    streamType: 'dash_vod',
    customTag: 'customValue',
  },
  additionalStandardTags: {
    'c3.cm.channel': 'Test Channel',
  },
});

This is useful when you want to send Conviva's required streamType values (UNKNOWN, VOD, LIVE) and also send an arbitrary custom streamType tag in parallel.

Consecutive playback

If you want to use the same player instance for multiple playback, just load a new source with player.load(…). The integration will close the active session.

player.load({…});

External VST tracking

If your app needs additional setup steps which should be included in VST tracking, such as DRM token generation, before the Player instance can be initialized, the ConvivaAnalytics can be initialized without a Player instance. Once the Player instance is created it can be attached.

  1. Create the ConvivaAnalytics instance with your customerKey and configuration.
const convivaAnalytics = new ConvivaAnalytics(undefined, customerKey);
  1. Conviva requires that the assetName is set at session initialization. Therefore ensure that you provide using the metadata overrides before initializing the tracking session.
convivaAnalytics.updateRequiredContentMetadata({
  assetName: 'Your Asset Name',
});

// Initialize tracking session
convivaAnalytics.initializeSession();
  1. Once your Player instance is ready attach it to the ConvivaAnalytics instance.
// ... Additional setup steps

const player = new bitmovin.player.Player(document.getElementById('player'), getPlayerConfig());
convivaAnalytics.attachPlayer(player);

版本与发布记录

@bitmovin/player-integration-conviva 共发布 29 个版本,首次发布于 2019/03/08;过去 12 个月发布了 3 个版本。

版本发布日期距今
6.3.0latest2026/06/184 个月前
6.2.02026/03/187 个月前
6.1.52026/02/258 个月前
6.1.32025/11/061 年前
6.1.22024/12/241.9 年前
6.1.12024/12/191.9 年前

关于 @bitmovin/player-integration-conviva 的常见问题

@bitmovin/player-integration-conviva 是什么?

Conviva analytics integration for the Bitmovin Player

如何安装 @bitmovin/player-integration-conviva?

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

@bitmovin/player-integration-conviva 支持 TypeScript 吗?

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

@bitmovin/player-integration-conviva 支持 ESM 还是 CommonJS?

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

@bitmovin/player-integration-conviva 可以商用吗?

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

@bitmovin/player-integration-conviva 的下载量有多少?

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

@bitmovin/player-integration-conviva 还在维护吗?

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