BrightcoveDataCollectionTracker

public protocol BrightcoveDataCollectionTracker

Tracker for Brightcove Data Collection API v2 events.

Handles the construction and transmission of analytics events to Brightcove’s metrics tracker endpoint. Events are sent via HTTP requests using the platform’s native HTTP client (e.g., HTTPClient on iOS/tvOS).

  • Clean up resources when tracker is destroyed.

    Declaration

    Swift

    func destroy()
  • Gets the current session ID.

    Declaration

    Swift

    func getSessionId() -> String

    Return Value

    The unique session identifier for this tracking session

  • Tracks a player_load event. This event marks the beginning of a tracking session and should be sent first.

    Declaration

    Swift

    func trackPlayerLoad()
  • Tracks a video_impression event. Fired when video metadata is loaded and player is ready for view.

    Declaration

    Swift

    func trackVideoImpression()
  • Tracks a play_request event. Fired when playback is requested (manual or automatic via autoplay).

    Declaration

    Swift

    func trackPlayRequest()
  • Tracks a video_view event. Fired when actual video playback starts. Only one per viewing session.

    Declaration

    Swift

    func trackVideoView(startTimeMs: Int?)

    Parameters

    startTimeMs

    Time in milliseconds between playback initiation and first frame render (optional). Should exclude ad time (handled by caller).

  • Tracks a video_engagement event. Sent periodically during playback to report QoE (Quality of Experience) metrics.

    Declaration

    Swift

    func trackVideoEngagement(
        currentTime: Double,
        duration: Double?,
        rangeStart: Double,
        metrics: [String: Any]?
    )

    Parameters

    currentTime

    Current playback position in seconds

    duration

    Total video duration in seconds (optional)

    rangeStart

    Start of the engagement range in seconds

    metrics

    Optional Quality of Experience metrics dictionary containing:

  • Tracks an ad_mode_begin event. Fired when control is handed to advertising agent (start of ad break).

    Declaration

    Swift

    func trackAdModeBegin()
  • Tracks an ad_mode_complete event. Fired when control is returned from advertising agent (end of ad break).

    Declaration

    Swift

    func trackAdModeComplete()
  • Tracks an error event. Fired when playback errors occur.

    Declaration

    Swift

    func trackError(errorCode: String)

    Parameters

    errorCode

    Platform-specific error code (String variant)

  • Tracks an error event. Fired when playback errors occur.

    Declaration

    Swift

    func trackError(errorCode: Int)

    Parameters

    errorCode

    Platform-specific error code (Int variant)