CML
    Preparing search index...

    Type Alias CmcdEventReportConfig<C>

    CmcdEventReportConfig: CmcdReportConfig & {
        batchSize?: number;
        events?: CmcdEventType[];
        interval?: number;
        transform?: CmcdEventReportTransform<C>;
        url: string;
        version?: typeof CMCD_V2;
    }

    Configuration for a CMCD event report.

    Type Parameters

    • C = Record<string, unknown>

      The shape of the player's customData on the request that triggered the event. Defaults to Record<string, unknown>.

    Type Declaration

    • OptionalbatchSize?: number

      The number of events to batch before sending the report.

      1

    • Optionalevents?: CmcdEventType[]

      The events to report. If no events are provided, the event target will be effectively disabled.

      undefined

    • Optionalinterval?: number

      When the time interval event is sent, the interval at which the events should be reported as a number of seconds.

      CMCD_DEFAULT_TIME_INTERVAL

    • Optionaltransform?: CmcdEventReportTransform<C>

      Transform applied to each of this target's event reports before it is queued. Return the data to continue, or null to cancel the report for this target.

      Scoped to this target only: targets that share a collector URL each run their own transform, and a report cancelled here is still sent to other targets that accept the event.

      undefined

      const { requester } = createMockRequester()

      const reporter = new CmcdReporter({
      sid: 'session-id',
      cid: 'content-id',
      enabledKeys: ['br', 'sid', 'cid', 'v', 'sn'],
      // Request mode: never decorate license requests with CMCD
      transform: (data, request) => request.url.includes('/license') ? null : data,
      eventTargets: [
      {
      url: 'https://collector.example.com/cmcd',
      events: [CmcdEventType.RESPONSE_RECEIVED],
      enabledKeys: ['url', 'rc', 'sid', 'v', 'e', 'ts', 'sn'],
      batchSize: 1,
      // Event mode, this target only: segment responses only
      transform: (data, request) =>
      request?.customData?.['requestType'] === 'segment' ? data : null,
      },
      ],
      }, requester)

      const license = reporter.createRequestReport({ url: 'https://drm.example.com/license' })
      ok(!license.url.includes('CMCD='))

      const segment = reporter.createRequestReport({ url: 'https://cdn.example.com/segment.mp4' })
      ok(segment.url.includes('CMCD='))
    • url: string

      The URL to which the CMCD event should be sent.

    • Optionalversion?: typeof CMCD_V2

      The version of the CMCD protocol to use. Must be version 2 or higher for event reporting.

      CMCD_V2