Skip to content

feat(CMCD): Add CMCD version 2 response mode #8781

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

Conversation

juanmanuel-qualabs
Copy link
Contributor

This PR focuses on the implementation of Response Mode functionalities for version 2 of the Common Media Client Data (CMCD v2) specification within the Shaka Player project.

Key changes made in this pull request include:

  • Response Mode: CMCD v2 introduces "Request Mode," "Response Mode," and "Event Mode". Request Mode aligns with the default delivery mode in CMCD v1. Response Mode, which this PR implements, allows clients to send data to one or more alternative destinations after receiving either a full response or an error to a media object request. These reports use one of the defined data transmission modes (Query Mode or Headers Mode)
  • CmcdTarget: A new configuration type, shaka.extern.CmcdTarget, was introduced. This configuration allows specifying the transmission strategy (mode=response) since targets can also be configured for event mode (mode=event), whether it's enabled (enabled), if it uses HTTP headers mode (useHeaders=true) or query parameters mode, the destination URL (url), and specific keys to include (includeKeys). For Response Mode, the mode value includes 'response'.
  • Independent Handling of Transmission Modes: Request mode and Response mode can be enabled and disabled independently using the previously mentioned CmcdTarget config for response mode and the base config for request mode.
  • Validation and Filtering of Keys: Allowed keys for Response Mode were added, and validation for these keys was implemented. The capability to include (includeKeys) and filter specific keys for both Request Mode and each Response Mode target was also enabled. Also, CMCD dictionary definitions were moved to a new dedicated section to improve structure
  • Unit Tests: Extensive unit tests were included and unified to validate CMCD v2 functionality in both Request Mode and Response Mode.

The following keys are defined in the CMCD v2 specification but are not calculated or attached to requests/responses in the cmcd_manager.js code:

  • Common & Request Mode Keys:
    • ab (Aggregate encoded bitrate)
    • tbl (Target Buffer length)
    • cdn (CDN Id)
    • bg (Backgrounded)
    • sta (State)
    • ts (Timestamp)
    • tpb (Top playable bitrate)
    • lb (Lowest encoded bitrate)
    • tab (Top aggregated encoded bitrate)
    • lab (Lowest aggregated encoded bitrate)
    • pt (Playhead time)
    • ec (Player Error Code)
  • Response Mode Keys:
    • rc (Response code)
    • ttfb (Time to first byte)
    • ttfbb (Time to first body byte)
    • ttlb (Time to last byte)
    • url (Request URL)
    • cmsdd (CMSD Dynamic Header)
    • cmsds (CMSD Static Header)

juanmanuel-qualabs and others added 30 commits May 27, 2025 16:05
Added constants for CMCD Mode
Co-authored-by: Álvaro Velad Galván <[email protected]>
Co-authored-by: Álvaro Velad Galván <[email protected]>
Copy link

google-cla bot commented Jun 20, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@juanmanuel-qualabs juanmanuel-qualabs changed the title feat/CMCD-v2-response-mode feat: CMCD-v2-response-mode Jun 20, 2025
@avelad avelad changed the title feat: CMCD-v2-response-mode feat(CMCD): Add CMCD version 2 response mode Jun 20, 2025
@juanmanuel-qualabs juanmanuel-qualabs deleted the cmcdv2/response-mode-enabled-keys branch June 20, 2025 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants