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]>
39 lines
1.4 KiB
JavaScript
39 lines
1.4 KiB
JavaScript
/*! @license
|
|
* Copyright 2024 Streaming Video Technology Alliance
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
goog.provide('cml.cmcd.CMCD_STATE_EVENT_FIELDS');
|
|
|
|
goog.require('cml.cmcd.CMCD_EVENT_BACKGROUNDED_MODE');
|
|
goog.require('cml.cmcd.CMCD_EVENT_BITRATE_CHANGE');
|
|
goog.require('cml.cmcd.CMCD_EVENT_CONTENT_ID');
|
|
goog.require('cml.cmcd.CMCD_EVENT_PLAY_STATE');
|
|
goog.require('cml.cmcd.CMCD_EVENT_PLAYBACK_RATE');
|
|
|
|
|
|
/**
|
|
* Maps each state-change event type to the persistent field whose
|
|
* value the event signals.
|
|
*
|
|
* Per CTA-5004-B, the state-change events `ps`, `pr`, `c`, `b`, `bc`
|
|
* are state-transition markers and must carry the field whose value
|
|
* they signal. Consumers force-include the field post-filter
|
|
* (`prepareCmcdData`), dedup against its value (`CmcdReporter`), and
|
|
* check its presence in payloads (`validateCmcdStructure`).
|
|
*
|
|
* Iteration order is load-bearing: `CmcdReporter.update()` fires
|
|
* state-change events in map order when multiple tracked fields
|
|
* change in a single call. Do not reorder entries without auditing
|
|
* reporter behavior.
|
|
*
|
|
* @const {!Map<string, string>}
|
|
*/
|
|
cml.cmcd.CMCD_STATE_EVENT_FIELDS = new Map([
|
|
[cml.cmcd.CMCD_EVENT_PLAY_STATE, 'sta'],
|
|
[cml.cmcd.CMCD_EVENT_PLAYBACK_RATE, 'pr'],
|
|
[cml.cmcd.CMCD_EVENT_CONTENT_ID, 'cid'],
|
|
[cml.cmcd.CMCD_EVENT_BACKGROUNDED_MODE, 'bg'],
|
|
[cml.cmcd.CMCD_EVENT_BITRATE_CHANGE, 'br'],
|
|
]);
|