Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/CeeblueTV/wrts-client/llms.txt

Use this file to discover all available pages before exploring further.

There are three ways to add the Ceeblue WebRTS Client to your project: install it from npm (the recommended path for any project that uses a bundler or Node.js), drop in the prebuilt browser bundle for environments without a build step, or clone the repository and build the output format you need from source. All three approaches give you the same runtime capabilities.

npm / package managers

Install @ceeblue/wrts-client from the npm registry using your preferred package manager.
npm install @ceeblue/wrts-client
The package requires Node.js ≥ 16 and npm ≥ 7. It ships as an ES module ("type": "module" in package.json) with TypeScript definitions at dist/wrts-client.d.ts. Once installed, import from the package name in your source files:
import { Player } from '@ceeblue/wrts-client';
Or import the entire namespace:
import * as WebRTS from '@ceeblue/wrts-client';

Runtime dependencies

The following packages are installed automatically as dependencies:
PackageVersionPurpose
@ceeblue/web-utils^7.9.0Shared utilities: logging, connection helpers, metrics, byte-rate measurement
abortcontroller-polyfill^1.7.8AbortController polyfill for environments that do not natively support it

Browser bundle

The package includes a self-contained browser bundle at dist/wrts-client.bundle.js. This file (declared as the browser field in package.json) bundles all runtime dependencies into a single file, making it suitable for use directly in a web page without any build tooling. Load it with a <script type="module"> tag and import named exports as you would from the npm package:
<script type="module">
  import { Player, HTTPAdaptiveSource, WSSource, VERSION, utils } from './dist/wrts-client.bundle.js';

  const { log, LogLevel } = utils;
  log.level = LogLevel.INFO;

  const player = new Player(document.getElementById('video'));
  player.start({
    endPoint: 'https://<hostname>/wrts/out+<stream-id>/index.json'
  });
</script>
Because the bundle uses ES module syntax (import/export), the <script> tag must carry type="module". Classic <script> tags without type="module" will throw a syntax error.
If you have built the library locally, both dist/wrts-client.bundle.js and its minified companion dist/wrts-client.bundle.min.js are available after running npm run build.

Building from source

Clone the repository, install dependencies, and run the build script to produce output files in the /dist/ folder.
1

Clone the repository

git clone https://github.com/CeeblueTV/wrts-client.git
cd wrts-client
2

Install dependencies

npm install
This installs both the runtime dependencies and all dev dependencies (TypeScript, Rollup, ESLint, Prettier, and typedoc).
3

Build the library

npm run build
The following files are written to the /dist/ folder:
FileDescription
wrts-client.d.tsTypeScript type definitions
wrts-client.jsES module library (npm entry point)
wrts-client.bundle.jsSelf-contained browser bundle (browser entry point)
Each JavaScript file is accompanied by a minified .min.js version and a .map source map file.

Module format options

By default, npm run build produces an ES module output. Two alternative formats are supported via additional build scripts:
npm run build
The default compilation target is ES6. Other targets (for example esnext) can be passed manually on the command line for experimental use, but are not officially supported:
npm run build -- --target esnext
npm run build:cjs -- --target esnext
If your project requires a UMD-compatible bundle for a legacy environment, build the IIFE format (npm run build:iife) and wrap the resulting file yourself. A first-party UMD build is not included in the published npm package.

Watch mode

Run a watcher to automatically rebuild whenever source files change during development:
npm run watch
The watcher is powered by Rollup’s --watch flag and rebuilds all output variants (normal, minified, and source map) for the selected format on every change.

Dependencies

The following packages are listed as runtime dependencies in package.json and are installed automatically when you add @ceeblue/wrts-client via npm:
PackageVersionPurpose
@ceeblue/web-utils^7.9.0Logging (log, LogLevel), connection helpers (Connect, NetAddress), byte-rate measurement (ByteRate), player statistics (PlayerStats), and other shared utilities used throughout the library
abortcontroller-polyfill^1.7.8Polyfill for the AbortController / AbortSignal APIs used internally to cancel in-flight requests when player.stop() is called
The library re-exports the entire @ceeblue/web-utils namespace as utils from the package root, so you can access the logging engine, LogLevel, Connect, and other utilities without adding a separate dependency to your project:
import { utils } from '@ceeblue/wrts-client';
const { log, LogLevel } = utils;
log.level = LogLevel.INFO;

Build docs developers (and LLMs) love