diff --git a/index.d.ts b/index.d.ts index de32529272..8b9066e724 100644 --- a/index.d.ts +++ b/index.d.ts @@ -217,7 +217,9 @@ declare namespace dashjs { cmcd?: { enabled?: boolean, sid?: string, - cid?: string + cid?: string, + rtp?: number, + rtpSafetyFactor?: number } } } diff --git a/samples/advanced/cmcd.html b/samples/advanced/cmcd.html index 3454b5f797..8cf93cdb20 100644 --- a/samples/advanced/cmcd.html +++ b/samples/advanced/cmcd.html @@ -20,6 +20,7 @@ player = dashjs.MediaPlayer().create(); video = document.querySelector("video"); player.initialize(); + player.setTextDefaultEnabled(true); version = player.getVersion(); player.on(CMCD_DATA_GENERATED, handleCmcdDataGeneratedEvent); @@ -37,6 +38,27 @@ player.attachView(video); player.attachSource(url); + var TTMLRenderingDiv = document.querySelector("#ttml-rendering-div"); + player.attachTTMLRenderingDiv(TTMLRenderingDiv); + } + + function handleCmcdDataGeneratedEvent(event) { + log("type: " + event.mediaType); + log("file: " + event.url.split("/").pop()) + var keys = Object.keys(event.cmcdData); + keys = keys.sort(); + for (var key of keys) { + log(key.padEnd(4) + ": " + event.cmcdData[key]); + } + log(""); + } + + function log(msg) { + msg = msg.length > 200 ? msg.substring(0, 200) + "..." : msg; /* to avoid repeated wrapping with large objects */ + var tracePanel = document.getElementById("trace"); + tracePanel.innerHTML += msg + "\n"; + tracePanel.scrollTop = tracePanel.scrollHeight; + console.log(msg); } function handleCmcdDataGeneratedEvent(event) { @@ -76,6 +98,7 @@
+