@dolbyio/dolbyio-rest-apis-client

中文文档
6.3.1发布于 2026/07/15MITTypeScriptCommonJS构建来源已验证近 30 天下载 2811

Node.JS wrapper for the Dolby OptiView REST APIs

原始使用文档
文档目录8 节
  1. Create a publish token
  2. Create a subscribe token
  3. Get an API token
  4. Upload a file for processing
  5. Start an enhance job
  6. Wait for the job to complete
  7. Download a processed file
  8. Related Projects

Build Package Build Documentation Publish Package npm License GitHub Documentation

Dolby OptiView REST APIs Client for Node.JS is wrapper for the Dolby OptiView Real-time Streaming and Dolby.io Media REST APIs.

Install this project

Run the npm command to install the package @dolbyio/dolbyio-rest-apis-client into your Node project:

npm install @dolbyio/dolbyio-rest-apis-client

Dolby Millicast Examples

Create a publish token

import { streaming } from '@dolbyio/dolbyio-rest-apis-client';

const API_KEY = process.env.DOLBYIO_API_SECRET;

const publishToken = await streaming.publishToken.create(API_KEY, {
    label: 'My token',
    streams: [
        {
            streamName: 'feedA',
        },
    ],
});
console.log(publishToken);

Create a subscribe token

import { streaming } from '@dolbyio/dolbyio-rest-apis-client';

const API_KEY = process.env.DOLBYIO_API_SECRET;

const subscribeToken = await streaming.subscribeToken.create(API_KEY, {
    label: 'My token',
    streams: [
        {
            streamName: 'feedA',
        },
    ],
});
console.log(subscribeToken);

Media Examples

Here is an example on how to upload a file to the Dolby.io temporary cloud storage, enhance that file and download the result.

Get an API token

Get the App Key and Secret from the Dolby.io dashboard and use the following code in your python script.

import { media } from '@dolbyio/dolbyio-rest-apis-client';

const APP_KEY = process.env.DOLBYIO_APP_KEY;
const APP_SECRET = process.env.DOLBYIO_APP_SECRET;

// Request an Access Token
const jwt = await media.authentication.getApiAccessToken(APP_KEY, APP_SECRET);
console.log('Access token', jwt);

Upload a file for processing

Upload a media file to the Dolby.io temporary cloud storage for processing:

// Temporary storage URL that will be used as reference for the job processing
const inputUrl = 'dlb://in/file.mp4';
// Local path of the file to upload
const originalFilePath = '/path/to/original_file.mp4';

await media.io.uploadFile(jwt, inputUrl, originalFilePath);

Start an enhance job

Generate a job description and send it to Dolby.io.

// Temporary storage URL that will be used as reference for the job processing
const outputUrl = 'dlb://out/file.mp4';

const jobDescription = JSON.stringify({
    content: { type: 'podcast' },
    input: inputUrl,
    output: outputUrl,
});

const jobId = await media.enhance.start(jwt, jobDescription);
console.log(`Job ID: ${jobId}`);

Wait for the job to complete

Get the job status and wait until it is completed.

const sleep = (delay) => new Promise((r) => setTimeout(r, delay));

let result = await media.enhance.getResults(jwt, jobId);
while (result.status === 'Pending' || result.status === 'Running') {
    console.log(`Job status is ${result.status}, taking a 5 second break...`);
    await sleep(5000);

    result = await media.enhance.getResults(jwt, jobId);
}

if (result.status !== 'Success') {
    console.error('There was a problem with processing the file', result);
    return;
}

Download a processed file

At this stage, the file has been processed and written to the temporary storage so we can download it.

// Local path where to download the file to
const enhancedFilePath = '/path/to/enhanced_file.mp4';

await media.io.downloadFile(jwt, outputUrl, enhancedFilePath);

Logs

You can also print the logs in the console and select the log level by using the following code.

import { Logger } from '@dolbyio/dolbyio-rest-apis-client';

Logger.useDefaults({
    defaultLevel: Logger.TRACE,
});

How to

To build the dist folder, run the command:

npm run build

The documentation is built on TypeDoc, to generate the doc, run the following command. You will find the HTML files in the docs folder.

npm run docs

版本与发布记录

@dolbyio/dolbyio-rest-apis-client 共发布 48 个版本,首次发布于 2021/11/18;过去 12 个月发布了 6 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
6.3.1latest2026/07/153 个月前
6.3.02026/05/315 个月前
6.2.22026/05/225 个月前
6.2.12026/05/096 个月前
6.2.02026/03/118 个月前
6.1.02026/02/208 个月前

关于 @dolbyio/dolbyio-rest-apis-client 的常见问题

@dolbyio/dolbyio-rest-apis-client 是什么?

Node.JS wrapper for the Dolby OptiView REST APIs

如何安装 @dolbyio/dolbyio-rest-apis-client?

在项目目录运行 npm install @dolbyio/dolbyio-rest-apis-client,或使用 pnpm add / yarn add / bun add。

@dolbyio/dolbyio-rest-apis-client 支持 TypeScript 吗?

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

@dolbyio/dolbyio-rest-apis-client 支持 ESM 还是 CommonJS?

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

@dolbyio/dolbyio-rest-apis-client 可以商用吗?

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

@dolbyio/dolbyio-rest-apis-client 的下载量有多少?

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

@dolbyio/dolbyio-rest-apis-client 还在维护吗?

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