Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue/3619 CMCD #3662

Merged
merged 71 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from 68 commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
90b4527
Merge remote-tracking branch 'upstream/master'
dsparacio Oct 29, 2020
49d611f
Merge branch 'master' of https://github.com/google/shaka-player
dsparacio Jan 25, 2021
93fdcd3
Merge remote-tracking branch 'upstream/master'
littlespex May 4, 2021
0b7ac5b
Merge branch 'google:master' into master
littlespex Sep 8, 2021
63791ed
Update AUTHORS and CONTRIBUTORS
littlespex Sep 8, 2021
1ccca06
Add CMCD configuration
littlespex Sep 8, 2021
e38f313
Add CMCD configuration
littlespex Sep 8, 2021
c2e9fff
Merge branch 'issue/3619-cmcd' of https://github.com/cbsinteractive/s…
littlespex Sep 9, 2021
6db0e3c
Merge branch 'google:master' into master
littlespex Sep 15, 2021
53b4164
Add vscode settings folder to gitignore
littlespex Sep 20, 2021
efaebee
Merge branch 'google:master' into master
littlespex Sep 20, 2021
efdbe59
Add missing CMCD property to typedef
littlespex Sep 20, 2021
43b8bb2
Add basic CMCD data to segment requests
littlespex Sep 21, 2021
c57c250
Move CMCD types and object to shaka.cmcd namespace
littlespex Sep 21, 2021
26e6b87
Add basic CMCD data to manifest requests
littlespex Sep 21, 2021
136e30e
Fix manifest tests
littlespex Sep 21, 2021
6e53bdc
Decouple streaming_engine and cmcd_manager
littlespex Sep 21, 2021
1717bfa
Add new cmcd config fields to demo
littlespex Sep 21, 2021
aef9356
Add unit test for CmcdManager
littlespex Sep 22, 2021
7fed0d0
Merge branch 'google:master' into master
littlespex Sep 22, 2021
f9f7032
Merge branch 'master' into issue/3619-cmcd
littlespex Sep 22, 2021
3d9b2f5
Fix lint issues
littlespex Sep 22, 2021
af67fc2
Fix doc formatting
littlespex Sep 22, 2021
eb5e216
Add code comments
littlespex Sep 22, 2021
baeeaca
Fix incorrect default value for CmcdConfiguration useHeaders
littlespex Sep 23, 2021
9949fea
Fix issue where custom fields were not being passed as headers
littlespex Sep 23, 2021
abdbef8
Add support for su and bs parameters
littlespex Sep 23, 2021
af7a001
Add CMCD data to files loaded via src=
littlespex Sep 23, 2021
f18d21f
Improve test coverage
littlespex Sep 23, 2021
43c285e
Fix incorrect buffer length value formatting
littlespex Sep 29, 2021
389eaf3
Implement fixes for spec compliance testing
littlespex Sep 30, 2021
0f13d3a
Remove debug lines
littlespex Sep 30, 2021
7a30028
Merge branch 'google:master' into master
littlespex Sep 30, 2021
6f3d867
Update AUTHORS and CONTRIBUTORS
littlespex Sep 8, 2021
f7e1aca
Add CMCD configuration
littlespex Sep 8, 2021
aa0ea61
Add vscode settings folder to gitignore
littlespex Sep 20, 2021
b4db54b
Add missing CMCD property to typedef
littlespex Sep 20, 2021
fadba49
Add basic CMCD data to segment requests
littlespex Sep 21, 2021
f942a72
Move CMCD types and object to shaka.cmcd namespace
littlespex Sep 21, 2021
74142c3
Add basic CMCD data to manifest requests
littlespex Sep 21, 2021
d3a088b
Fix manifest tests
littlespex Sep 21, 2021
c71e7b0
Decouple streaming_engine and cmcd_manager
littlespex Sep 21, 2021
b133880
Add new cmcd config fields to demo
littlespex Sep 21, 2021
47a88bb
Add unit test for CmcdManager
littlespex Sep 22, 2021
988183d
Fix lint issues
littlespex Sep 22, 2021
28831de
Fix doc formatting
littlespex Sep 22, 2021
73e6351
Add code comments
littlespex Sep 22, 2021
f31d9cc
Fix incorrect default value for CmcdConfiguration useHeaders
littlespex Sep 23, 2021
c5e54d6
Fix issue where custom fields were not being passed as headers
littlespex Sep 23, 2021
5cc54b5
Add support for su and bs parameters
littlespex Sep 23, 2021
2708da0
Add CMCD data to files loaded via src=
littlespex Sep 23, 2021
76e1fc7
Improve test coverage
littlespex Sep 23, 2021
002b638
Fix incorrect buffer length value formatting
littlespex Sep 29, 2021
437fd18
Implement fixes for spec compliance testing
littlespex Sep 30, 2021
77f8ef9
Remove debug lines
littlespex Sep 30, 2021
0e83c7e
Merge branch 'issue/3619-cmcd' of https://github.com/cbsinteractive/s…
littlespex Sep 30, 2021
09e239c
Replace uuid util with crypto.randomUUID
littlespex Sep 30, 2021
ed5d9f4
Fix missing and incorrect HLS data
littlespex Sep 30, 2021
9479f9e
Return early if not enabled
littlespex Oct 6, 2021
f13588b
Add note about session id being auto-generated at load
littlespex Oct 8, 2021
a168e3d
revert hls_parser bandwidth change
littlespex Oct 8, 2021
340908d
Alphabetize imports
littlespex Oct 8, 2021
131fed7
Rename initialized_ to playbackStarted_
littlespex Oct 8, 2021
8f4cfe8
Refactor applyManifestData to use StreamFormat enum
littlespex Oct 8, 2021
8a13831
Add missing return types
littlespex Oct 8, 2021
660a4e5
Move cmcd configuration into constructor
littlespex Oct 9, 2021
1957b95
Consolidate applySegmentData arguments
littlespex Oct 9, 2021
b8ec43a
Optimize getBufferLength function
littlespex Oct 9, 2021
f847d3e
Update getBufferLength to meet spec requirements of only reporting fo…
littlespex Oct 11, 2021
860ae15
Remove redundant conditional
littlespex Oct 18, 2021
11ac1a1
Merge branch 'master' into issue/3619-cmcd
littlespex Oct 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ dist/
docs/api/
coverage/
.DS_Store
.vscode
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@ Tomohiro Matsuzawa <[email protected]>
Toshihiro Suzuki <[email protected]>
uStudio Inc. <*@ustudio.com>
Verizon Digital Media Services <*@verizondigitalmedia.com>
ViacomCBS <*@viacomcbs.com>
Vincent Valot <[email protected]>
Wayne Morgan <[email protected]>
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Benjamin Wallberg <[email protected]>
Boris Cupac <[email protected]>
Brad Nadler <[email protected]>
Bryan Huh <[email protected]>
Casey Occhialini <[email protected]>
Chad Assareh <[email protected]>
Chris Fillmore <[email protected]>
Costel Madalin Grecu <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions build/types/core
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
+../../lib/util/abortable_operation.js
+../../lib/util/array_utils.js
+../../lib/util/buffer_utils.js
+../../lib/util/cmcd_manager.js
+../../lib/util/config_utils.js
+../../lib/util/data_view_reader.js
+../../lib/util/delayed_tick.js
Expand Down
4 changes: 4 additions & 0 deletions demo/common/message_ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ shakaDemo.MessageIds = {
BUFFER_BEHIND: 'DEMO_BUFFER_BEHIND',
BUFFERING_GOAL: 'DEMO_BUFFERING_GOAL',
CLOCK_SYNC_URI: 'DEMO_CLOCK_SYNC_URI',
CMCD_SECTION_HEADER: 'DEMO_CMCD_SECTION_HEADER',
CONNECTION_TIMEOUT: 'DEMO_CONNECTION_TIMEOUT',
CONTENT_ID: 'DEMO_CONTENT_ID',
DEFAULT_AUDIO_CODEC: 'DEMO_DEFAULT_AUDIO_CODEC',
DEFAULT_PRESENTATION_DELAY: 'DEMO_DEFAULT_PRESENTATION_DELAY',
DEFAULT_VIDEO_CODEC: 'DEMO_DEFAULT_VIDEO_CODEC',
Expand Down Expand Up @@ -222,6 +224,7 @@ shakaDemo.MessageIds = {
RESTRICTIONS_SECTION_HEADER: 'DEMO_RESTRICTIONS_SECTION_HEADER',
SAFE_SEEK_OFFSET: 'DEMO_SAFE_SEEK_OFFSET',
SAFE_SKIP_DISTANCE: 'DEMO_SAFE_SKIP_DISTANCE',
SESSION_ID: 'DEMO_SESSION_ID',
SHAKA_CONTROLS: 'DEMO_SHAKA_CONTROLS',
STALL_DETECTOR_ENABLED: 'DEMO_STALL_DETECTOR_ENABLED',
STALL_THRESHOLD: 'DEMO_STALL_THRESHOLD',
Expand All @@ -238,6 +241,7 @@ shakaDemo.MessageIds = {
UI_LOCALE: 'DEMO_UI_LOCALE',
UPDATE_EXPIRATION_TIME: 'DEMO_UPDATE_EXPIRATION_TIME',
UPDATE_INTERVAL_SECONDS: 'DEMO_UPDATE_INTERVAL_SECONDS',
USE_HEADERS: 'DEMO_USE_HEADERS',
USE_NATIVE_HLS_SAFARI: 'DEMO_USE_NATIVE_HLS_SAFARI',
USE_PERSISTENT_LICENSES: 'DEMO_USE_PERSISTENT_LICENSES',
VIDEO_ROBUSTNESS: 'DEMO_VIDEO_ROBUSTNESS',
Expand Down
12 changes: 12 additions & 0 deletions demo/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ shakaDemo.Config = class {
this.addManifestSection_();
this.addRetrictionsSection_('',
shakaDemo.MessageIds.RESTRICTIONS_SECTION_HEADER);
this.addCmcdSection_();
}

/**
Expand Down Expand Up @@ -264,6 +265,17 @@ shakaDemo.Config = class {
MessageIds.ADAPTATION_RESTRICTIONS_SECTION_HEADER);
}

/** @private */
addCmcdSection_() {
const MessageIds = shakaDemo.MessageIds;
const docLink = this.resolveExternLink_('.CmcdConfiguration');
this.addSection_(MessageIds.CMCD_SECTION_HEADER, docLink)
.addBoolInput_(MessageIds.ENABLED, 'cmcd.enabled')
.addTextInput_(MessageIds.SESSION_ID, 'cmcd.sessionId')
.addTextInput_(MessageIds.CONTENT_ID, 'cmcd.contentId')
.addBoolInput_(MessageIds.USE_HEADERS, 'cmcd.useHeaders');
}

/**
* @param {string} category
* @param {!shakaDemo.MessageIds} sectionName
Expand Down
4 changes: 4 additions & 0 deletions demo/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@
"DEMO_CLEAR": "No DRM protection",
"DEMO_CLEAR_KEY": "Clear Key DRM",
"DEMO_CLOCK_SYNC_URI": "Clock Sync URI",
"DEMO_CMCD_SECTION_HEADER": "CMCD",
"DEMO_COMPILED_DEBUG": "Compiled (Debug)",
"DEMO_COMPILED_RELEASE": "Compiled (Release)",
"DEMO_CONNECTION_TIMEOUT": "Connection timeout",
"DEMO_CONFIG": "Shaka Player Demo Config",
"DEMO_CONTAINER_SEARCH": "Container",
"DEMO_CONTENT_ID": "Content ID",
"DEMO_CUSTOM": "Custom",
"DEMO_CUSTOM_CONTENT": "CUSTOM CONTENT",
"DEMO_CUSTOM_INTRO_ONE": "Try Shaka Player with your own content!",
Expand Down Expand Up @@ -169,6 +171,7 @@
"DEMO_RESTRICTIONS_SECTION_HEADER": "Restrictions",
"DEMO_SAFE_SEEK_OFFSET": "Safe Seek Offset",
"DEMO_SAFE_SKIP_DISTANCE": "Safe Skip Distance",
"DEMO_SESSION_ID": "Session ID",
"DEMO_SAVE_BUTTON": "Save",
"DEMO_SHAKA": "Shaka",
"DEMO_SHAKA_CONTROLS": "Shaka Controls",
Expand Down Expand Up @@ -213,6 +216,7 @@
"DEMO_UPDATE_INTERVAL_SECONDS": "Update interval seconds",
"DEMO_UPLYNK": "Verizon Digital Media Services",
"DEMO_USE_FULL_SEGMENTS_FOR_START_TIME": "Use Full Segments For Start Time",
"DEMO_USE_HEADERS": "Use Headers",
"DEMO_USE_NATIVE_HLS_SAFARI": "Use native HLS on Safari",
"DEMO_USE_PERSISTENT_LICENSES": "Use Persistent Licenses",
"DEMO_VIDEO_ROBUSTNESS": "Video Robustness",
Expand Down
16 changes: 16 additions & 0 deletions demo/locales/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@
"description": "The name of a configuration value.",
"message": "Clock Sync URI"
},
"DEMO_CMCD_SECTION_HEADER": {
"description": "The header for a section of configuration values.",
"message": "[JARGON:CMCD]"
},
"DEMO_COMPILED_DEBUG": {
"description": "A link in the footer, to the debug build of the demo.",
"message": "Compiled (Debug)"
Expand All @@ -155,6 +159,10 @@
"description": "A header on a search field that filters by container type.",
"message": "Container"
},
"DEMO_CONTENT_ID": {
"description": "The name of a configuration value.",
"message": "Content ID"
},
"DEMO_CUSTOM": {
"description": "Text that describes an asset that was defined by the user.",
"message": "Custom"
Expand Down Expand Up @@ -687,6 +695,10 @@
"description": "A button to save a custom asset.",
"message": "Save"
},
"DEMO_SESSION_ID": {
"description": "The name of a configuration value.",
"message": "Session ID"
},
"DEMO_SHAKA": {
"description": "Text that describes an asset that comes from the Shaka Player asset library.",
"message": "[PROPER_NAME:Shaka]"
Expand Down Expand Up @@ -855,6 +867,10 @@
"description": "Text that describes an asset that comes from the Verizon Digital Media Services asset library.",
"message": "[PROPER_NAME:Verizon Digital Media Services]"
},
"DEMO_USE_HEADERS": {
"description": "The name of a configuration value.",
"message": "Use Headers"
},
"DEMO_USE_NATIVE_HLS_SAFARI": {
"description": "The name of a configuration value.",
"message": "Use native [PROPER_NAME:HLS] on Safari"
Expand Down
11 changes: 10 additions & 1 deletion externs/shaka/manifest_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ shaka.extern.ManifestParser = class {
/**
* @typedef {{
* networkingEngine: !shaka.net.NetworkingEngine,
* modifyManifestRequest: function(!shaka.extern.Request,
* shaka.util.CmcdManager.ManifestInfo),
* modifySegmentRequest: function(!shaka.extern.Request,
* shaka.util.CmcdManager.SegmentInfo),
* filter: function(shaka.extern.Manifest):!Promise,
* makeTextStreamsForClosedCaptions: function(shaka.extern.Manifest),
* onTimelineRegionAdded: function(shaka.extern.TimelineRegionInfo),
Expand All @@ -118,6 +122,12 @@ shaka.extern.ManifestParser = class {
*
* @property {!shaka.net.NetworkingEngine} networkingEngine
* The networking engine to use for network requests.
* @property {function(!shaka.extern.Request,
* shaka.util.CmcdManager.ManifestInfo)} modifyManifestRequest
* Modify a manifest request
* @property {function(!shaka.extern.Request,
* shaka.util.CmcdManager.SegmentInfo)} modifySegmentRequest
* Modify a segment request
* @property {function(shaka.extern.Manifest):!Promise} filter
* Should be called when new variants or text streams are added to the
* Manifest. Note that this operation is asynchronous.
Expand Down Expand Up @@ -150,4 +160,3 @@ shaka.extern.ManifestParser.PlayerInterface;
* @exportDoc
*/
shaka.extern.ManifestParser.Factory;

38 changes: 37 additions & 1 deletion externs/shaka/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ shaka.extern.StreamingConfiguration;
* automatically, but will still appear in the track list and can still be
* selected via <code>selectVariantTrack()</code>. If no tracks meet these
* restrictions, AbrManager should not fail, but choose a low-res or
* low-bandwidth variant instead. It is the responsibiliy of AbrManager
* low-bandwidth variant instead. It is the responsibility of AbrManager
* implementations to follow these rules and implement this behavior.
* @property {number} switchInterval
* The minimum amount of time that must pass between switches, in
Expand All @@ -954,6 +954,39 @@ shaka.extern.StreamingConfiguration;
shaka.extern.AbrConfiguration;


/**
* @typedef {{
* enabled: boolean,
* useHeaders: boolean,
* sessionId: string,
* contentId: string
* }}
*
* @description
* Common Media Client Data (CMCD) configuration.
*
* @property {boolean} enabled
* If <code>true</code>, enable CMCD data to be sent with media requests.
* Defaults to <code>false</code>.
* @property {boolean} useHeaders
* If <code>true</code>, send CMCD data using the header transmission mode
* instead of query args. Defaults to <code>false</code>.
* @property {string} sessionId
* A GUID identifying the current playback session. A playback session
* typically ties together segments belonging to a single media asset.
* Maximum length is 64 characters. It is RECOMMENDED to conform to the UUID
* specification. By default the sessionId is automatically generated on each
* <code>load()</code> call.
* @property {string} contentId
* A unique string identifying the current content. Maximum length is 64
* characters. This value is consistent across multiple different sessions and
* devices and is defined and updated at the discretion of the service
* provider.
* @exportDoc
*/
shaka.extern.CmcdConfiguration;


/**
* @typedef {{
* trackSelectionCallback:
Expand Down Expand Up @@ -995,6 +1028,7 @@ shaka.extern.OfflineConfiguration;
* streaming: shaka.extern.StreamingConfiguration,
* abrFactory: shaka.extern.AbrManager.Factory,
* abr: shaka.extern.AbrConfiguration,
* cmcd: shaka.extern.CmcdConfiguration,
* offline: shaka.extern.OfflineConfiguration,
* preferredAudioLanguage: string,
* preferredTextLanguage: string,
Expand All @@ -1021,6 +1055,8 @@ shaka.extern.OfflineConfiguration;
* A factory to construct an abr manager.
* @property {shaka.extern.AbrConfiguration} abr
* ABR configuration and settings.
* @property {shaka.extern.CmcdConfiguration} cmcd
* CMCD configuration and settings. (Common Media Client Data)
* @property {shaka.extern.OfflineConfiguration} offline
* Offline configuration and settings.
* @property {string} preferredAudioLanguage
Expand Down
4 changes: 4 additions & 0 deletions lib/dash/dash_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ goog.require('shaka.media.PresentationTimeline');
goog.require('shaka.media.SegmentIndex');
goog.require('shaka.net.NetworkingEngine');
goog.require('shaka.text.TextEngine');
goog.require('shaka.util.CmcdManager');
goog.require('shaka.util.Error');
goog.require('shaka.util.Functional');
goog.require('shaka.util.Iterables');
Expand Down Expand Up @@ -214,6 +215,9 @@ shaka.dash.DashParser = class {
this.manifestUris_, this.config_.retryParameters);
const networkingEngine = this.playerInterface_.networkingEngine;

const format = shaka.util.CmcdManager.StreamingFormat.DASH;
this.playerInterface_.modifyManifestRequest(request, {format: format});

const startTime = Date.now();
const operation = networkingEngine.request(requestType, request);
this.operationManager_.manage(operation);
Expand Down
Loading