@brightcove/player-url

中文文档
1.3.0发布于 2022/11/10Apache-2.0ESM + CJS零依赖近 30 天下载 27.5万

A module for getting a URL to a Brightcove Player.

原始使用文档
文档目录15 节
  1. Installation
  2. Usage
  3. ES Modules
  4. Browserify/CommonJS
  5. RequireJS/AMD
  6. <script> Tag
  7. Parameters
  8. accountId
  9. playerId
  10. embedId
  11. iframe
  12. minified
  13. base
  14. queryParams
  15. License

@brightcove/player-url

A module for getting a URL to a Brightcove Player.

Installation

npm install --save @brightcove/player-url

Usage

To include @brightcove/player-url on your website or web application, use any of the following methods.

ES Modules

When using in an ES modules-compatible environment or bundler like Rollup or webpack, install @brightcove/player-url via npm and import the plugin as you would any other module.

import brightcovePlayerUrl from '@brightcove/player-url';

const myPlayerUrl = brightcovePlayerUrl({
  accountId: '1234567890',
  playerId: 'abc123xyz'
});

console.log(myPlayerUrl); // https://players.brightcove.net/1234567890/abc123xyz_default/index.min.js

Browserify/CommonJS

When using with Browserify, install @brightcove/player-url via npm and require the plugin as you would any other module.

var brightcovePlayerUrl = require('@brightcove/player-url');

var myPlayerUrl = brightcovePlayerUrl({
  accountId: '1234567890',
  playerId: 'abc123xyz'
});

console.log(myPlayerUrl); // https://players.brightcove.net/1234567890/abc123xyz_default/index.min.js

RequireJS/AMD

When using with RequireJS (or another AMD library), get the script in whatever way you prefer and require the plugin as you normally would:

require(['@brightcove/player-url'], function(brightcovePlayerUrl) {
  var myPlayerUrl = brightcovePlayerUrl({
    accountId: '1234567890',
    playerId: 'abc123xyz'
  });

  console.log(myPlayerUrl); // https://players.brightcove.net/1234567890/abc123xyz_default/index.min.js
});

<script> Tag

This is the simplest case and least recommended. We expect most will bundle this module into an application or another module.

<script src="//path/to/brightcove-player-url.min.js"></script>
<script>
  var myPlayerUrl = brightcovePlayerUrl({
    accountId: '1234567890',
    playerId: 'abc123xyz'
  });

  console.log(myPlayerUrl); // https://players.brightcove.net/1234567890/abc123xyz_default/index.min.js
</script>

Parameters

This module takes the following parameters.

accountId

Required Type: string

A Brightcove account ID.

playerId

Type: string Default: "default"

A Brightcove player ID.

embedId

Type: string Default: "default"

A Brightcove player embed ID.

iframe

Type: boolean Default: false

Whether to return a URL for an HTML document to be embedded in an iframe.

minified

Type: boolean Default: true

When the iframe parameter is false, this can be used to control whether the minified or unminified JavaScript URL is returned.

base

Type: string Default: "https://players.brightcove.net"

A base CDN protocol and hostname. Mainly used for testing, but could have other uses. May have a trailing slash or not.

queryParams

Type: Object Default: null

When the iframe parameter is true, this can be used to add a query string to the URL with a whitelist of possible parameters:

  • adConfigId: A playback token that specifies which SSAI configuration, CDN and DVR options to use for a Brightcove Live stream.
  • applicationId: An application ID used to differentiate analytics across different uses of the same player.
  • catalogSearch: A Video Cloud catalog search to perform.
  • catalogSequence: A Video Cloud catalog sequence used to populate a playlist.
  • playlistId: A Video Cloud playlist ID to load.
  • playlistVideoId: A video ID at which to begin Video Cloud playlist playback.
  • videoId: A Video Cloud video ID to load.
  • interactivityProjectId: An Interactivity project ID to load.

License

Apache-2.0. Copyright (c) Brightcove, Inc.

版本与发布记录

@brightcove/player-url 共发布 5 个版本,首次发布于 2018/08/15;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.3.0latest2022/11/103 年前
1.2.02019/04/247 年前
1.1.12018/08/158 年前
1.1.02018/08/158 年前
1.0.02018/08/158 年前

关于 @brightcove/player-url 的常见问题

@brightcove/player-url 是什么?

A module for getting a URL to a Brightcove Player.

如何安装 @brightcove/player-url?

在项目目录运行 npm install @brightcove/player-url,或使用 pnpm add / yarn add / bun add。

@brightcove/player-url 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/brightcove__player-url 是否存在。

@brightcove/player-url 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@brightcove/player-url 可以商用吗?

@brightcove/player-url 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@brightcove/player-url 的下载量有多少?

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

@brightcove/player-url 还在维护吗?

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