diff --git a/player/cmcd/js/script.js b/player/cmcd/js/script.js
index 72837f0c..4177e3fe 100644
--- a/player/cmcd/js/script.js
+++ b/player/cmcd/js/script.js
@@ -10,6 +10,27 @@ const playerConfig = {
}
};
+const cmcdConfig = {
+ sessionId: uuidv4(),
+ contentId: '1111-111111-111111-11111',
+};
+
+const cmcdPlugin = new window.bitmovin.player.integration.Cmcd.CmcdIntegration(cmcdConfig);
+playerConfig.network = {
+ preprocessHttpRequest: cmcdPlugin.preprocessHttpRequest,
+ preprocessHttpResponse: cmcdPlugin.preprocessHttpResponse,
+};
+playerConfig.adaptation = {
+ desktop: {
+ onVideoAdaptation: cmcdPlugin.onVideoAdaptation,
+ onAudioAdaptation: cmcdPlugin.onAudioAdaptation,
+ },
+ mobile: {
+ onVideoAdaptation: cmcdPlugin.onVideoAdaptation,
+ onAudioAdaptation: cmcdPlugin.onAudioAdaptation,
+ },
+};
+
const source = {
hls: 'https://bitmovindemocmcd-a.akamaihd.net/content/MI201109210084_1/m3u8s-fmp4-rel/main.m3u8',
};
@@ -17,6 +38,8 @@ const source = {
const playerContainer = document.getElementById('player-container');
const player = new bitmovin.player.Player(playerContainer, playerConfig);
+cmcdPlugin.setPlayer(player);
+
$(document).ready(function () {
player.load(source);
});
From 0020636773c42e44f5cc358238b1b690c6dda7d8 Mon Sep 17 00:00:00 2001
From: dweinber
Date: Mon, 20 Mar 2023 12:27:58 +0100
Subject: [PATCH 17/83] Mark demo as hidden for now (not showing it on the demo
landing page)
---
player/cmcd/info.json | 1 +
1 file changed, 1 insertion(+)
diff --git a/player/cmcd/info.json b/player/cmcd/info.json
index cc556092..e1c39c93 100644
--- a/player/cmcd/info.json
+++ b/player/cmcd/info.json
@@ -2,6 +2,7 @@
"title": "CMCD Support",
"description": "Send Common Media Client Data (CMCD) data from Player to CDN (experimental)",
"long_description": "To be defined.",
+ "hidden": true,
"executable": {
"executable": true,
"indexfile": "index.html"
From 031c08ee1c501cc67ae71a3357eb79c3dd2d57b3 Mon Sep 17 00:00:00 2001
From: dweinber
Date: Mon, 20 Mar 2023 12:29:43 +0100
Subject: [PATCH 18/83] Revert "Mark demo as hidden for now (not showing it on
the demo landing page)" as not supported anymore by the framework
This reverts commit 0020636773c42e44f5cc358238b1b690c6dda7d8.
---
player/cmcd/info.json | 1 -
1 file changed, 1 deletion(-)
diff --git a/player/cmcd/info.json b/player/cmcd/info.json
index e1c39c93..cc556092 100644
--- a/player/cmcd/info.json
+++ b/player/cmcd/info.json
@@ -2,7 +2,6 @@
"title": "CMCD Support",
"description": "Send Common Media Client Data (CMCD) data from Player to CDN (experimental)",
"long_description": "To be defined.",
- "hidden": true,
"executable": {
"executable": true,
"indexfile": "index.html"
From fa0b7adc70d798527f451dd4eff1041313b0a973 Mon Sep 17 00:00:00 2001
From: dweinber
Date: Mon, 20 Mar 2023 21:25:53 +0100
Subject: [PATCH 19/83] Change text color for CMCD logs to distinguish them
more from CDN logs
---
player/cmcd/css/style.css | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/player/cmcd/css/style.css b/player/cmcd/css/style.css
index 6f2c53d8..175abaf4 100644
--- a/player/cmcd/css/style.css
+++ b/player/cmcd/css/style.css
@@ -31,3 +31,7 @@
margin-bottom: unset !important;
flex-wrap: wrap;
}
+
+.cmcd-log {
+ color: blue;
+}
\ No newline at end of file
From f7d1d36095b3448c2ab7728864ccc0ffd1c4ed1e Mon Sep 17 00:00:00 2001
From: dweinber
Date: Mon, 20 Mar 2023 21:26:58 +0100
Subject: [PATCH 20/83] Switch to cdn.jsdelivr.net
---
player/cmcd/index.html | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/player/cmcd/index.html b/player/cmcd/index.html
index c94e0fdb..bdd36d84 100644
--- a/player/cmcd/index.html
+++ b/player/cmcd/index.html
@@ -1,7 +1,5 @@
-
-
-
-
+
+
From b9a747f341795681ba0e3046186856b6d2ed6808 Mon Sep 17 00:00:00 2001
From: dweinber
Date: Mon, 20 Mar 2023 21:38:33 +0100
Subject: [PATCH 21/83] Ship CMCD integration within the demos for now
---
player/cmcd/js/cmcd-integration.js | 1 +
1 file changed, 1 insertion(+)
create mode 100644 player/cmcd/js/cmcd-integration.js
diff --git a/player/cmcd/js/cmcd-integration.js b/player/cmcd/js/cmcd-integration.js
new file mode 100644
index 00000000..95a08605
--- /dev/null
+++ b/player/cmcd/js/cmcd-integration.js
@@ -0,0 +1 @@
+!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.BitmovinPlayerIntegrationCmcd=e():(t.bitmovin=t.bitmovin||{},t.bitmovin.player=t.bitmovin.player||{},t.bitmovin.player.integration=t.bitmovin.player.integration||{},t.bitmovin.player.integration.Cmcd=e())}(self,(function(){return function(){"use strict";var t={247:function(t,e,n){n.d(e,{Ao:function(){return E},Dh:function(){return s},I3:function(){return R},J3:function(){return M},M:function(){return h},O5:function(){return b},Ph:function(){return I},QU:function(){return u},RE:function(){return a},RF:function(){return A},RZ:function(){return y},T8:function(){return m},TS:function(){return k},Vf:function(){return x},Vq:function(){return q},ZH:function(){return v},be:function(){return T},dg:function(){return O},gu:function(){return D},mP:function(){return g},mc:function(){return i},nf:function(){return o},oI:function(){return S},x9:function(){return V}});var r,i,u,o,a,s,c,p=(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});function l(t){return t.sort((function(t,e){return t.key.localeCompare(e.key)})).filter((function(t){return t.keyValuePairToString()}))}function h(t){var e=l(t),n=e.filter((function(t){return t.type===c.Request})).map((function(t){return t.keyValuePairToString()})).join(","),r=e.filter((function(t){return t.type===c.Object})).map((function(t){return t.keyValuePairToString()})).join(","),i=e.filter((function(t){return t.type===c.Status})).map((function(t){return t.keyValuePairToString()})).join(","),u=e.filter((function(t){return t.type===c.Session})).map((function(t){return t.keyValuePairToString()})).join(","),o={};return n&&(o[c.Request]=n),r&&(o[c.Object]=r),i&&(o[c.Status]=i),u&&(o[c.Session]=u),o}function y(t){var e=l(t).map((function(t){return t.keyValuePairToString()})).join(",");return"CMCD=".concat(encodeURI(e))}!function(t){t.AudioOnly="a",t.VideoOnly="v",t.MuxedVideoAudio="av",t.ManifestOrPlaylistTextFile="m",t.InitSegment="i",t.CaptionOrSubtitle="c",t.TimedTextTrack="tt",t.CryptographicKeyOrLicenseOrCertificate="k",t.Other="o"}(i||(i={})),function(t){t.MpegDash="d",t.Hls="h",t.Smooth="s",t.Other="o"}(u||(u={})),function(t){t.Vod="v",t.Live="l"}(o||(o={})),function(t){t[t.v1=1]="v1"}(a||(a={})),function(t){t.EncodedBitrate="br",t.BufferLength="bl",t.BufferStarvation="bs",t.ContentId="cid",t.ObjectDuration="d",t.Deadline="dl",t.MeasuredThroughput="mtp",t.NextObjectRequest="nor",t.NextRangeRequest="nrr",t.ObjectType="ot",t.PlaybackRate="pr",t.RequestedMaximumThroughput="rtp",t.StreamingFormat="sf",t.SessionId="sid",t.StreamType="st",t.Startup="su",t.TopBitrate="tb",t.CmcdVersion="v"}(s||(s={})),function(t){t.Object="CMCD-Object",t.Request="CMCD-Request",t.Status="CMCD-Status",t.Session="CMCD-Session"}(c||(c={}));var f,d=function(){function t(t){this.value=t}return t.prototype.keyValuePairToString=function(){return"string"==typeof this.value?"".concat(this.key,"=").concat((t=this.value,e=/"/g,n=/\\/g,'"'.concat(t.replace(n,"\\").replace(e,'\\"'),'"'))):"boolean"==typeof this.value&&!0===this.value?"".concat(this.key):"".concat(this.key,"=").concat(this.value);var t,e,n},t}(),v=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.EncodedBitrate,n.type=c.Object,n}return p(e,t),e}(d),S=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.BufferLength,n.type=c.Request,n}return p(e,t),e}(d),g=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.BufferStarvation,n.type=c.Status,n}return p(e,t),e}(d),T=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.ContentId,n.type=c.Session,n}return p(e,t),e}(d),m=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.ObjectDuration,n.type=c.Object,n}return p(e,t),e}(d),b=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.Deadline,n.type=c.Request,n}return p(e,t),e}(d),O=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.MeasuredThroughput,n.type=c.Request,n}return p(e,t),e}(d),R=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.NextObjectRequest,n.type=c.Request,n}return p(e,t),e}(d),k=(p((function(t){var e=f.call(this,t)||this;return e.key=s.NextRangeRequest,e.type=c.Request,e}),f=d),function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.ObjectType,n.type=c.Object,n}return p(e,t),e.prototype.keyValuePairToString=function(){return"".concat(this.key,"=").concat(this.value)},e}(d)),A=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.PlaybackRate,n.type=c.Session,n}return p(e,t),e.prototype.keyValuePairToString=function(){return 1===this.value?"":"".concat(this.key,"=").concat(this.value)},e}(d),M=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.RequestedMaximumThroughput,n.type=c.Status,n}return p(e,t),e}(d),x=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.StreamingFormat,n.type=c.Session,n}return p(e,t),e.prototype.keyValuePairToString=function(){return"".concat(this.key,"=").concat(this.value)},e}(d),I=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.SessionId,n.type=c.Session,n}return p(e,t),e}(d),D=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.StreamType,n.type=c.Session,n}return p(e,t),e.prototype.keyValuePairToString=function(){return"".concat(this.key,"=").concat(this.value)},e}(d),E=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.Startup,n.type=c.Request,n}return p(e,t),e.prototype.keyValuePairToString=function(){return!0===this.value?"".concat(this.key):""},e}(d),q=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.TopBitrate,n.type=c.Object,n}return p(e,t),e}(d),V=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.CmcdVersion,n.type=c.Session,n}return p(e,t),e.prototype.keyValuePairToString=function(){return this.value===a.v1?"":"".concat(this.key,"=").concat(this.value)},e}(d)},498:function(t,e,n){n.r(e),n.d(e,{CmcdIntegration:function(){return u}});var r=n(247),i=function(){return i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){n.push(new r.oI(1e3*i.level));var u=i.level/(null===(e=this.player)||void 0===e?void 0:e.getPlaybackSpeed());n.push(new r.O5(1e3*u))}var o=this.player.getAvailableAudioQualities().reduce((function(t,e){return Math.max(t,e.bitrate)}),0)/1e3;if(o>0&&n.push(new r.Vq(o)),this.currentVideoQuality){var a=this.player.getAvailableSegments();for(var s in a)if(s.startsWith("video/")){var c=a[s][this.currentVideoQuality.id];n=n.concat(this.getNextObjectAndObjectDurationCmcdData(c,t.url))}}return n},t.prototype.getVideoSegmentRequestSpecificData=function(t){var e,n=[];if(this.currentVideoQuality&&this.currentVideoQuality.bandwidth&&n.push(new r.ZH(Math.round(this.currentVideoQuality.bandwidth/1e3))),this.lastMeasuredThroughputVideo&&n.push(new r.dg(this.lastMeasuredThroughputVideo)),!this.player)return n;var i=this.player.buffer.getLevel(this.player.exports.BufferType.ForwardDuration,this.player.exports.MediaType.Video);if(i.targetLevel>0){n.push(new r.oI(1e3*i.level));var u=i.level/(null===(e=this.player)||void 0===e?void 0:e.getPlaybackSpeed());n.push(new r.O5(1e3*u))}var o=this.player.getAvailableVideoQualities().reduce((function(t,e){return Math.max(t,e.bitrate)}),0)/1e3;if(o>0&&n.push(new r.Vq(o)),this.currentVideoQuality){var a=this.player.getAvailableSegments();for(var s in a)if(s.startsWith("video/")){var c=a[s][this.currentVideoQuality.id];n=n.concat(this.getNextObjectAndObjectDurationCmcdData(c,t.url))}}return n},t.prototype.getNextObjectAndObjectDurationCmcdData=function(t,e){var n=[],i=t.findIndex((function(t){return t.url===e}));if(i>-1){var u=t[i];if(Number.isNaN(u.duration)||n.push(new r.T8(1e3*Number(u.duration))),i+1
Date: Mon, 20 Mar 2023 21:40:38 +0100
Subject: [PATCH 22/83] Ensure everything is loaded before trying to set the
player and CMCD integration up
---
player/cmcd/js/script.js | 82 +++++++++++++++++++++-------------------
1 file changed, 43 insertions(+), 39 deletions(-)
diff --git a/player/cmcd/js/script.js b/player/cmcd/js/script.js
index 4177e3fe..dd60da38 100644
--- a/player/cmcd/js/script.js
+++ b/player/cmcd/js/script.js
@@ -1,45 +1,49 @@
-const playerConfig = {
- key: '29ba4a30-8b5e-4336-a7dd-c94ff3b25f30',
- analytics: {
- key: '45adcf9b-8f7c-4e28-91c5-50ba3d442cd4',
- videoId: 'cmcd'
- },
- playback: {
- muted: true,
- autoplay: true,
- }
-};
+function setupPlayerWithCmcd() {
+ cmcdSessionId = uuidv4();
-const cmcdConfig = {
- sessionId: uuidv4(),
- contentId: '1111-111111-111111-11111',
-};
+ const playerConfig = {
+ key: '29ba4a30-8b5e-4336-a7dd-c94ff3b25f30',
+ analytics: {
+ key: '45adcf9b-8f7c-4e28-91c5-50ba3d442cd4',
+ videoId: 'cmcd'
+ },
+ playback: {
+ muted: true,
+ autoplay: true,
+ }
+ };
-const cmcdPlugin = new window.bitmovin.player.integration.Cmcd.CmcdIntegration(cmcdConfig);
-playerConfig.network = {
- preprocessHttpRequest: cmcdPlugin.preprocessHttpRequest,
- preprocessHttpResponse: cmcdPlugin.preprocessHttpResponse,
-};
-playerConfig.adaptation = {
- desktop: {
- onVideoAdaptation: cmcdPlugin.onVideoAdaptation,
- onAudioAdaptation: cmcdPlugin.onAudioAdaptation,
- },
- mobile: {
- onVideoAdaptation: cmcdPlugin.onVideoAdaptation,
- onAudioAdaptation: cmcdPlugin.onAudioAdaptation,
- },
-};
+ const cmcdConfig = {
+ sessionId: cmcdSessionId,
+ contentId: '1111-111111-111111-11111',
+ };
-const source = {
- hls: 'https://bitmovindemocmcd-a.akamaihd.net/content/MI201109210084_1/m3u8s-fmp4-rel/main.m3u8',
-};
+ const cmcdPlugin = new window.bitmovin.player.integration.Cmcd.CmcdIntegration(cmcdConfig);
+ playerConfig.network = {
+ preprocessHttpRequest: cmcdPlugin.preprocessHttpRequest,
+ preprocessHttpResponse: cmcdPlugin.preprocessHttpResponse,
+ };
+ playerConfig.adaptation = {
+ desktop: {
+ onVideoAdaptation: cmcdPlugin.onVideoAdaptation,
+ onAudioAdaptation: cmcdPlugin.onAudioAdaptation,
+ },
+ mobile: {
+ onVideoAdaptation: cmcdPlugin.onVideoAdaptation,
+ onAudioAdaptation: cmcdPlugin.onAudioAdaptation,
+ },
+ };
-const playerContainer = document.getElementById('player-container');
-const player = new bitmovin.player.Player(playerContainer, playerConfig);
+ const playerContainer = document.getElementById('player-container');
+ const player = new bitmovin.player.Player(playerContainer, playerConfig);
+
+ cmcdPlugin.setPlayer(player);
-cmcdPlugin.setPlayer(player);
+ player.load({
+ hls: 'https://bitmovindemocmcd-a.akamaihd.net/content/MI201109210084_1/m3u8s-fmp4-rel/main.m3u8',
+ });
+}
-$(document).ready(function () {
- player.load(source);
-});
+$(function() {
+ setupPlayerWithCmcd();
+});
\ No newline at end of file
From 2572ee5fe4ea5cec6b851b180854d081b4c80d46 Mon Sep 17 00:00:00 2001
From: dweinber
Date: Mon, 20 Mar 2023 21:41:51 +0100
Subject: [PATCH 23/83] Get list-object from S3 bucket to find the most recent
log files
---
player/cmcd/js/script.js | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/player/cmcd/js/script.js b/player/cmcd/js/script.js
index dd60da38..c3c17e8e 100644
--- a/player/cmcd/js/script.js
+++ b/player/cmcd/js/script.js
@@ -44,6 +44,14 @@ function setupPlayerWithCmcd() {
});
}
+function getCmcdAndCdnLogFromS3() {
+ const newRequestTimestamp = new Date();
+
+ // See https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html
+ fetch('https://bitmovin-cmcd-demo.s3.amazonaws.com\?list-type\=2\&prefix\=akamai/ak')
+ .then(response => response.text())
+}
+
$(function() {
setupPlayerWithCmcd();
});
\ No newline at end of file
From da914c0861114ab4dd753556f910cfcd01d05b08 Mon Sep 17 00:00:00 2001
From: dweinber
Date: Mon, 20 Mar 2023 21:45:18 +0100
Subject: [PATCH 24/83] Add x2js to make it more convenient to work with the
XML data of the list-object call
---
player/cmcd/index.html | 1 +
player/cmcd/js/script.js | 13 +++++++++++++
2 files changed, 14 insertions(+)
diff --git a/player/cmcd/index.html b/player/cmcd/index.html
index bdd36d84..7783d723 100644
--- a/player/cmcd/index.html
+++ b/player/cmcd/index.html
@@ -1,6 +1,7 @@
+
diff --git a/player/cmcd/js/script.js b/player/cmcd/js/script.js
index c3c17e8e..7448e86d 100644
--- a/player/cmcd/js/script.js
+++ b/player/cmcd/js/script.js
@@ -1,3 +1,8 @@
+const LOG_PULL_INTERVALL_SECONDS = 10 * 1000;
+
+let lastSuccessfulRetrieval = new Date();
+let cmcdSessionId;
+
function setupPlayerWithCmcd() {
cmcdSessionId = uuidv4();
@@ -50,6 +55,14 @@ function getCmcdAndCdnLogFromS3() {
// See https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html
fetch('https://bitmovin-cmcd-demo.s3.amazonaws.com\?list-type\=2\&prefix\=akamai/ak')
.then(response => response.text())
+ .then(response => (new X2JS()).xml2js(response))
+ .then(response => parseS3ObjectListingAndFetchDataStreamLogFiles(response, newRequestTimestamp))
+}
+
+function parseS3ObjectListingAndFetchDataStreamLogFiles(response, newRequestTimestamp) {
+ console.log(`Found ${response.ListBucketResult.KeyCount} of max ${response.ListBucketResult.MaxKeys} keys (isTruncated=${response.ListBucketResult.IsTruncated})`);
+
+ const elements = response.ListBucketResult.Contents;
}
$(function() {
From de88b4b1a01017c636f944dc85a6f2abfa0755a0 Mon Sep 17 00:00:00 2001
From: dweinber
Date: Mon, 20 Mar 2023 21:47:14 +0100
Subject: [PATCH 25/83] Retrieve all log files which were added since the last
request
---
player/cmcd/js/script.js | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/player/cmcd/js/script.js b/player/cmcd/js/script.js
index 7448e86d..69747ab6 100644
--- a/player/cmcd/js/script.js
+++ b/player/cmcd/js/script.js
@@ -63,6 +63,26 @@ function parseS3ObjectListingAndFetchDataStreamLogFiles(response, newRequestTime
console.log(`Found ${response.ListBucketResult.KeyCount} of max ${response.ListBucketResult.MaxKeys} keys (isTruncated=${response.ListBucketResult.IsTruncated})`);
const elements = response.ListBucketResult.Contents;
+ const relevantEntries = elements.filter(element => {
+ const timestamp = new Date(element.Key.split('-')[2] * 1000);
+ if (timestamp >= lastSuccessfulRetrieval) {
+ return true;
+ }
+ });
+
+ lastSuccessfulRetrieval = newRequestTimestamp;
+
+ if (relevantEntries.length > 0) {
+ let fetchPromises = []
+ relevantEntries.forEach(element => {
+ fetchPromises.push(
+ fetch('https://bitmovin-cmcd-demo.s3.amazonaws.com/' + element.Key)
+ .then(response => response.arrayBuffer())
+ );
+ });
+
+ return Promise.all(fetchPromises);
+ }
}
$(function() {
From 012e795993a71f480b2764403b8aad9ed64e67af Mon Sep 17 00:00:00 2001
From: dweinber
Date: Mon, 20 Mar 2023 21:49:02 +0100
Subject: [PATCH 26/83] Unzip and parse the log files and display them in the
log area in the page
---
player/cmcd/index.html | 1 +
player/cmcd/js/script.js | 180 ++++++++++++++++++++++++++++++++++++++-
2 files changed, 180 insertions(+), 1 deletion(-)
diff --git a/player/cmcd/index.html b/player/cmcd/index.html
index 7783d723..e3a7e2bf 100644
--- a/player/cmcd/index.html
+++ b/player/cmcd/index.html
@@ -2,6 +2,7 @@
+
diff --git a/player/cmcd/js/script.js b/player/cmcd/js/script.js
index 69747ab6..0d158479 100644
--- a/player/cmcd/js/script.js
+++ b/player/cmcd/js/script.js
@@ -1,5 +1,41 @@
const LOG_PULL_INTERVALL_SECONDS = 10 * 1000;
+const FIELD = {
+ TIMESTAMP: 4,
+ HTTP_STATUS: 6,
+ HTTP_VERSION: 7,
+ HOST: 8,
+ METHOD: 9,
+ PATH: 10,
+ PORT: 11,
+ MIME_TYPE: 14,
+ USER_AGENT: 15,
+ ENCRYPTION_VERSION: 16,
+ CMCD_DATA: 36,
+};
+const DELIMITER = ' '
+const CMCD_KEYS = {
+ EncodedBitrate: 'br',
+ BufferLength: 'bl',
+ BufferStarvation: 'bs',
+ ContentId: 'cid',
+ ObjectDuration: 'd',
+ Deadline: 'dl',
+ MeasuredThroughput: 'mtp',
+ NextObjectRequest: 'nor',
+ NextRangeRequest: 'nrr',
+ ObjectType: 'ot',
+ PlaybackRate: 'pr',
+ RequestedMaximumThroughput: 'rtp',
+ StreamingFormat: 'sf',
+ SessionId: 'sid',
+ StreamType: 'st',
+ Startup: 'su',
+ TopBitrate: 'tb',
+ CmcdVersion: 'v',
+}
+
+const logsToDisplay = [];
let lastSuccessfulRetrieval = new Date();
let cmcdSessionId;
@@ -49,6 +85,110 @@ function setupPlayerWithCmcd() {
});
}
+function log(data) {
+ const sorted = data.sort((a, b) => a.timestamp > b.timestamp);
+
+ $('#logContent').html('');
+
+ sorted.forEach(line => {
+ $('
')
+ .append(line.cmcdLog)
+ .prependTo('#logContent');
+
+ $('
')
+ .append(line.timestamp.toISOString() + ': ')
+ .append(line.cdnLog)
+ .prependTo('#logContent');
+ })
+}
+
+function beautifyCmcdHeaderData(data) {
+ const cmcdFields = data.replace('CMCD-HEADER:', '').split(',');
+
+ const beautified = cmcdFields.map(cmcd => {
+ if (cmcd === CMCD_KEYS.Startup) {
+ return 'Startup Mode';
+ }
+ if (cmcd.startsWith(`${CMCD_KEYS.ObjectType}=`)) {
+ const value = cmcd.split('=')[1];
+ const type =
+ value === 'v' ? 'Video' :
+ value === 'a' ? 'Audio' :
+ value === 'm' ? 'Manifest' : value;
+ return `Object Type: ${type}`;
+ }
+ if (cmcd === CMCD_KEYS.BufferStarvation) {
+ return 'BUFFER EMPTY!';
+ }
+ if (cmcd.startsWith(`${CMCD_KEYS.BufferLength}=`)) {
+ const value = cmcd.split('=')[1];
+ return `Buffer Length: ${Number.parseFloat(value)/1000}s`;
+ }
+ if (cmcd.startsWith(`${CMCD_KEYS.EncodedBitrate}=`)) {
+ const value = cmcd.split('=')[1];
+ return `Encoded Bitrate: ${value}`;
+ }
+ if (cmcd.startsWith(`${CMCD_KEYS.ContentId}=`)) {
+ const value = cmcd.split('=')[1];
+ return `Content ID: ${value.replace(/%22/g, '')}`;
+ }
+ if (cmcd.startsWith(`${CMCD_KEYS.ObjectDuration}=`)) {
+ const value = cmcd.split('=')[1];
+ return `Object Duration: ${Number.parseFloat(value)/1000}s`;
+ }
+ if (cmcd.startsWith(`${CMCD_KEYS.Deadline}=`)) {
+ const value = cmcd.split('=')[1];
+ return `Deadline: ${Number.parseFloat(value)/1000}s`;
+ }
+ if (cmcd.startsWith(`${CMCD_KEYS.MeasuredThroughput}=`)) {
+ const value = cmcd.split('=')[1];
+ return `Measured Throughput: ${value}`;
+ }
+ if (cmcd.startsWith(`${CMCD_KEYS.NextObjectRequest}=`)) {
+ const value = cmcd.split('=')[1];
+ return `Next Object Request: ${value}`;
+ }
+ if (cmcd.startsWith(`${CMCD_KEYS.NextRangeRequest}=`)) {
+ const value = cmcd.split('=')[1];
+ return `Next Range Request: ${value}`;
+ }
+ if (cmcd.startsWith(`${CMCD_KEYS.PlaybackRate}=`)) {
+ const value = cmcd.split('=')[1];
+ return `Playback Rate: ${value}`;
+ }
+ if (cmcd.startsWith(`${CMCD_KEYS.RequestedMaximumThroughput}=`)) {
+ const value = cmcd.split('=')[1];
+ return `Requested Maximum Throughput: ${value}`;
+ }
+ if (cmcd.startsWith(`${CMCD_KEYS.StreamingFormat}=`)) {
+ const value = cmcd.split('=')[1];
+ const format =
+ value === 'h' ? 'HLS' :
+ value === 'd' ? 'DASH' :
+ value === 's' ? 'Smooth' : 'o';
+ return `Streaming Format: ${format}`;
+ }
+ if (cmcd.startsWith(`${CMCD_KEYS.SessionId}=`)) {
+ const value = cmcd.split('=')[1];
+ return `Session ID: ${value.replace(/%22/g, '')}`;
+ }
+ if (cmcd.startsWith(`${CMCD_KEYS.StreamType}=`)) {
+ const value = cmcd.split('=')[1];
+ const type = value === 'v' ? 'VoD' : 'Live';
+ return `Stream Type: ${type}`;
+ }
+ if (cmcd.startsWith(`${CMCD_KEYS.TopBitrate}=`)) {
+ const value = cmcd.split('=')[1];
+ return `Top Bitrate: ${value}`;
+ }
+ // Version is usually omitted for version 1
+
+ return cmcd;
+ });
+
+ return beautified.filter(cmcd => !!cmcd).join(', ');
+}
+
function getCmcdAndCdnLogFromS3() {
const newRequestTimestamp = new Date();
@@ -57,6 +197,7 @@ function getCmcdAndCdnLogFromS3() {
.then(response => response.text())
.then(response => (new X2JS()).xml2js(response))
.then(response => parseS3ObjectListingAndFetchDataStreamLogFiles(response, newRequestTimestamp))
+ .then(responses => parseDataStreamLogFiles(responses))
}
function parseS3ObjectListingAndFetchDataStreamLogFiles(response, newRequestTimestamp) {
@@ -85,6 +226,43 @@ function parseS3ObjectListingAndFetchDataStreamLogFiles(response, newRequestTime
}
}
+function parseDataStreamLogFiles(responses) {
+ if (!responses || responses.length < 1) {
+ return;
+ }
+
+ let logs = '';
+ responses.forEach(response => logs += gunzipLogFile(response));
+ const allLogs = logs.split('\n');
+
+ const matchingLogs = allLogs.filter(line => line.includes(`sid=%22${cmcdSessionId}%22`));
+ const noOrOtherSessionId = allLogs.filter(line => !line.includes(`sid=%22${cmcdSessionId}%22`));
+
+ console.log(`No session ID or not ${cmcdSessionId}, ignoring those:`);
+ console.log(noOrOtherSessionId);
+
+ matchingLogs.forEach(logLine => logsToDisplay.push(convertLogLineToLoggingDataStructure(logLine)));
+ log(logsToDisplay);
+}
+
+function gunzipLogFile(content) {
+ const decompressed = fflate.decompressSync(new Uint8Array(content));
+ return String.fromCharCode.apply(null, decompressed);
+}
+
+function convertLogLineToLoggingDataStructure(logLine) {
+ const data = logLine.split(' ');
+ return {
+ timestamp: new Date(Number.parseFloat(data[FIELD.TIMESTAMP]) * 1000),
+ cdnLog: data[FIELD.HTTP_STATUS] + DELIMITER +
+ data[FIELD.METHOD] + DELIMITER +
+ data[FIELD.HTTP_VERSION] + DELIMITER +
+ data[FIELD.HOST] + '/' + data[FIELD.PATH] + DELIMITER,
+ cmcdLog: beautifyCmcdHeaderData(data[FIELD.CMCD_DATA]),
+ }
+}
+
$(function() {
setupPlayerWithCmcd();
-});
\ No newline at end of file
+ setInterval(getCmcdAndCdnLogFromS3, LOG_PULL_INTERVALL_SECONDS);
+});
From 3a339c3ece944a5f4efd87e2002874850d401241 Mon Sep 17 00:00:00 2001
From: Daniel Weinberger
Date: Tue, 21 Mar 2023 08:28:04 +0100
Subject: [PATCH 27/83] Update player/cmcd/README.md
Co-authored-by: Stefan Krainer
---
player/cmcd/README.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/player/cmcd/README.md b/player/cmcd/README.md
index 7b20fc1e..379c8c69 100644
--- a/player/cmcd/README.md
+++ b/player/cmcd/README.md
@@ -4,4 +4,6 @@ Send Common Media Client Data (CMCD) data from Player to CDN
### Tags
- - To be defined
\ No newline at end of file
+ - CMCD
+ - Common Media Client Data
+ - CDN Logging
\ No newline at end of file
From 55148d3b3a97ddce8741f18d30b3a6080092a4b9 Mon Sep 17 00:00:00 2001
From: Daniel Weinberger
Date: Tue, 21 Mar 2023 08:29:04 +0100
Subject: [PATCH 28/83] Update player/cmcd/js/script.js
Co-authored-by: Stefan Krainer
---
player/cmcd/js/script.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/player/cmcd/js/script.js b/player/cmcd/js/script.js
index 0d158479..98391eb0 100644
--- a/player/cmcd/js/script.js
+++ b/player/cmcd/js/script.js
@@ -186,7 +186,7 @@ function beautifyCmcdHeaderData(data) {
return cmcd;
});
- return beautified.filter(cmcd => !!cmcd).join(', ');
+ return beautified.filter(Boolean).join(', ');
}
function getCmcdAndCdnLogFromS3() {
From 480ec4a2aec82d157268e24d9db926afc11ad770 Mon Sep 17 00:00:00 2001
From: Daniel Weinberger
Date: Tue, 21 Mar 2023 08:29:58 +0100
Subject: [PATCH 29/83] Update player/cmcd/js/script.js
Co-authored-by: Stefan Krainer
---
player/cmcd/js/script.js | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/player/cmcd/js/script.js b/player/cmcd/js/script.js
index 98391eb0..44974c1e 100644
--- a/player/cmcd/js/script.js
+++ b/player/cmcd/js/script.js
@@ -231,9 +231,7 @@ function parseDataStreamLogFiles(responses) {
return;
}
- let logs = '';
- responses.forEach(response => logs += gunzipLogFile(response));
- const allLogs = logs.split('\n');
+ const allLogs = responses.map(response => gunzipLogFile(response)).join('').split('\n);
const matchingLogs = allLogs.filter(line => line.includes(`sid=%22${cmcdSessionId}%22`));
const noOrOtherSessionId = allLogs.filter(line => !line.includes(`sid=%22${cmcdSessionId}%22`));
From 06009875552f7df2a2c444fb5a06bc13e6c08fad Mon Sep 17 00:00:00 2001
From: Daniel Weinberger
Date: Tue, 21 Mar 2023 08:37:42 +0100
Subject: [PATCH 30/83] Update player/cmcd/js/script.js
Co-authored-by: Stefan Krainer
---
player/cmcd/js/script.js | 31 ++++++++++++-------------------
1 file changed, 12 insertions(+), 19 deletions(-)
diff --git a/player/cmcd/js/script.js b/player/cmcd/js/script.js
index 44974c1e..636f32ac 100644
--- a/player/cmcd/js/script.js
+++ b/player/cmcd/js/script.js
@@ -42,6 +42,12 @@ let cmcdSessionId;
function setupPlayerWithCmcd() {
cmcdSessionId = uuidv4();
+ const cmcdConfig = {
+ sessionId: cmcdSessionId,
+ contentId: '1111-111111-111111-11111',
+ };
+ const cmcdPlugin = new window.bitmovin.player.integration.Cmcd.CmcdIntegration(cmcdConfig);
+
const playerConfig = {
key: '29ba4a30-8b5e-4336-a7dd-c94ff3b25f30',
analytics: {
@@ -51,28 +57,15 @@ function setupPlayerWithCmcd() {
playback: {
muted: true,
autoplay: true,
- }
- };
-
- const cmcdConfig = {
- sessionId: cmcdSessionId,
- contentId: '1111-111111-111111-11111',
- };
-
- const cmcdPlugin = new window.bitmovin.player.integration.Cmcd.CmcdIntegration(cmcdConfig);
- playerConfig.network = {
- preprocessHttpRequest: cmcdPlugin.preprocessHttpRequest,
- preprocessHttpResponse: cmcdPlugin.preprocessHttpResponse,
- };
- playerConfig.adaptation = {
- desktop: {
- onVideoAdaptation: cmcdPlugin.onVideoAdaptation,
- onAudioAdaptation: cmcdPlugin.onAudioAdaptation,
},
- mobile: {
+ network: {
+ preprocessHttpRequest: cmcdPlugin.preprocessHttpRequest,
+ preprocessHttpResponse: cmcdPlugin.preprocessHttpResponse,
+ },
+ adaptation: {
onVideoAdaptation: cmcdPlugin.onVideoAdaptation,
onAudioAdaptation: cmcdPlugin.onAudioAdaptation,
- },
+ }
};
const playerContainer = document.getElementById('player-container');
From ced87fda9ef5daf9511c2658bda918db51be5862 Mon Sep 17 00:00:00 2001
From: dweinber
Date: Tue, 21 Mar 2023 08:52:15 +0100
Subject: [PATCH 31/83] Clean up title and metadata
---
player/cmcd/info.json | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/player/cmcd/info.json b/player/cmcd/info.json
index cc556092..e7a50a62 100644
--- a/player/cmcd/info.json
+++ b/player/cmcd/info.json
@@ -1,6 +1,6 @@
{
"title": "CMCD Support",
- "description": "Send Common Media Client Data (CMCD) data from Player to CDN (experimental)",
+ "description": "Send CMCD data from Player to CDN",
"long_description": "To be defined.",
"executable": {
"executable": true,
@@ -12,11 +12,13 @@
"files": []
},
"metadata":{
- "title":"Enable Common Media Client Data (CMCD) » Video Player | Bitmovin",
+ "title":"Enable CMCD » Video Player | Bitmovin",
"description": "Send Common Media Client Data (CMCD) data from Player to CDN"
},
"tags": [
"CMCD",
- "Common Media Client Data"
+ "Common Media Client Data",
+ "CDN Logging",
+ "experimental"
]
}
\ No newline at end of file
From bd76687bcfe520b53fb188cfed115dbc387bc609 Mon Sep 17 00:00:00 2001
From: dweinber
Date: Tue, 21 Mar 2023 08:52:31 +0100
Subject: [PATCH 32/83] Fix syntax error/typo
---
player/cmcd/js/script.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/player/cmcd/js/script.js b/player/cmcd/js/script.js
index 636f32ac..fa2ab69b 100644
--- a/player/cmcd/js/script.js
+++ b/player/cmcd/js/script.js
@@ -224,7 +224,7 @@ function parseDataStreamLogFiles(responses) {
return;
}
- const allLogs = responses.map(response => gunzipLogFile(response)).join('').split('\n);
+ const allLogs = responses.map(response => gunzipLogFile(response)).join('').split('\n');
const matchingLogs = allLogs.filter(line => line.includes(`sid=%22${cmcdSessionId}%22`));
const noOrOtherSessionId = allLogs.filter(line => !line.includes(`sid=%22${cmcdSessionId}%22`));
From 2b3d306d349ec4778d2af3a2d0a2743689f2858a Mon Sep 17 00:00:00 2001
From: dweinber
Date: Tue, 21 Mar 2023 09:35:03 +0100
Subject: [PATCH 33/83] Add Akamai logo
---
player/cmcd/css/style.css | 4 ++++
player/cmcd/index.html | 12 ++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/player/cmcd/css/style.css b/player/cmcd/css/style.css
index 175abaf4..087738ae 100644
--- a/player/cmcd/css/style.css
+++ b/player/cmcd/css/style.css
@@ -34,4 +34,8 @@
.cmcd-log {
color: blue;
+}
+
+.description > .col-lg-9 {
+ padding-left: 0;
}
\ No newline at end of file
diff --git a/player/cmcd/index.html b/player/cmcd/index.html
index e3a7e2bf..09e1ffb2 100644
--- a/player/cmcd/index.html
+++ b/player/cmcd/index.html
@@ -4,10 +4,14 @@
-
-
- This demo showcases how Common Media Client Data (CMCD) can be sent by the Player to a CDN.
-
+
+
+
This demo showcases how Common Media Client Data (CMCD) can be sent by the Player to a CDN.
+
+
+
+
+
From 2f6ccee371977dd0f46a56b7e01d854a8dd5fb1b Mon Sep 17 00:00:00 2001
From: dweinber
Date: Tue, 21 Mar 2023 09:35:36 +0100
Subject: [PATCH 34/83] Avoid blank logs if we get a new log file without any
relevant data inside
---
player/cmcd/js/script.js | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/player/cmcd/js/script.js b/player/cmcd/js/script.js
index fa2ab69b..c5c6dd91 100644
--- a/player/cmcd/js/script.js
+++ b/player/cmcd/js/script.js
@@ -79,6 +79,10 @@ function setupPlayerWithCmcd() {
}
function log(data) {
+ if (!data || data.length < 1) {
+ return;
+ }
+
const sorted = data.sort((a, b) => a.timestamp > b.timestamp);
$('#logContent').html('');
From 74ac22763a3bdbc1aa6a796cd88fa6a8f887a801 Mon Sep 17 00:00:00 2001
From: dweinber
Date: Tue, 21 Mar 2023 17:57:28 +0100
Subject: [PATCH 35/83] Add units and reduce decimals to 2 digits
---
player/cmcd/js/script.js | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/player/cmcd/js/script.js b/player/cmcd/js/script.js
index c5c6dd91..ac5f95ae 100644
--- a/player/cmcd/js/script.js
+++ b/player/cmcd/js/script.js
@@ -119,11 +119,11 @@ function beautifyCmcdHeaderData(data) {
}
if (cmcd.startsWith(`${CMCD_KEYS.BufferLength}=`)) {
const value = cmcd.split('=')[1];
- return `Buffer Length: ${Number.parseFloat(value)/1000}s`;
+ return `Buffer Length: ${(Number.parseFloat(value)/1000).toFixed(2)}s`;
}
if (cmcd.startsWith(`${CMCD_KEYS.EncodedBitrate}=`)) {
const value = cmcd.split('=')[1];
- return `Encoded Bitrate: ${value}`;
+ return `Encoded Bitrate: ${value}kbps`;
}
if (cmcd.startsWith(`${CMCD_KEYS.ContentId}=`)) {
const value = cmcd.split('=')[1];
@@ -131,7 +131,7 @@ function beautifyCmcdHeaderData(data) {
}
if (cmcd.startsWith(`${CMCD_KEYS.ObjectDuration}=`)) {
const value = cmcd.split('=')[1];
- return `Object Duration: ${Number.parseFloat(value)/1000}s`;
+ return `Object Duration: ${(Number.parseFloat(value)/1000).toFixed(2)}s`;
}
if (cmcd.startsWith(`${CMCD_KEYS.Deadline}=`)) {
const value = cmcd.split('=')[1];
@@ -139,7 +139,7 @@ function beautifyCmcdHeaderData(data) {
}
if (cmcd.startsWith(`${CMCD_KEYS.MeasuredThroughput}=`)) {
const value = cmcd.split('=')[1];
- return `Measured Throughput: ${value}`;
+ return `Measured Throughput: ${value}kbps`;
}
if (cmcd.startsWith(`${CMCD_KEYS.NextObjectRequest}=`)) {
const value = cmcd.split('=')[1];
@@ -151,11 +151,11 @@ function beautifyCmcdHeaderData(data) {
}
if (cmcd.startsWith(`${CMCD_KEYS.PlaybackRate}=`)) {
const value = cmcd.split('=')[1];
- return `Playback Rate: ${value}`;
+ return `Playback Rate: ${value}x`;
}
if (cmcd.startsWith(`${CMCD_KEYS.RequestedMaximumThroughput}=`)) {
const value = cmcd.split('=')[1];
- return `Requested Maximum Throughput: ${value}`;
+ return `Requested Maximum Throughput: ${value}kbps`;
}
if (cmcd.startsWith(`${CMCD_KEYS.StreamingFormat}=`)) {
const value = cmcd.split('=')[1];
@@ -176,7 +176,7 @@ function beautifyCmcdHeaderData(data) {
}
if (cmcd.startsWith(`${CMCD_KEYS.TopBitrate}=`)) {
const value = cmcd.split('=')[1];
- return `Top Bitrate: ${value}`;
+ return `Top Bitrate: ${value}kbps`;
}
// Version is usually omitted for version 1
From c0f54397e15bc0b1a4636a689c42f4c571e21c4e Mon Sep 17 00:00:00 2001
From: dweinber
Date: Wed, 22 Mar 2023 16:20:12 +0100
Subject: [PATCH 36/83] Move Akamai logo down to the CDN logs
---
player/cmcd/css/style.css | 9 +++++----
player/cmcd/index.html | 12 +++---------
2 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/player/cmcd/css/style.css b/player/cmcd/css/style.css
index 087738ae..5b7786b2 100644
--- a/player/cmcd/css/style.css
+++ b/player/cmcd/css/style.css
@@ -10,6 +10,11 @@
padding-bottom: 23px;
}
+.demo-event-box img.partner-logo {
+ float: right;
+ width: 100px;
+}
+
#logContent {
height: 300px;
width: 100%;
@@ -35,7 +40,3 @@
.cmcd-log {
color: blue;
}
-
-.description > .col-lg-9 {
- padding-left: 0;
-}
\ No newline at end of file
diff --git a/player/cmcd/index.html b/player/cmcd/index.html
index 09e1ffb2..4020d57a 100644
--- a/player/cmcd/index.html
+++ b/player/cmcd/index.html
@@ -4,14 +4,8 @@
-
-
-
This demo showcases how Common Media Client Data (CMCD) can be sent by the Player to a CDN.
-
-
-
-
-
+
+
This demo showcases how Common Media Client Data (CMCD) can be sent by the Player to a CDN.
@@ -30,6 +24,6 @@
-
CDN logs including CMCD from the Player (CMCD data highlighted in blue)
+
CDN logs including CMCD from the Player (CMCD data highlighted in blue)
It can take approximately 30 seconds to receiver CDN logs from Akamai, please bear with us
From f783aad6169c4f968cb644423d1a84ba44ac35f3 Mon Sep 17 00:00:00 2001
From: dweinber
Date: Wed, 22 Mar 2023 17:07:18 +0100
Subject: [PATCH 37/83] Update cmcd-integration with fixed mtp, dl, bl values
to be rounded according to spec
---
player/cmcd/js/cmcd-integration.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/player/cmcd/js/cmcd-integration.js b/player/cmcd/js/cmcd-integration.js
index 95a08605..7397d153 100644
--- a/player/cmcd/js/cmcd-integration.js
+++ b/player/cmcd/js/cmcd-integration.js
@@ -1 +1 @@
-!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.BitmovinPlayerIntegrationCmcd=e():(t.bitmovin=t.bitmovin||{},t.bitmovin.player=t.bitmovin.player||{},t.bitmovin.player.integration=t.bitmovin.player.integration||{},t.bitmovin.player.integration.Cmcd=e())}(self,(function(){return function(){"use strict";var t={247:function(t,e,n){n.d(e,{Ao:function(){return E},Dh:function(){return s},I3:function(){return R},J3:function(){return M},M:function(){return h},O5:function(){return b},Ph:function(){return I},QU:function(){return u},RE:function(){return a},RF:function(){return A},RZ:function(){return y},T8:function(){return m},TS:function(){return k},Vf:function(){return x},Vq:function(){return q},ZH:function(){return v},be:function(){return T},dg:function(){return O},gu:function(){return D},mP:function(){return g},mc:function(){return i},nf:function(){return o},oI:function(){return S},x9:function(){return V}});var r,i,u,o,a,s,c,p=(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});function l(t){return t.sort((function(t,e){return t.key.localeCompare(e.key)})).filter((function(t){return t.keyValuePairToString()}))}function h(t){var e=l(t),n=e.filter((function(t){return t.type===c.Request})).map((function(t){return t.keyValuePairToString()})).join(","),r=e.filter((function(t){return t.type===c.Object})).map((function(t){return t.keyValuePairToString()})).join(","),i=e.filter((function(t){return t.type===c.Status})).map((function(t){return t.keyValuePairToString()})).join(","),u=e.filter((function(t){return t.type===c.Session})).map((function(t){return t.keyValuePairToString()})).join(","),o={};return n&&(o[c.Request]=n),r&&(o[c.Object]=r),i&&(o[c.Status]=i),u&&(o[c.Session]=u),o}function y(t){var e=l(t).map((function(t){return t.keyValuePairToString()})).join(",");return"CMCD=".concat(encodeURI(e))}!function(t){t.AudioOnly="a",t.VideoOnly="v",t.MuxedVideoAudio="av",t.ManifestOrPlaylistTextFile="m",t.InitSegment="i",t.CaptionOrSubtitle="c",t.TimedTextTrack="tt",t.CryptographicKeyOrLicenseOrCertificate="k",t.Other="o"}(i||(i={})),function(t){t.MpegDash="d",t.Hls="h",t.Smooth="s",t.Other="o"}(u||(u={})),function(t){t.Vod="v",t.Live="l"}(o||(o={})),function(t){t[t.v1=1]="v1"}(a||(a={})),function(t){t.EncodedBitrate="br",t.BufferLength="bl",t.BufferStarvation="bs",t.ContentId="cid",t.ObjectDuration="d",t.Deadline="dl",t.MeasuredThroughput="mtp",t.NextObjectRequest="nor",t.NextRangeRequest="nrr",t.ObjectType="ot",t.PlaybackRate="pr",t.RequestedMaximumThroughput="rtp",t.StreamingFormat="sf",t.SessionId="sid",t.StreamType="st",t.Startup="su",t.TopBitrate="tb",t.CmcdVersion="v"}(s||(s={})),function(t){t.Object="CMCD-Object",t.Request="CMCD-Request",t.Status="CMCD-Status",t.Session="CMCD-Session"}(c||(c={}));var f,d=function(){function t(t){this.value=t}return t.prototype.keyValuePairToString=function(){return"string"==typeof this.value?"".concat(this.key,"=").concat((t=this.value,e=/"/g,n=/\\/g,'"'.concat(t.replace(n,"\\").replace(e,'\\"'),'"'))):"boolean"==typeof this.value&&!0===this.value?"".concat(this.key):"".concat(this.key,"=").concat(this.value);var t,e,n},t}(),v=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.EncodedBitrate,n.type=c.Object,n}return p(e,t),e}(d),S=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.BufferLength,n.type=c.Request,n}return p(e,t),e}(d),g=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.BufferStarvation,n.type=c.Status,n}return p(e,t),e}(d),T=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.ContentId,n.type=c.Session,n}return p(e,t),e}(d),m=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.ObjectDuration,n.type=c.Object,n}return p(e,t),e}(d),b=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.Deadline,n.type=c.Request,n}return p(e,t),e}(d),O=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.MeasuredThroughput,n.type=c.Request,n}return p(e,t),e}(d),R=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.NextObjectRequest,n.type=c.Request,n}return p(e,t),e}(d),k=(p((function(t){var e=f.call(this,t)||this;return e.key=s.NextRangeRequest,e.type=c.Request,e}),f=d),function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.ObjectType,n.type=c.Object,n}return p(e,t),e.prototype.keyValuePairToString=function(){return"".concat(this.key,"=").concat(this.value)},e}(d)),A=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.PlaybackRate,n.type=c.Session,n}return p(e,t),e.prototype.keyValuePairToString=function(){return 1===this.value?"":"".concat(this.key,"=").concat(this.value)},e}(d),M=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.RequestedMaximumThroughput,n.type=c.Status,n}return p(e,t),e}(d),x=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.StreamingFormat,n.type=c.Session,n}return p(e,t),e.prototype.keyValuePairToString=function(){return"".concat(this.key,"=").concat(this.value)},e}(d),I=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.SessionId,n.type=c.Session,n}return p(e,t),e}(d),D=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.StreamType,n.type=c.Session,n}return p(e,t),e.prototype.keyValuePairToString=function(){return"".concat(this.key,"=").concat(this.value)},e}(d),E=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.Startup,n.type=c.Request,n}return p(e,t),e.prototype.keyValuePairToString=function(){return!0===this.value?"".concat(this.key):""},e}(d),q=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.TopBitrate,n.type=c.Object,n}return p(e,t),e}(d),V=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.CmcdVersion,n.type=c.Session,n}return p(e,t),e.prototype.keyValuePairToString=function(){return this.value===a.v1?"":"".concat(this.key,"=").concat(this.value)},e}(d)},498:function(t,e,n){n.r(e),n.d(e,{CmcdIntegration:function(){return u}});var r=n(247),i=function(){return i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){n.push(new r.oI(1e3*i.level));var u=i.level/(null===(e=this.player)||void 0===e?void 0:e.getPlaybackSpeed());n.push(new r.O5(1e3*u))}var o=this.player.getAvailableAudioQualities().reduce((function(t,e){return Math.max(t,e.bitrate)}),0)/1e3;if(o>0&&n.push(new r.Vq(o)),this.currentVideoQuality){var a=this.player.getAvailableSegments();for(var s in a)if(s.startsWith("video/")){var c=a[s][this.currentVideoQuality.id];n=n.concat(this.getNextObjectAndObjectDurationCmcdData(c,t.url))}}return n},t.prototype.getVideoSegmentRequestSpecificData=function(t){var e,n=[];if(this.currentVideoQuality&&this.currentVideoQuality.bandwidth&&n.push(new r.ZH(Math.round(this.currentVideoQuality.bandwidth/1e3))),this.lastMeasuredThroughputVideo&&n.push(new r.dg(this.lastMeasuredThroughputVideo)),!this.player)return n;var i=this.player.buffer.getLevel(this.player.exports.BufferType.ForwardDuration,this.player.exports.MediaType.Video);if(i.targetLevel>0){n.push(new r.oI(1e3*i.level));var u=i.level/(null===(e=this.player)||void 0===e?void 0:e.getPlaybackSpeed());n.push(new r.O5(1e3*u))}var o=this.player.getAvailableVideoQualities().reduce((function(t,e){return Math.max(t,e.bitrate)}),0)/1e3;if(o>0&&n.push(new r.Vq(o)),this.currentVideoQuality){var a=this.player.getAvailableSegments();for(var s in a)if(s.startsWith("video/")){var c=a[s][this.currentVideoQuality.id];n=n.concat(this.getNextObjectAndObjectDurationCmcdData(c,t.url))}}return n},t.prototype.getNextObjectAndObjectDurationCmcdData=function(t,e){var n=[],i=t.findIndex((function(t){return t.url===e}));if(i>-1){var u=t[i];if(Number.isNaN(u.duration)||n.push(new r.T8(1e3*Number(u.duration))),i+10){n.push(new r.oI(1e3*i.level));var u=i.level/(null===(e=this.player)||void 0===e?void 0:e.getPlaybackSpeed());n.push(new r.O5(1e3*u))}var o=this.player.getAvailableAudioQualities().reduce((function(t,e){return Math.max(t,e.bitrate)}),0)/1e3;if(o>0&&n.push(new r.Vq(o)),this.currentVideoQuality){var a=this.player.getAvailableSegments();for(var s in a)if(s.startsWith("video/")){var c=a[s][this.currentVideoQuality.id];n=n.concat(this.getNextObjectAndObjectDurationCmcdData(c,t.url))}}return n},t.prototype.getVideoSegmentRequestSpecificData=function(t){var e,n=[];if(this.currentVideoQuality&&this.currentVideoQuality.bandwidth&&n.push(new r.ZH(Math.round(this.currentVideoQuality.bandwidth/1e3))),this.lastMeasuredThroughputVideo&&n.push(new r.dg(this.lastMeasuredThroughputVideo)),!this.player)return n;var i=this.player.buffer.getLevel(this.player.exports.BufferType.ForwardDuration,this.player.exports.MediaType.Video);if(i.targetLevel>0){n.push(new r.oI(1e3*i.level));var u=i.level/(null===(e=this.player)||void 0===e?void 0:e.getPlaybackSpeed());n.push(new r.O5(1e3*u))}var o=this.player.getAvailableVideoQualities().reduce((function(t,e){return Math.max(t,e.bitrate)}),0)/1e3;if(o>0&&n.push(new r.Vq(o)),this.currentVideoQuality){var a=this.player.getAvailableSegments();for(var s in a)if(s.startsWith("video/")){var c=a[s][this.currentVideoQuality.id];n=n.concat(this.getNextObjectAndObjectDurationCmcdData(c,t.url))}}return n},t.prototype.getNextObjectAndObjectDurationCmcdData=function(t,e){var n=[],i=t.findIndex((function(t){return t.url===e}));if(i>-1){var u=t[i];if(Number.isNaN(u.duration)||n.push(new r.T8(1e3*Number(u.duration))),i+1
Date: Thu, 23 Mar 2023 10:56:33 +0100
Subject: [PATCH 38/83] Adapt code to changed log format (was space-separate
lines, now JSON lines)
---
player/cmcd/js/script.js | 38 +++++++++++++++-----------------------
1 file changed, 15 insertions(+), 23 deletions(-)
diff --git a/player/cmcd/js/script.js b/player/cmcd/js/script.js
index ac5f95ae..54ae1152 100644
--- a/player/cmcd/js/script.js
+++ b/player/cmcd/js/script.js
@@ -1,18 +1,5 @@
const LOG_PULL_INTERVALL_SECONDS = 10 * 1000;
-const FIELD = {
- TIMESTAMP: 4,
- HTTP_STATUS: 6,
- HTTP_VERSION: 7,
- HOST: 8,
- METHOD: 9,
- PATH: 10,
- PORT: 11,
- MIME_TYPE: 14,
- USER_AGENT: 15,
- ENCRYPTION_VERSION: 16,
- CMCD_DATA: 36,
-};
const DELIMITER = ' '
const CMCD_KEYS = {
EncodedBitrate: 'br',
@@ -228,10 +215,15 @@ function parseDataStreamLogFiles(responses) {
return;
}
- const allLogs = responses.map(response => gunzipLogFile(response)).join('').split('\n');
+ const allLogs = responses
+ .map(response => gunzipLogFile(response))
+ .join('')
+ .trim()
+ .split('\n')
+ .map(line => JSON.parse(line));
- const matchingLogs = allLogs.filter(line => line.includes(`sid=%22${cmcdSessionId}%22`));
- const noOrOtherSessionId = allLogs.filter(line => !line.includes(`sid=%22${cmcdSessionId}%22`));
+ const matchingLogs = allLogs.filter(log => log.customField.includes(`sid=%22${cmcdSessionId}%22`));
+ const noOrOtherSessionId = allLogs.filter(log => !log.customField.includes(`sid=%22${cmcdSessionId}%22`));
console.log(`No session ID or not ${cmcdSessionId}, ignoring those:`);
console.log(noOrOtherSessionId);
@@ -246,14 +238,14 @@ function gunzipLogFile(content) {
}
function convertLogLineToLoggingDataStructure(logLine) {
- const data = logLine.split(' ');
return {
- timestamp: new Date(Number.parseFloat(data[FIELD.TIMESTAMP]) * 1000),
- cdnLog: data[FIELD.HTTP_STATUS] + DELIMITER +
- data[FIELD.METHOD] + DELIMITER +
- data[FIELD.HTTP_VERSION] + DELIMITER +
- data[FIELD.HOST] + '/' + data[FIELD.PATH] + DELIMITER,
- cmcdLog: beautifyCmcdHeaderData(data[FIELD.CMCD_DATA]),
+ timestamp: new Date(Number.parseFloat(logLine.reqTimeSec) * 1000),
+ cdnLog: logLine.statusCode + DELIMITER +
+ logLine.reqMethod + DELIMITER +
+ logLine.proto + DELIMITER +
+ logLine.reqHost + '/' + logLine.reqPath + DELIMITER +
+ (parseInt(logLine.cacheStatus) ? 'Cache HIT' : 'Cache MISS'),
+ cmcdLog: beautifyCmcdHeaderData(logLine.customField),
}
}
From 809efa4206836f827da99744ef545047583aec7e Mon Sep 17 00:00:00 2001
From: dweinber
Date: Thu, 23 Mar 2023 10:56:51 +0100
Subject: [PATCH 39/83] Shorten pull intervall to 5 seconds
---
player/cmcd/js/script.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/player/cmcd/js/script.js b/player/cmcd/js/script.js
index 54ae1152..c240955f 100644
--- a/player/cmcd/js/script.js
+++ b/player/cmcd/js/script.js
@@ -1,4 +1,4 @@
-const LOG_PULL_INTERVALL_SECONDS = 10 * 1000;
+const LOG_PULL_INTERVALL_SECONDS = 5 * 1000;
const DELIMITER = ' '
const CMCD_KEYS = {
From 8e1dcc017a04af138e9ed928c5716681eebd3fa1 Mon Sep 17 00:00:00 2001
From: dweinber
Date: Thu, 23 Mar 2023 11:09:50 +0100
Subject: [PATCH 40/83] Fix typo
---
player/cmcd/index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/player/cmcd/index.html b/player/cmcd/index.html
index 4020d57a..9cb74fbd 100644
--- a/player/cmcd/index.html
+++ b/player/cmcd/index.html
@@ -25,5 +25,5 @@
CDN logs including CMCD from the Player (CMCD data highlighted in blue)
-
It can take approximately 30 seconds to receiver CDN logs from Akamai, please bear with us
+
It can take approximately 30 seconds to receive CDN logs from Akamai, please bear with us
From 8a9a4bb9867b80a5be18a53f5da16055c2756a84 Mon Sep 17 00:00:00 2001
From: dweinber
Date: Thu, 23 Mar 2023 13:21:21 +0100
Subject: [PATCH 41/83] Use analytics impression ID as CMCD Session ID if
possible
---
player/cmcd/js/cmcd-integration.js | 2 +-
player/cmcd/js/script.js | 11 ++++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/player/cmcd/js/cmcd-integration.js b/player/cmcd/js/cmcd-integration.js
index 7397d153..9b131ecf 100644
--- a/player/cmcd/js/cmcd-integration.js
+++ b/player/cmcd/js/cmcd-integration.js
@@ -1 +1 @@
-!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.BitmovinPlayerIntegrationCmcd=e():(t.bitmovin=t.bitmovin||{},t.bitmovin.player=t.bitmovin.player||{},t.bitmovin.player.integration=t.bitmovin.player.integration||{},t.bitmovin.player.integration.Cmcd=e())}(self,(function(){return function(){"use strict";var t={247:function(t,e,n){n.d(e,{Ao:function(){return E},Dh:function(){return s},I3:function(){return R},J3:function(){return M},M:function(){return h},O5:function(){return b},Ph:function(){return I},QU:function(){return u},RE:function(){return a},RF:function(){return A},RZ:function(){return y},T8:function(){return m},TS:function(){return k},Vf:function(){return x},Vq:function(){return q},ZH:function(){return v},be:function(){return T},dg:function(){return O},gu:function(){return D},mP:function(){return g},mc:function(){return i},nf:function(){return o},oI:function(){return S},x9:function(){return V}});var r,i,u,o,a,s,c,p=(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});function l(t){return t.sort((function(t,e){return t.key.localeCompare(e.key)})).filter((function(t){return t.keyValuePairToString()}))}function h(t){var e=l(t),n=e.filter((function(t){return t.type===c.Request})).map((function(t){return t.keyValuePairToString()})).join(","),r=e.filter((function(t){return t.type===c.Object})).map((function(t){return t.keyValuePairToString()})).join(","),i=e.filter((function(t){return t.type===c.Status})).map((function(t){return t.keyValuePairToString()})).join(","),u=e.filter((function(t){return t.type===c.Session})).map((function(t){return t.keyValuePairToString()})).join(","),o={};return n&&(o[c.Request]=n),r&&(o[c.Object]=r),i&&(o[c.Status]=i),u&&(o[c.Session]=u),o}function y(t){var e=l(t).map((function(t){return t.keyValuePairToString()})).join(",");return"CMCD=".concat(encodeURI(e))}!function(t){t.AudioOnly="a",t.VideoOnly="v",t.MuxedVideoAudio="av",t.ManifestOrPlaylistTextFile="m",t.InitSegment="i",t.CaptionOrSubtitle="c",t.TimedTextTrack="tt",t.CryptographicKeyOrLicenseOrCertificate="k",t.Other="o"}(i||(i={})),function(t){t.MpegDash="d",t.Hls="h",t.Smooth="s",t.Other="o"}(u||(u={})),function(t){t.Vod="v",t.Live="l"}(o||(o={})),function(t){t[t.v1=1]="v1"}(a||(a={})),function(t){t.EncodedBitrate="br",t.BufferLength="bl",t.BufferStarvation="bs",t.ContentId="cid",t.ObjectDuration="d",t.Deadline="dl",t.MeasuredThroughput="mtp",t.NextObjectRequest="nor",t.NextRangeRequest="nrr",t.ObjectType="ot",t.PlaybackRate="pr",t.RequestedMaximumThroughput="rtp",t.StreamingFormat="sf",t.SessionId="sid",t.StreamType="st",t.Startup="su",t.TopBitrate="tb",t.CmcdVersion="v"}(s||(s={})),function(t){t.Object="CMCD-Object",t.Request="CMCD-Request",t.Status="CMCD-Status",t.Session="CMCD-Session"}(c||(c={}));var f,d=function(){function t(t){this.value=t}return t.prototype.keyValuePairToString=function(){return"string"==typeof this.value?"".concat(this.key,"=").concat((t=this.value,e=/"/g,n=/\\/g,'"'.concat(t.replace(n,"\\").replace(e,'\\"'),'"'))):"boolean"==typeof this.value&&!0===this.value?"".concat(this.key):"".concat(this.key,"=").concat(this.value);var t,e,n},t}(),v=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.EncodedBitrate,n.type=c.Object,n}return p(e,t),e}(d),S=function(t){function e(e){var n=t.call(this,100*Math.round(e/100))||this;return n.key=s.BufferLength,n.type=c.Request,n}return p(e,t),e}(d),g=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.BufferStarvation,n.type=c.Status,n}return p(e,t),e}(d),T=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.ContentId,n.type=c.Session,n}return p(e,t),e}(d),m=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.ObjectDuration,n.type=c.Object,n}return p(e,t),e}(d),b=function(t){function e(e){var n=t.call(this,100*Math.round(e/100))||this;return n.key=s.Deadline,n.type=c.Request,n}return p(e,t),e}(d),O=function(t){function e(e){var n=t.call(this,100*Math.round(e/100))||this;return n.key=s.MeasuredThroughput,n.type=c.Request,n}return p(e,t),e}(d),R=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.NextObjectRequest,n.type=c.Request,n}return p(e,t),e}(d),k=(p((function(t){var e=f.call(this,t)||this;return e.key=s.NextRangeRequest,e.type=c.Request,e}),f=d),function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.ObjectType,n.type=c.Object,n}return p(e,t),e.prototype.keyValuePairToString=function(){return"".concat(this.key,"=").concat(this.value)},e}(d)),A=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.PlaybackRate,n.type=c.Session,n}return p(e,t),e.prototype.keyValuePairToString=function(){return 1===this.value?"":"".concat(this.key,"=").concat(this.value)},e}(d),M=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.RequestedMaximumThroughput,n.type=c.Status,n}return p(e,t),e}(d),x=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.StreamingFormat,n.type=c.Session,n}return p(e,t),e.prototype.keyValuePairToString=function(){return"".concat(this.key,"=").concat(this.value)},e}(d),I=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.SessionId,n.type=c.Session,n}return p(e,t),e}(d),D=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.StreamType,n.type=c.Session,n}return p(e,t),e.prototype.keyValuePairToString=function(){return"".concat(this.key,"=").concat(this.value)},e}(d),E=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.Startup,n.type=c.Request,n}return p(e,t),e.prototype.keyValuePairToString=function(){return!0===this.value?"".concat(this.key):""},e}(d),q=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.TopBitrate,n.type=c.Object,n}return p(e,t),e}(d),V=function(t){function e(e){var n=t.call(this,e)||this;return n.key=s.CmcdVersion,n.type=c.Session,n}return p(e,t),e.prototype.keyValuePairToString=function(){return this.value===a.v1?"":"".concat(this.key,"=").concat(this.value)},e}(d)},498:function(t,e,n){n.r(e),n.d(e,{CmcdIntegration:function(){return u}});var r=n(247),i=function(){return i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){n.push(new r.oI(1e3*i.level));var u=i.level/(null===(e=this.player)||void 0===e?void 0:e.getPlaybackSpeed());n.push(new r.O5(1e3*u))}var o=this.player.getAvailableAudioQualities().reduce((function(t,e){return Math.max(t,e.bitrate)}),0)/1e3;if(o>0&&n.push(new r.Vq(o)),this.currentVideoQuality){var a=this.player.getAvailableSegments();for(var s in a)if(s.startsWith("video/")){var c=a[s][this.currentVideoQuality.id];n=n.concat(this.getNextObjectAndObjectDurationCmcdData(c,t.url))}}return n},t.prototype.getVideoSegmentRequestSpecificData=function(t){var e,n=[];if(this.currentVideoQuality&&this.currentVideoQuality.bandwidth&&n.push(new r.ZH(Math.round(this.currentVideoQuality.bandwidth/1e3))),this.lastMeasuredThroughputVideo&&n.push(new r.dg(this.lastMeasuredThroughputVideo)),!this.player)return n;var i=this.player.buffer.getLevel(this.player.exports.BufferType.ForwardDuration,this.player.exports.MediaType.Video);if(i.targetLevel>0){n.push(new r.oI(1e3*i.level));var u=i.level/(null===(e=this.player)||void 0===e?void 0:e.getPlaybackSpeed());n.push(new r.O5(1e3*u))}var o=this.player.getAvailableVideoQualities().reduce((function(t,e){return Math.max(t,e.bitrate)}),0)/1e3;if(o>0&&n.push(new r.Vq(o)),this.currentVideoQuality){var a=this.player.getAvailableSegments();for(var s in a)if(s.startsWith("video/")){var c=a[s][this.currentVideoQuality.id];n=n.concat(this.getNextObjectAndObjectDurationCmcdData(c,t.url))}}return n},t.prototype.getNextObjectAndObjectDurationCmcdData=function(t,e){var n=[],i=t.findIndex((function(t){return t.url===e}));if(i>-1){var u=t[i];if(Number.isNaN(u.duration)||n.push(new r.T8(1e3*Number(u.duration))),i+10){n.push(new r.oI(1e3*i.level));var u=i.level/(null===(e=this.player)||void 0===e?void 0:e.getPlaybackSpeed());n.push(new r.O5(1e3*u))}var o=this.player.getAvailableAudioQualities().reduce((function(t,e){return Math.max(t,e.bitrate)}),0)/1e3;if(o>0&&n.push(new r.Vq(o)),this.currentVideoQuality){var a=this.player.getAvailableSegments();for(var s in a)if(s.startsWith("video/")){var c=a[s][this.currentVideoQuality.id];n=n.concat(this.getNextObjectAndObjectDurationCmcdData(c,t.url))}}return n},t.prototype.getVideoSegmentRequestSpecificData=function(t){var e,n=[];if(this.currentVideoQuality&&this.currentVideoQuality.bandwidth&&n.push(new r.ZH(Math.round(this.currentVideoQuality.bandwidth/1e3))),this.lastMeasuredThroughputVideo&&n.push(new r.dg(this.lastMeasuredThroughputVideo)),!this.player)return n;var i=this.player.buffer.getLevel(this.player.exports.BufferType.ForwardDuration,this.player.exports.MediaType.Video);if(i.targetLevel>0){n.push(new r.oI(1e3*i.level));var u=i.level/(null===(e=this.player)||void 0===e?void 0:e.getPlaybackSpeed());n.push(new r.O5(1e3*u))}var o=this.player.getAvailableVideoQualities().reduce((function(t,e){return Math.max(t,e.bitrate)}),0)/1e3;if(o>0&&n.push(new r.Vq(o)),this.currentVideoQuality){var a=this.player.getAvailableSegments();for(var s in a)if(s.startsWith("video/")){var c=a[s][this.currentVideoQuality.id];n=n.concat(this.getNextObjectAndObjectDurationCmcdData(c,t.url))}}return n},t.prototype.getNextObjectAndObjectDurationCmcdData=function(t,e){var n=[],i=t.findIndex((function(t){return t.url===e}));if(i>-1){var u=t[i];if(Number.isNaN(u.duration)||n.push(new r.T8(1e3*Number(u.duration))),i+1
Date: Thu, 23 Mar 2023 13:21:55 +0100
Subject: [PATCH 42/83] Rename variable name
---
player/cmcd/js/script.js | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/player/cmcd/js/script.js b/player/cmcd/js/script.js
index 1f237ddc..8fc72a93 100644
--- a/player/cmcd/js/script.js
+++ b/player/cmcd/js/script.js
@@ -33,7 +33,7 @@ function setupPlayerWithCmcd() {
sessionId: cmcdSessionId,
contentId: '1111-111111-111111-11111',
};
- const cmcdPlugin = new window.bitmovin.player.integration.Cmcd.CmcdIntegration(cmcdConfig);
+ const cmcdIntegration = new window.bitmovin.player.integration.Cmcd.CmcdIntegration(cmcdConfig);
const playerConfig = {
key: '29ba4a30-8b5e-4336-a7dd-c94ff3b25f30',
@@ -46,12 +46,12 @@ function setupPlayerWithCmcd() {
autoplay: true,
},
network: {
- preprocessHttpRequest: cmcdPlugin.preprocessHttpRequest,
- preprocessHttpResponse: cmcdPlugin.preprocessHttpResponse,
+ preprocessHttpRequest: cmcdIntegration.preprocessHttpRequest,
+ preprocessHttpResponse: cmcdIntegration.preprocessHttpResponse,
},
adaptation: {
- onVideoAdaptation: cmcdPlugin.onVideoAdaptation,
- onAudioAdaptation: cmcdPlugin.onAudioAdaptation,
+ onVideoAdaptation: cmcdIntegration.onVideoAdaptation,
+ onAudioAdaptation: cmcdIntegration.onAudioAdaptation,
}
};
@@ -62,12 +62,12 @@ function setupPlayerWithCmcd() {
const analyticsImpressionId = player.analytics.getCurrentImpressionId();
if (analyticsImpressionId) {
cmcdSessionId = analyticsImpressionId;
- cmcdPlugin.setSessionId(cmcdSessionId);
+ cmcdIntegration.setSessionId(cmcdSessionId);
console.log(`Updated CMCD session ID to match Analytics Impression ID ${cmcdSessionId}`);
}
}
- cmcdPlugin.setPlayer(player);
+ cmcdIntegration.setPlayer(player);
player.load({
hls: 'https://bitmovindemocmcd-a.akamaihd.net/content/MI201109210084_1/m3u8s-fmp4-rel/main.m3u8',
From ee6da3d29c4e5eb1e9d8c4c5e68f2f4ebc4d3846 Mon Sep 17 00:00:00 2001
From: dweinber
Date: Thu, 23 Mar 2023 13:41:06 +0100
Subject: [PATCH 43/83] Add bullet point for common Session ID
---
player/cmcd/index.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/player/cmcd/index.html b/player/cmcd/index.html
index 9cb74fbd..9abf9a5a 100644
--- a/player/cmcd/index.html
+++ b/player/cmcd/index.html
@@ -19,6 +19,7 @@
Combine CDN and Player logs to improve operational monitoring
Faster troubleshooting by seeing Player sessions in CDN logs
Optimize performance through pre-fetching and measure impact through Analytics
+ Easily find logs for specific sessions using common Analytics Session ID
From 5ef7ab43093376b95a43480be2e0da07579e9ea9 Mon Sep 17 00:00:00 2001
From: dweinber
Date: Fri, 24 Mar 2023 09:28:08 +0100
Subject: [PATCH 44/83] Switch to queryString mode for CMCD data per Akamai's
recommendation
---
player/cmcd/js/script.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/player/cmcd/js/script.js b/player/cmcd/js/script.js
index 8fc72a93..d32e9279 100644
--- a/player/cmcd/js/script.js
+++ b/player/cmcd/js/script.js
@@ -30,6 +30,7 @@ function setupPlayerWithCmcd() {
cmcdSessionId = uuidv4();
const cmcdConfig = {
+ useQueryArgs: true,
sessionId: cmcdSessionId,
contentId: '1111-111111-111111-11111',
};
@@ -96,7 +97,7 @@ function log(data) {
}
function beautifyCmcdHeaderData(data) {
- const cmcdFields = data.replace('CMCD-HEADER:', '').split(',');
+ const cmcdFields = data.replace('CMCD-HEADER:', '').replace('CMCD-QST:', '').split(',');
const beautified = cmcdFields.map(cmcd => {
if (cmcd === CMCD_KEYS.Startup) {
From f218df870f5e7f5137cff496ba4b604b98da6505 Mon Sep 17 00:00:00 2001
From: dweinber
Date: Thu, 30 Mar 2023 15:57:13 +0200
Subject: [PATCH 45/83] Update texts on the demo page
---
player/cmcd/index.html | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/player/cmcd/index.html b/player/cmcd/index.html
index 9abf9a5a..a7fca9e4 100644
--- a/player/cmcd/index.html
+++ b/player/cmcd/index.html
@@ -16,10 +16,12 @@
- - Combine CDN and Player logs to improve operational monitoring
- - Faster troubleshooting by seeing Player sessions in CDN logs
- - Optimize performance through pre-fetching and measure impact through Analytics
- - Easily find logs for specific sessions using common Analytics Session ID
+ - Troubleshoot errors and find root causes faster. CMCD makes Player sessions visible in CDN logs so you can trace error sessions through the Player and CDN to find the root cause. Faster issue resolution reduces the cost of streaming errors for your business.
+
+ - Add Bitmovin Analytics to turbocharge your customer support. Pinpoint error sessions rapidly and use the common Analytics Session ID with CMCD to trace the session through your infrastructure, from Analytics to Player to CDN.
+
+ - Combine Player and CDN logs with common session & content identifiers. Improve your operational monitoring by giving a clearer view of content requests from Player and how those are handled by the CDN.
+ - Improve quality of experience and reduce rebuffering by enabling pre-fetching. Through CMCD the CDN is aware of the Player’s current state and the content it most likely needs next, this allows the CDN to prepare and deliver data the Player needs faster, reducing the time your viewers are waiting.
From b0dd8778d208b546017b3c2e54cda895c079b377 Mon Sep 17 00:00:00 2001
From: James Varndell <78730971+jamesbitmovin@users.noreply.github.com>
Date: Thu, 30 Mar 2023 16:03:47 +0100
Subject: [PATCH 46/83] Update index.html
Highlighted some text in bold
---
player/cmcd/index.html | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/player/cmcd/index.html b/player/cmcd/index.html
index a7fca9e4..aa175312 100644
--- a/player/cmcd/index.html
+++ b/player/cmcd/index.html
@@ -16,12 +16,20 @@
- - Troubleshoot errors and find root causes faster. CMCD makes Player sessions visible in CDN logs so you can trace error sessions through the Player and CDN to find the root cause. Faster issue resolution reduces the cost of streaming errors for your business.
+ -
+ Troubleshoot errors and find root causes faster. CMCD makes Player sessions visible in CDN logs so you can trace error sessions through the Player and CDN to find the root cause. Faster issue resolution reduces the cost of streaming errors for your business.
+
- - Add Bitmovin Analytics to turbocharge your customer support. Pinpoint error sessions rapidly and use the common Analytics Session ID with CMCD to trace the session through your infrastructure, from Analytics to Player to CDN.
+ -
+ Add Bitmovin Analytics to turbocharge your customer support. Pinpoint error sessions rapidly and use the common Analytics Session ID with CMCD to trace the session through your infrastructure, from Analytics to Player to CDN.
+
- - Combine Player and CDN logs with common session & content identifiers. Improve your operational monitoring by giving a clearer view of content requests from Player and how those are handled by the CDN.
- - Improve quality of experience and reduce rebuffering by enabling pre-fetching. Through CMCD the CDN is aware of the Player’s current state and the content it most likely needs next, this allows the CDN to prepare and deliver data the Player needs faster, reducing the time your viewers are waiting.
+ -
+ Combine Player and CDN logs with common session & content identifiers. Improve your operational monitoring by giving a clearer view of content requests from Player and how those are handled by the CDN.
+
+ -
+ Improve quality of experience and reduce rebuffering by enabling pre-fetching. Through CMCD the CDN is aware of the Player’s current state and the content it most likely needs next, this allows the CDN to prepare and deliver data the Player needs faster, reducing the time your viewers are waiting.
+
From 6e58843e3b924a027bb65c57aef93d5bec2085ca Mon Sep 17 00:00:00 2001
From: dweinber
Date: Fri, 31 Mar 2023 09:45:35 +0200
Subject: [PATCH 47/83] Increase font size for description slightly
---
player/cmcd/css/style.css | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/player/cmcd/css/style.css b/player/cmcd/css/style.css
index 5b7786b2..190e84fd 100644
--- a/player/cmcd/css/style.css
+++ b/player/cmcd/css/style.css
@@ -1,3 +1,7 @@
+span, b {
+ font-size: medium;
+}
+
.demo-event-box {
padding: 23px;
border: solid 1px #CBE0ED;
From aa1c948bb865dd6fc007b17e81ac607a15ce878b Mon Sep 17 00:00:00 2001
From: dweinber
Date: Thu, 6 Apr 2023 17:25:45 +0200
Subject: [PATCH 48/83] Add prefetch diagram
---
player/cmcd/index.html | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/player/cmcd/index.html b/player/cmcd/index.html
index aa175312..54fd686a 100644
--- a/player/cmcd/index.html
+++ b/player/cmcd/index.html
@@ -34,7 +34,16 @@
-