npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@svta/common-media-library

v0.7.4

Published

A common library for media playback in JavaScript

Downloads

21,829

Readme

common-media-library

A common library for media playback in JavaScript

Looking at open source players like hls.js, dash.js, and 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

npm install @svta/common-media-library

Usage

Too ensure the smallest bundle sizes possible, it is best practice to import all members and type definitions individually from the library.

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.

import { appendCmcdQuery, CmcdObjectType } from '@svta/common-media-library';
import { appendCmcdQuery, CmcdObjectType } from '@svta/common-media-library/cmcd';

Documentation

API docs can be found here.

Thanks

This project builds upon the work of the open source community. Special thanks to the maintainers of hls.js, dash.js, shaka-player, and structured-field-values as well as organizations like the Streaming Video Technology Alliance, DASH Industry Forum, and the CTA WAVE Project.