From e1f2344231800cf3852be212b590dc0542047e43 Mon Sep 17 00:00:00 2001 From: Fritz Heiden Date: Mon, 11 Jan 2021 16:17:55 +0100 Subject: [PATCH 01/13] Implemented further CMCD parameters - Implemented CMCD object type 'tt' - Implemented metrics nor and nrr - Implemented unit tests for CMCD parameters nor and nrr - Added CMCD query parameters to license requests --- samples/advanced/cmcd.html | 23 +++++++ src/dash/DashHandler.js | 16 ++++- src/streaming/StreamProcessor.js | 15 +++++ src/streaming/models/CmcdModel.js | 67 ++++++++++++++++++- .../controllers/ProtectionController.js | 21 +++++- src/streaming/vo/metrics/HTTPRequest.js | 1 + test/unit/mocks/PlaybackControllerMock.js | 1 + test/unit/mocks/StreamControllerMock.js | 7 ++ test/unit/mocks/StreamMock.js | 14 ++++ test/unit/mocks/StreamProcessorMock.js | 4 ++ test/unit/streaming.models.CmcdModel.js | 6 ++ 11 files changed, 172 insertions(+), 3 deletions(-) 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 @@
+