A common library for media playback in JavaScript
Open source players such as hls.js, dash.js, and shaka-player implement many of the same features independently. This duplication is especially common for standards-based features, such as ID3 parsing, 608 parsing, and CMCD. The players share the intent of these features but not the code. A bug fixed in one player can remain in the others. The goal of this library is to create one place where these utilities can be maintained and distributed.
Read the documentation on the website. Every package has a page with the overview, the guides, the API reference, and the changelog.
Guides:
- Getting started
- CML and coding agents
@svta/cml-cmcd: User Guide, Validation Guide, Report Recorder Guide@svta/cml-c2pa: Manifest Box Validation, VSI/EMSG Validation, VOD Merkle Validation, Results and Error Codes@svta/cml-iso-bmff: Reading Boxes, Writing Boxes, Utilities
The releases page lists the changelog entries of every package.
Install one of the libraries with npm:
npm i @svta/cml-cmcdThe type declarations need TypeScript 5.7 or later.
import { appendCmcdQuery, CmcdObjectType } from "@svta/cml-cmcd";
const cmcd = {
sid: "4f2867f2-b0fd-4db7-a3e0-cea7dff44cfb",
cid: "cc002fc3-d9e1-418d-9a5f-3d0eac601882",
d: 4004.37,
ot: CmcdObjectType.VIDEO,
["com.example-hello"]: "world",
};
const cmcdUrl = appendCmcdQuery("https://example.com/video/segment-1.m4s", cmcd);
console.log(cmcdUrl);
// https://example.com/video/segment-1.m4s?CMCD=cid%3D%22cc002fc3-d9e1-418d-9a5f-3d0eac601882%22%2Ccom.example-hello%3D%22world%22%2Cd%3D4004%2Cot%3Dv%2Csid%3D%224f2867f2-b0fd-4db7-a3e0-cea7dff44cfb%22%2Cv%3D2The repository ships a skill that tells a coding agent which package covers a media playback task. Install the skill in a player project:
npx skills add streaming-video-technology-alliance/common-media-libraryAgents that read documentation from the web can begin with llms.txt.
If you need help with the Common Media Library, or if you want to talk with other members:
The Common Media Library is free and open source. We welcome help of any kind: fixing bugs, improving documentation, or suggesting new features. Read the contributing guide for details. The SVTA Players and Playback working group oversees contributions and project decisions.
This project has a Contributor Code of Conduct. By participating in this project, you agree to follow its terms.
This project builds on the work of the open source community. Special thanks to the maintainers of hls.js, dash.js, shaka-player, video.js, and structured-field-values. Thanks also to the Streaming Video Technology Alliance, the DASH Industry Forum, and the CTA WAVE Project.