open-index/open-npm huggingface dataset:
npm package: @svta/cml-608
Description: CTA-608/CEA-608 closed captioning functionality
Latest version: 1.0.2

# @svta/cml-608

CTA-608/CEA-608 closed captioning functionality.

## Installation

```bash
npm i @svta/cml-608
```

## Usage

```typescript
import { CaptionScreen, Row } from "@svta/cml-608";
```
npm package: @svta/cml-cmaf-ham
Description: CMAF Hypothetical Application Model (HAM) functionality
Latest version: 0.24.3

# @svta/cml-cmaf-ham

A collection of tools for working with Common Media Application Format - Hypothetical Application Model (CMAF-HAM).

## Installation

```bash
npm i @svta/cml-cmaf-ham
```

## Usage

```typescript

```
npm package: @svta/cml-cmcd
Description: Common Media Client Data (CMCD) encoding and decoding
Latest version: 2.2.0

# @svta/cml-cmcd

Common Media Client Data (CMCD) encoding and decoding.

## Installation

```bash
npm i @svta/cml-cmcd
```

## Usage

```typescript
import { CmcdReportingMode, encodeCmcd } from "@svta/cml-cmcd";

const input = {
	br: 1000,
	"com.example-hello": "world",
	ec: ["ERR001", "ERR002"],
	su: true,
};
const options = { version: 2, reportingMode: CmcdReportingMode.REQUEST };
const result = encodeCmcd(input, options);
// result === 'br=1000,com.example-hello="world",ec=("ERR001" "ERR002"),su,v=2'
```
npm package: @svta/cml-cmsd
Description: Common Media Server Data (CMSD) encoding and decoding
Latest version: 1.0.5

# @svta/cml-cmsd

Common Media Server Data (CMSD) encoding and decoding.

## Installation

```bash
npm i @svta/cml-cmsd
```

## Usage

```typescript
import { encodeCmsdStatic } from "@svta/cml-cmsd";

const input = Object.assign({}, CMSD_STATIC_OBJ, {
	ot: new SfToken(CmsdObjectType.VIDEO),
	sf: new SfToken(CmsdStreamingFormat.HLS),
	st: new SfToken(CmsdStreamType.VOD),
});

assert(
	encodeCmsdStatic(input) ===
		`ot=v,sf=h,st=v,d=5000,br=2000,n="OriginProviderA"`
);
```
npm package: @svta/cml-content-steering
Description: Content steering functionality
Latest version: 0.23.1

# @svta/cml-content-steering

Content steering functionality.

## Installation

```bash
npm i @svta/cml-content-steering
```

## Usage

```typescript
import {
	isValidPathwayClone,
	isValidSteeringManifest,
} from "@svta/cml-content-steering";

const manifest = {
	VERSION: 1,
	TTL: 100,
	"PATHWAY-PRIORITY": ["pathway1", "pathway2"],
	"PATHWAY-CLONES": [
		{
			"BASE-ID": "pathway1",
			ID: "clone1",
			"URI-REPLACEMENT": {
				HOST: "example.com",
				PARAMS: {
					param1: "value1",
					param2: "value2",
				},
			},
		},
	],
};

const pathwayClone = {
	"BASE-ID": "pathway1",
	ID: "clone1",
	"URI-REPLACEMENT": {
		HOST: "example.com",
		PARAMS: {
			param1: "value1",
			param2: "value2",
		},
	},
};

const isValidManifest = isValidSteeringManifest(manifest);
const isValidClone = isValidPathwayClone(pathwayClone);
```
npm package: @svta/cml-cta
Description: Common functionality for CTA standards including CTA-608/CEA-608
Latest version: 1.0.5

# @svta/cml-cta

Common functionality for CTA standards including CTA-608/CEA-608.

## Installation

```bash
npm i @svta/cml-cta
```

## Usage

This is a shared utility library for CTA standards.
npm package: @svta/cml-dash
Description: DASH manifest parsing functionality
Latest version: 1.0.5

# @svta/cml-dash

DASH manifest parsing functionality.

## Installation

```bash
npm i @svta/cml-dash
```

## Usage

```typescript
import { processUriTemplate, parseFrameRate } from "@svta/cml-dash";

// Process URI template
const result = processUriTemplate(
	"http://example.com/$RepresentationID$/$Number$/$SubNumber$/$Bandwidth$/$Time%02d$/$$",
	"rep1", // RepresentationID
	1, // Number
	2, // SubNumber
	3, // Bandwidth
	4 // Time
);

assert(result === "http://example.com/rep1/1/2/3/04/$");

// Parse frame rate
const frameRate = parseFrameRate("24000/1001");
assert(frameRate === 23.976023976023978);
```
npm package: @svta/cml-id3
Description: ID3 tag parsing functionality
Latest version: 1.0.5

