BrightcoveDataCollectionConfig

public struct BrightcoveDataCollectionConfig

Configuration for Brightcove Data Collection API v2 integration.

This configuration enables optional tracking of playback QoE metrics and events to the Brightcove analytics platform. When provided, the player will automatically report metrics such as video views, engagement, buffering, and errors.

  • Brightcove Video Cloud account ID (required). This is the numeric account ID used to identify the account in the Data Collection API.

    Declaration

    Swift

    public let accountId: Int
  • Video Cloud video ID (required). The unique identifier for the video being tracked.

    Declaration

    Swift

    public let videoId: String
  • Human-readable name of the video (optional). Used for identification in analytics reports.

    Declaration

    Swift

    public let videoName: String?
  • Unique session identifier (optional). If not provided, a UUID will be generated automatically. Session ID must be globally unique to prevent data collisions. Format recommendation: accountId_timestamp or standard UUID v4

    Declaration

    Swift

    public let sessionId: String?
  • Interval in milliseconds between video engagement events (optional). Default: 10000 (10 seconds) Valid range: 5000-20000 ms Lower values increase granularity but also increase API requests.

    Declaration

    Swift

    public let engagementEventInterval: Int?
  • Unique user identifier (optional). Should be hashed with SHA-256 for privacy. If not provided, the API falls back to IP + User-Agent hashing.

    Declaration

    Swift

    public let userId: String?
  • Device type override (optional). Overrides automatic device detection. Supported values: ‘mobile’, ‘tablet’, ‘tv’, ‘desktop’, ‘other’

    Declaration

    Swift

    public let deviceType: String?
  • Operating system override (optional). Overrides automatic OS detection. Supported values: ‘android’, ‘ios’, ‘linux’, ‘mac’, ‘windows’, ‘tv’, etc.

    Declaration

    Swift

    public let deviceOs: String?
  • OS version (optional). Example: ‘14.5’, ‘11’, etc.

    Declaration

    Swift

    public let deviceOsVersion: String?
  • Device manufacturer (optional). Example: ‘Apple’, ‘Samsung’, ‘Sony’, etc.

    Declaration

    Swift

    public let deviceManufacturer: String?
  • Browser type (optional). Example: ‘chrome’, ‘firefox’, ‘safari’, etc.

    Declaration

    Swift

    public let browserType: String?
  • ISO-3166 alpha-2 country code (optional). Example: ‘US’, ‘GB’, ‘DE’

    Declaration

    Swift

    public let country: String?
  • Human-readable country name (optional). Example: ‘United States’, ‘United Kingdom’

    Declaration

    Swift

    public let countryName: String?
  • ISO-3166 alpha-2 region code (optional). Example: ‘CA’ (California), ‘NY’ (New York)

    Declaration

    Swift

    public let region: String?
  • Human-readable region name (optional). Example: ‘California’, ‘New York’

    Declaration

    Swift

    public let regionName: String?
  • City name (optional).

    Declaration

    Swift

    public let city: String?
  • dma

    DMA code (optional). Designated Market Area code for US locations.

    Declaration

    Swift

    public let dma: String?
  • Current page URL (optional). Used to track where the video is being played. Defaults to document.location.href if not provided.

    Declaration

    Swift

    public let destination: String?
  • Referring page URL (optional). Typically the previous page that sent the user to the current page. Defaults to document.referrer if not provided.

    Declaration

    Swift

    public let source: String?
  • Player ID (optional). Custom identifier for the player instance.

    Declaration

    Swift

    public let playerId: String?
  • Player name (optional). Human-readable name for the player.

    Declaration

    Swift

    public let playerName: String?
  • Custom application identifier (optional). Can be used to identify the application using the player.

    Declaration

    Swift

    public let application: String?
  • Enable debug logging. Default: false When true, additional logging is output for troubleshooting.

    Declaration

    Swift

    public let debugLogging: Bool
  • Include QoE (Quality of Experience) metrics in video_engagement events. Default: false

    When false, video_engagement events are still sent (mandatory) but WITHOUT optional QoE metrics. When true, includes optional QoE metrics like rendition details, dropped frames, bandwidth, etc.

    Note: video_engagement events are mandatory for minimal implementation. This flag only controls whether to include optional QoE metrics within those events. Collecting QoE metrics may impact performance on low-end devices (LG, Tizen, Vizio).

    Declaration

    Swift

    public let includeQoEMetrics: Bool
  • Initializes a new Brightcove Data Collection configuration.

    Declaration

    Swift

    public init(
        accountId: Int,
        videoId: String,
        videoName: String? = nil,
        sessionId: String? = nil,
        engagementEventInterval: Int? = nil,
        userId: String? = nil,
        deviceType: String? = nil,
        deviceOs: String? = nil,
        deviceOsVersion: String? = nil,
        deviceManufacturer: String? = nil,
        browserType: String? = nil,
        country: String? = nil,
        countryName: String? = nil,
        region: String? = nil,
        regionName: String? = nil,
        city: String? = nil,
        dma: String? = nil,
        destination: String? = nil,
        source: String? = nil,
        playerId: String? = nil,
        playerName: String? = nil,
        application: String? = nil,
        debugLogging: Bool? = nil,
        includeQoEMetrics: Bool? = nil
    )

    Parameters

    accountId

    Brightcove Video Cloud account ID (required)

    videoId

    Video Cloud video ID (required)

    videoName

    Human-readable video name (optional)

    sessionId

    Unique session identifier (optional, auto-generated if not provided)

    engagementEventInterval

    Interval in milliseconds between engagement events (optional, default: 10000)

    userId

    Unique user identifier (optional)

    deviceType

    Device type override (optional)

    deviceOs

    Operating system (optional)

    deviceOsVersion

    OS version (optional)

    deviceManufacturer

    Device manufacturer (optional)

    browserType

    Browser type (optional)

    country

    ISO-3166 country code (optional)

    countryName

    Country name (optional)

    region

    Region code (optional)

    regionName

    Region name (optional)

    city

    City name (optional)

    dma

    DMA code (optional)

    destination

    Current page URL (optional)

    source

    Referring page URL (optional)

    playerId

    Player instance ID (optional)

    playerName

    Player name (optional)

    application

    Application identifier (optional)

    debugLogging

    Enable debug logging (optional, defaults to false if not provided)

    includeQoEMetrics

    Include QoE metrics (optional, defaults to false if not provided)