Mux logo - video home
Docs
  • Introduction to Data
  • Track your video engagement and performance
    • HTML5 video element
    • HLS.js
    • AVPlayer
    • ExoPlayer
    • Dash.js
    • Video.js
    • React native video
    • Kaltura (Web)
    • Kaltura (iOS)
    • Kaltura (Android)
    • JW Player (Web)
    • JW Player (iOS)
    • Android MediaPlayer
    • Bitmovin player
    • Bitmovin player (Android)
    • Akamai media player
    • NexPlayer
    • Ooyala player
    • Shaka player
    • Azure media player
    • THEOplayer (Web)
    • THEOplayer (iOS)
    • THEOplayer (Android)
    • Flowplayer
    • Brightcove (Web)
    • Brightcove (iOS)
    • Brightcove (Android)
    • CTS PDK
    • Chromecast
    • Roku
    • Samsung Tizen
    • LG
    • Agnoplay player
  • Make API requests
  • Set up alerts
  • Make your data actionable with metadata
  • Track autoplaying videos
  • Extend Data with custom metadata
  • Track CDN for request metrics
  • See how many people are watching
  • Build a custom integration
  • Understand metric definitions
  • Export raw video view data
  • Ensure privacy compliance
  • Mux Data FAQs
Mux.comLog in
Mux logo - video home
Docs
GuidesAPI ReferenceChangelog

Monitor Brightcove (iOS)

This guide walks through integration with Brightcove iOS player to collect video performance metrics with Mux Data.

In this guide:

1

Install Mux Data SDK

1

Install Mux Data SDK

Install Mux-Stats-AVPlayer and import the framework into your application.

2

Initialize AVPlayerLayer monitor

2

Initialize AVPlayerLayer monitor

Use the Brightcove SDK lifecycle events in order to access the underlying AVPlayerLayer instance.

Brightcove's native SDK for iOS is based on AVPlayerLayer. You will need to be using Brightcove's iOS player version 6.x.

1Install Mux Data SDK

pod 'Mux-Stats-AVPlayer', '~>2.0' 

This will install Mux-Stats-AVPlayer and the latest current release of our core Objective-C Library. There will be no breaking updates in major versions, so you can safely run pod update for future versions.

Next, add correct import statement into your application.

2Initialize AVPlayerLayer monitor

Get your ENV_KEY from the Mux environments dashboard.

Env Key is different than your API token

ENV_KEY is a client-side key used for Mux Data monitoring. These are not to be confused with API tokens which are created in the admin settings dashboard and meant to access the Mux API from a trusted server.

In your application, you will need to hook into Brightcove's SDK lifecycle events in order to access the underlying AVPlayerLayer instance.

@import BrightcovePlayerSDK;
@import MUXSDKStats;

@property (nonatomic, copy) NSString *trackedPlayerName;

- (void)playbackController:(id<BCOVPlaybackController>)controller didAdvanceToPlaybackSession:(id<BCOVPlaybackSession>)session
{
    // Destroy previous MUXSDKStats if this signifies the other view ended
    // Note: you may want to handle this in another lifecycle event, if you
    // have one that signifies when the video playback has ended/exited.
    if (self.trackedPlayerName != nil) {
        [MUXSDKStats destroyPlayer:self.trackedPlayerName];
    }

    MUXSDKCustomerPlayerData *playerData = [[MUXSDKCustomerPlayerData alloc] initWithEnvironmentKey:@"ENV_KEY"];
    [playerData setPlayerName: @"Brightcove SDK w/ Mux"];
    // set additional player metadata here
    MUXSDKCustomerVideoData *videoData = [MUXSDKCustomerVideoData new];
    [videoData setVideoId:@"EXAMPLE ID"];
    // set additional video metadata here
    self.trackedPlayerName = @"example_player_name";
    [MUXSDKStats monitorAVPlayerLayer:session.playerLayer withPlayerName:self.trackedPlayerName playerData:playerData videoData:videoData];
} 

Refer to the detailed guide for AVPlayer to finish setup.

Detailed AVPlayer guide

After getting a reference to your AVPlayerLayer instance, finish configuring it.
Read the guide

Was this page helpful?