# @svta/cml-id3

ID3 tag parsing functionality.

## Installation

```bash
npm i @svta/cml-id3
```

## Usage

```typescript
import { getId3Frames } from "@svta/cml-id3";

const frames = getId3Frames(id3Data);
```
npm package: @svta/cml-iso-8601
Description: ISO 8601 date/time handling functionality
Latest version: 1.0.1

# @svta/cml-iso-8601

ISO 8601 date/time handling functionality.

## Installation

```bash
npm i @svta/cml-iso-8601
```

## Usage

```typescript
import {
	decodeIso8601Duration,
	encodeIso8601Duration,
} from "@svta/cml-iso-8601";

// Encode duration
const encoded = encodeIso8601Duration(3661);
// encoded === 'PT1H1M1S'

// Decode duration
const decoded = decodeIso8601Duration("PT1H1M1S");
// decoded === 3661
```
npm package: @svta/cml-iso-bmff
Description: ISO Base Media File Format (ISOBMFF) parsing functionality
Latest version: 1.0.1

# @svta/cml-iso-bmff

ISO Base Media File Format (ISOBMFF) parsing functionality.

## Installation

```bash
npm i @svta/cml-iso-bmff
```

## Usage

- [Reading boxes](docs/reading-boxes.md) - Parse ISO BMFF boxes from a buffer
- [Writing boxes](docs/writing-boxes.md) - Write boxes to byte arrays or streams
- [Utilities](docs/utilities.md) - Traversing boxes and type guards
npm package: @svta/cml-structured-field-values
Description: RFC8941 Structured Field Values implementation
Latest version: 1.1.2

# @svta/cml-structured-field-values

RFC8941 Structured Field Values implementation.

## Installation

```bash
npm i @svta/cml-structured-field-values
```

## Usage

```typescript
import { encodeSfDict } from "@svta/cml-structured-field-values";

const dict = encodeSfDict({
	a: 1,
	b: false,
	c: "x",
	d: Symbol.for("y"),
	e: new Uint8Array([1, 2, 3]),
});

assert(dict === `a=1, b=?0, c="x", d=y, e=:AQID:`);
```
npm package: @svta/cml-throughput
Description: Throughput estimation functionality
Latest version: 1.0.5

# @svta/cml-throughput

Throughput estimation functionality.

## Installation

```bash
npm i @svta/cml-throughput
```

## Usage

```typescript
import { EwmaEstimator } from "@svta/cml-throughput/EwmaEstimator";

const estimator = new EwmaEstimator({ fastHalfLife: 2, slowHalfLife: 5 });

// 500 bps
estimator.sample({
	startTime: 0,
	encodedBodySize: 125,
	duration: 2000,
});

// 250 bps
estimator.sample({
	startTime: 2000,
	encodedBodySize: 125,
	duration: 4000,
});

assert(estimator.getEstimate() === 412);
```
npm package: @svta/cml-utils
Description: Common utility functions for media processing
Latest version: 1.4.0

# @svta/cml-utils

Common utility functions for media processing.

## Installation

```bash
npm i @svta/cml-utils
```

## Usage

```typescript
import {
	stringToUint16,
	hexToArrayBuffer,
	decodeBase64,
	arrayBufferToUuid,
	arrayBufferToHex,
	unescapeHtml,
} from "@svta/cml-utils";

// Unescape HTML entities
const unescaped = unescapeHtml("&quot;&lt;Hello&amp;World&gt;&quot;");
assert(unescaped === `"<Hello&World>"`);

// Convert string to Uint16Array
const uint16Array = stringToUint16("hello world");
assert(
	uint16Array ===
		new Uint16Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100])
);

// Convert hex string to ArrayBuffer
const hex = "a0564af760c2d94b9610c7ae70d5d970";
const arrayBuffer = hexToArrayBuffer(hex);
const expected = new Uint8Array([
	160, 86, 74, 247, 96, 194, 217, 75, 150, 16, 199, 174, 112, 213, 217, 112,
]);
assert(new Uint8Array(arrayBuffer) === expected);

// Decode base64
const decoded = decodeBase64("SGVsbG8gV29ybGQ=");
assert(
	decoded ===
		new Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100])
);

// Convert ArrayBuffer to UUID
const data = new Uint8Array([
	160, 86, 74, 247, 96, 194, 217, 75, 150, 16, 199, 174, 112, 213, 217, 112,
]);
const uuid = arrayBufferToUuid(data.buffer);
assert(uuid === "a0564af7-60c2-d94b-9610-c7ae70d5d970");

// Convert ArrayBuffer to hex string
const hexString = arrayBufferToHex(data.buffer);
assert(hexString === "a0564af760c2d94b9610c7ae70d5d970");
```
npm package: @svta/cml-webvtt
Description: WebVTT parsing and rendering functionality
Latest version: 1.0.5

