Type Alias: CmcdReportRecorderOptions
type CmcdReportRecorderOptions = object;Defined in: CmcdReportRecorderOptions.ts:9
Options for CmcdReportRecorder.attach().
Properties
eventTargetUrls?
eventTargetUrls?: readonly string[];Defined in: CmcdReportRecorderOptions.ts:18
URLs whose POST requests the recorder intercepts and answers with a synthetic 204 response instead of sending them to the network. A request matches if its URL starts with any entry.
Use this option to verify CMCD event-mode reports without real network calls to placeholder endpoints.
onReport?
onReport?: (report) => void;Defined in: CmcdReportRecorderOptions.ts:54
Called once for each captured CMCD report, immediately after it is appended to the buffer and before any pending waitFor* promises resolve. Use for live UI inspection in test harness pages. detach() clears the callback. To resume notification, pass a new callback to a later attach().
The callback receives the same CmcdRecordedReport type that getReports() returns. If you only need a subset, filter by report.type or report.reportingMode inside the callback.
Parameters
report
Returns
void
Example
const reports: CmcdRecordedReport[] = []
const recorder = new CmcdReportRecorder()
recorder.attach({
onReport: (report: CmcdRecordedReport) => reports.push(report),
})
// ... player runs, emits CMCD requests ...
await fetch('https://cdn.example.com/seg1.m4s?CMCD=sid%3D%22abc%22')
await fetch('https://cdn.example.com/seg2.m4s?CMCD=sid%3D%22abc%22')
// `reports` updates in real time as captures arrive; a test
// harness page would push to a UI table here instead of an
// array.
equal(reports.length, 2)
recorder.detach()transports?
transports?: readonly CmcdTransportAdapter[];Defined in: CmcdReportRecorderOptions.ts:28
Override the default transport adapters. Defaults to [createXhrTransport(), createFetchTransport()], which patches XMLHttpRequest and fetch on the current realm.
If the player under test uses a non-standard transport, for example a custom HTTP client, supply this option.
waitTimeout?
waitTimeout?: number;Defined in: CmcdReportRecorderOptions.ts:37
Default timeout (in milliseconds) applied to every waitFor* call on this recorder. Each call can still pass an explicit timeout to override this default.
Default Value
15000