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

feat: CMCD v2 LTC and MSD keys #1

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Conversation

JoaquinBCh
Copy link

@JoaquinBCh JoaquinBCh commented Sep 20, 2024

This PR introduces two new CMCD v2 keys to shaka player:

  • ltc (live stream latency): The time delta between when a given media timestamp was made available at the origin and when it was rendered by the client.
  • msd (media start delay): Measures the initial delay in wall-clock time from when a player is instructed to play media for a given session to when any media begins playback. (This is sent only once when it is calculated)

While this update does not implement full CMCD v2 support, it extends the CMCD v1 implementation to handle these two new values when requested.

Summary:

  • Updated the player settings: cmcd.reporting.requestMode.version must be set to 2 to use these new CMCD v2 keys.
  • Implemented logic to retrieve the values for ltc and msd if requested and if the version is set to 2.
  • Implemented logic to send the msd value only once.
  • Created getLiveLatency() method in player to calculate the latency and use it for ltc.
  • Created unit tests for the two new keys (ltc and msd) to ensure their correct behavior when cmcd.reporting.requestMode.version is set to 2.

Testing:

  • Verified that the ltc and msd keys are included when the reporting version is set to 2 and these keys are requested. And the msd key is sent only once when it is calculated.
  • Verified that these keys are not included when the version is set to 1 or it is not set.

How to Test manually:

Test that msd and ltc values are sent correctly

Set the following configuration to the player:

player.configure({
  cmcd: {
    enabled: true,
    reporting: {
      requestMode: {
        version: 2,
      },
    },
    includeKeys: ['sid', 'cid', 'v', 'msd', 'ltc'],
  }
});

Verify that the msd value is sent only once after being calculated, and the ltc value is sent with every request.

Test the msd value is calculated correctly

Use throttling in your browser to slow down your connection and reproduce the streaming.

image

The msd value should be higher than usual.

Notes:

  • This PR adds support for the ltc and msd keys but does not implement the entire CMCD v2

@JoaquinBCh JoaquinBCh changed the title Implement CMCD v2 LTC and MSD keys feat: Implement CMCD v2 LTC and MSD keys Oct 2, 2024
@JoaquinBCh JoaquinBCh changed the title feat: Implement CMCD v2 LTC and MSD keys feat: CMCD v2 LTC and MSD keys Oct 2, 2024
@JoaquinBCh JoaquinBCh marked this pull request as ready for review October 2, 2024 14:03
lib/util/cmcd_manager.js Outdated Show resolved Hide resolved
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.

4 participants