# @svta/cml-webvtt

WebVTT parsing and rendering functionality.

## Installation

```bash
npm i @svta/cml-webvtt
```

## Usage

```typescript
import { parseWebVtt } from "@svta/cml-webvtt";

const vtt = `WEBVTT\n\nREGION\nid:test\n\nSTYLE\n::cue {}\n\nCUE_1\n00:00:00.000 --> 00:00:35.000\nWevVTT Sample\n`;

const { cues, errors, regions, styles } = await parseWebVtt(vtt);

assert(cues[0].id === "CUE_1");
assert(cues[0].text === "WevVTT Sample");
assert(errors.length === 0);
assert(regions[0].id === "test");
assert(styles.length === 1);
```
npm package: @svta/cml-xml
Description: XML parsing utilities
Latest version: 1.1.3

# @svta/cml-xml

XML parsing utilities.

## Installation

```bash
npm i @svta/cml-xml
```

## Usage

```typescript
import { decodeXml } from "@svta/cml-xml";

const obj = decodeXml(
	`<root>
		<child>text</child>
		<ns:tag>content</ns:tag>
	</root>`
);

assert(obj.childNodes[0].nodeName === "root");
assert(obj.childNodes[0].childNodes[0].nodeName === "child");
assert(obj.childNodes[0].childNodes[0].childNodes[0].nodeValue === "text");
assert(obj.childNodes[0].childNodes[1].nodeName === "ns:tag");
assert(obj.childNodes[0].childNodes[1].prefix === "ns");
assert(obj.childNodes[0].childNodes[1].localName === "tag");
```
npm package: @svta/common-media-library
Description: A common library for media playback in JavaScript
Latest version: 0.18.1

# common-media-library
A common library for media playback in JavaScript

Looking at open source players like [hls.js](https://github.com/video-dev/hls.js/), [dash.js](https://github.com/Dash-Industry-Forum/dash.js/), and [shaka-player](https://github.com/shaka-project/shaka-player) there are common pieces of functionality that have been implemented independently across the libraries. This is particularly true when looking at standards based features, like ID3 parsing, 608 parsing and CMCD. Since the functionality is shared in spirit but not implementation, they can fall out of sync where certain bugs are fixed in one player but not the others. The goal of this library is to create a single place where these utilities can be maintained and distributed.

## Project structure
This project is a mono-repo with the following workspaces: `lib`, `docs`. The `lib` package contains the compiled code for the library which is published to npm. The `docs` package contains the documentation for the library and is published to GitHub pages.

## Installation
```bash
npm install @svta/common-media-library
```

## Usage
To ensure the smallest bundle sizes possible, it is best practice to import all members and type definitions
individually from the library.
```typescript
import { appendCmcdQuery } from '@svta/common-media-library/cmcd/appendCmcdQuery';
import { CmcdObjectType } from '@svta/common-media-library/cmcd/CmcdObjectType';

const cmcd = {
	sid: '4f2867f2-b0fd-4db7-a3e0-cea7dff44cfb',
	cid: 'cc002fc3-d9e1-418d-9a5f-3d0eac601882',
	d: 324.69,
	ot: CmcdObjectType.MANIFEST,
	['com.example-hello']: 'world',
};

const cmcdUrl = appendCmcdQuery('https://example.com/playlist.m3u8', cmcd);
console.log(cmcdUrl);
// https://example.com/playlist.m3u8?CMCD=cid%3D%22cc002fc3-d9e1-418d-9a5f-3d0eac601882%22%2Ccom.example-hello%3D%22world%22%2Cd%3D325%2Cot%3Dm%2Csid%3D%224f2867f2-b0fd-4db7-a3e0-cea7dff44cfb%22
```

If bundle size isn't a concern, all members and type definitions can also be imported from the root of the library, or from the feature namespace.
```typescript
import { appendCmcdQuery, CmcdObjectType } from '@svta/common-media-library';
```
```typescript
import { appendCmcdQuery, CmcdObjectType } from '@svta/common-media-library/cmcd';
```

## Documentation
API docs can be found [here](https://streaming-video-technology-alliance.github.io/common-media-library/).

## Thanks
This project builds upon the work of the open source community. Special thanks to the maintainers of [hls.js](https://github.com/video-dev/hls.js/), [dash.js](https://github.com/dash-industry-forum/dash.js/), [shaka-player](https://github.com/shaka-project/shaka-player), and [structured-field-values](https://github.com/Jxck/structured-field-values) as well as organizations like the [Streaming Video Technology Alliance](https://www.svta.org/), [DASH Industry Forum](https://dashif.org/), and the [CTA WAVE Project](https://www.cta.tech/Resources/Standards/WAVE-Project).