Skip to content
This repository has been archived by the owner on May 3, 2023. It is now read-only.

Commit

Permalink
release/0.5.0 (#22)
Browse files Browse the repository at this point in the history
* Update dependencies
* Remove CMCDShards
* Add append utilities
* Convert Cmcd to an interface
* Add stricter compile options
* Add formal types for cmcd internal data
* Simplify processing of cmcd data
  • Loading branch information
littlespex authored Nov 7, 2021
1 parent 7b26b4c commit fffb91a
Show file tree
Hide file tree
Showing 12 changed files with 1,495 additions and 1,367 deletions.
2,436 changes: 1,248 additions & 1,188 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cmcd.js",
"version": "0.4.1",
"version": "0.5.0",
"description": "CMCD (Common Media Client Data) Library with Typescript definitions",
"main": "dist/cmcd.min.js",
"types": "dist/types/index.d.ts",
Expand Down Expand Up @@ -30,15 +30,15 @@
"author": "Casey Occhialini",
"license": "ISC",
"devDependencies": {
"@types/jest": "^27.0.1",
"crypto": "^1.0.1",
"jest": "^27.2.0",
"rollup": "^2.56.3",
"terser": "^5.8.0",
"ts-jest": "^27.0.5",
"tslib": "^2.3.1",
"typedoc": "^0.22.3",
"typescript": "^4.4.3"
"@types/jest": "27.0.2",
"crypto": "1.0.1",
"jest": "27.3.1",
"rollup": "2.59.0",
"terser": "5.9.0",
"ts-jest": "27.0.7",
"tslib": "2.3.1",
"typedoc": "0.22.7",
"typescript": "4.4.4"
},
"jest": {
"testEnvironment": "jsdom",
Expand Down
45 changes: 26 additions & 19 deletions src/Cmcd.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import { CmcdObjectType } from './CmcdObjectType';
import { CmcdStreamingFormat } from './CmcdStreamingFormat';
import { CmcdStreamType } from './CmcdStreamType';
import { CmcdValue } from './CmcdValue';

/**
* CMCD
*/
export class Cmcd {
export interface Cmcd {

/**
* Custom key names may be used, but they MUST carry a hyphenated prefix to ensure that there will not be a namespace collision
* with future revisions to this specification. Clients SHOULD use a reverse-DNS syntax when defining their own prefix.
*/
[index: `${string}-${string}`]: CmcdValue;

/////////////////
// CMCD Object //
Expand All @@ -20,7 +27,7 @@ export class Cmcd {
*
* Integer kbps
*/
br: number;
br?: number;

/**
* Object duration
Expand All @@ -31,7 +38,7 @@ export class Cmcd {
*
* Integer milliseconds
*/
d: number;
d?: number;

/**
* Object type
Expand All @@ -49,7 +56,7 @@ export class Cmcd {
*
* If the object type being requested is unknown, then this key MUST NOT be used.
*/
ot: CmcdObjectType;
ot?: CmcdObjectType;

/**
* Top bitrate
Expand All @@ -59,7 +66,7 @@ export class Cmcd {
*
* Integer Kbps
*/
tb: number;
tb?: number;

//////////////////
// CMCD Request //
Expand All @@ -72,7 +79,7 @@ export class Cmcd {
*
* Integer milliseconds
*/
bl: number;
bl?: number;

/**
* Deadline
Expand All @@ -83,7 +90,7 @@ export class Cmcd {
*
* Integer milliseconds
*/
dl: number;
dl?: number;

/**
* Measured mtp CMCD throughput
Expand All @@ -95,7 +102,7 @@ export class Cmcd {
*
* Integer kbps
*/
mtp: number;
mtp?: number;

/**
* Next object request
Expand All @@ -106,7 +113,7 @@ export class Cmcd {
*
* String
*/
nor: string;
nor?: string;

/**
* Next range request
Expand All @@ -122,7 +129,7 @@ export class Cmcd {
*
* String
*/
nrr: string;
nrr?: string;

/**
* Startup
Expand All @@ -132,7 +139,7 @@ export class Cmcd {
*
* Boolean
*/
su: boolean;
su?: boolean;

//////////////////
// CMCD Session //
Expand All @@ -146,7 +153,7 @@ export class Cmcd {
*
* String
*/
cid: string;
cid?: string;

/**
* Playback rate
Expand All @@ -155,7 +162,7 @@ export class Cmcd {
*
* Decimal
*/
pr: number;
pr?: number;

/**
* Streaming format
Expand All @@ -169,7 +176,7 @@ export class Cmcd {
*
* If the streaming format being requested is unknown, then this key MUST NOT be used.
*/
sf: CmcdStreamingFormat;
sf?: CmcdStreamingFormat;

/**
* Session ID
Expand All @@ -179,14 +186,14 @@ export class Cmcd {
*
* String
*/
sid: string;
sid?: string;

/**
* Stream type
* - `v` = all segments are available – e.g., VOD
* - `l` = segments become available over time – e.g., LIVE
*/
st: CmcdStreamType;
st?: CmcdStreamType;

/**
* CMCD version
Expand All @@ -196,7 +203,7 @@ export class Cmcd {
*
* Integer
*/
v: number;
v?: number;

/////////////////
// CMCD Status //
Expand All @@ -214,7 +221,7 @@ export class Cmcd {
*
* Boolean
*/
bs: boolean;
bs?: boolean;

/**
* Requested maximum throughput
Expand All @@ -229,5 +236,5 @@ export class Cmcd {
*
* Integer kbps
*/
rtp: number;
rtp?: number;
}
21 changes: 0 additions & 21 deletions src/CmcdEncodeOptions.ts

This file was deleted.

9 changes: 9 additions & 0 deletions src/CmcdHeader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* CMCD Header
*/
export enum CmcdHeader {
Object,
Request,
Session,
Status,
};
3 changes: 3 additions & 0 deletions src/CmcdKey.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Cmcd } from './Cmcd';

export type CmcdKey = keyof Cmcd;
6 changes: 0 additions & 6 deletions src/CmcdShards.ts

This file was deleted.

Loading

0 comments on commit fffb91a

Please sign in to comment.