Files
ShakaPlayer/third_party/cml-cmcd/cmcd_player_state.js
Casey OcchialiniandClaude Code 55e7d35358 feat(cmcd): vendor @svta/cml-cmcd, replace custom encoder + state machine (#10060)
Replace shaka's custom CMCD wire-format encoding and reporting state
machine with a vendored Closure port of @svta/cml-cmcd (v2.4.0) under
third_party/cml-cmcd/. shaka.util.CmcdManager becomes a thin adapter
around CML's spec-conformant encoder and CmcdReporter; its public API
is otherwise unchanged.

Intentional wire-format changes to align with CTA-5004 / CTA-5004-B:
- nor is now root-relative and uses the V2 inner-list format
  (nor=("next.m4v")).
- Non-spec 'ld'/'lh' StreamingFormat values dropped; low-latency DASH
  now emits sf=d and low-latency HLS sf=h.
- V2 output is RFC 8941 SFV-conformant: e/sta are tokens (e=ps, not
  e="ps"), v=2 is always present, and ts is emitted in event mode only
  (dropped from request mode).

Experimental v2 config renamed: targets -> eventTargets and per-target
timeInterval -> interval. Adds public EventType/PlayerState re-exports.

Co-Authored-By: Claude Code (Claude Opus 4.8) <[email protected]>
2026-07-12 10:07:21 -07:00

70 lines
1.3 KiB
JavaScript

/*! @license
* Copyright 2024 Streaming Video Technology Alliance
* SPDX-License-Identifier: Apache-2.0
*/
goog.provide('cml.cmcd.CmcdPlayerState');
/**
* CMCD v2 player states for the `sta` key.
*
* @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#state}
*
* @enum {string}
*/
cml.cmcd.CmcdPlayerState = {
/**
* Starting: Initial startup of the player.
*/
STARTING: 's',
/**
* Playing: The player is actively rendering content.
*/
PLAYING: 'p',
/**
* Seeking: The player is seeking to a new position.
*/
SEEKING: 'k',
/**
* Rebuffering: The player is buffering data during playback.
*/
REBUFFERING: 'r',
/**
* Paused: The player is paused.
*/
PAUSED: 'a',
/**
* Waiting: The player is waiting for a user action or another event.
*/
WAITING: 'w',
/**
* Ended: The media has finished playing.
*/
ENDED: 'e',
/**
* Fatal Error: The player has encountered a fatal error.
*/
FATAL_ERROR: 'f',
/**
* Quit: User initiated end of playback before media asset
* completion.
*/
QUIT: 'q',
/**
* Preloading: The player is loading assets ahead of starting in
* order to provide a fast startup. The expectation is that
* playback will commence at a future time.
*/
PRELOADING: 'd',
};