CTA-5004 Specification
The SDK exports a single CMCDManager class that is instantiated through a factory function.
Import into project
implementation("tech.ctawave.cmcdlib:cmcd:0.0.1")
npm i --save "cmcdlib-cmcd"
The library works by updating CMCDManager properties as stream state progresses.
import tech.ctawave.cmcd
val manager = CMCDManagerFactory.createCMCDManager(config: CMCDConfig): CMCDManager
manager.encodedBitrate = 123456
import cmcdlib from "cmcdlib-cmcd"
const manager = new cmcdlib.tech.ctawave.cmcd.CMCDManagerFactory.createCMCDManager(config: CMCDConfig): CMCDManager
manager.encodedBitrate = 123456
When it's time to make a network request to your CDN, use the manager to append the CMCD query paramters to your URI by calling appendQueryParamsToUri
function providing the current uri, the object request type, and whether or not this object is needed from startup.
val uriWithCMCDQueryParams = manager.appendQueryParamsToUri(uri: string, objectType: string , startup: boolean)
const uriWithCMCDQueryParmas = manager.appendQueryParamsToUri(uri: string, objectType: string , startup: boolean)
Until KotlinJs IR Compiler and JsExport works for enum classes, we must maintain our own definitions.
Currently, can be found in hlsjsApp/src/types/cmcd.d.ts
Please follow guidelines described by TypeScript team:
Once library is open sourced and available through NPM provide definitions through Definitely Typed
Example Hls.js implementation is found under /hlsjsApp
. CMCD library is imported using npm linking. See /package.json
link script.
THe CMCDManager implementation can be found in CMCDAppManager.ts
.
Example Exoplayer implementation is found under /exoApp
. CMCD library is imported using Gradle's project implementation.
// cmcd library
implementation(project(":cmcd"))
The CMCDManager implementation can be found in CMCDAppManager.kt
.
After cloning the repository:
npm install
npm run link
This will install all dependencies and perform proper linking between the SDK and the Example Apps.
- Once approved, migrate repo and open source.
- Update MAVEN and NPM package details within all gradle and package.json files.
- Provide TypeScript definition's through Definitely Typed.
- Update cmcd library to use ENUMS. Current limitation of Kotlin/Js.
- Update cmcd library JS compilation to use new IR compiler.
- Maybe namespace js lib? "@ctawave/cmcd".