Mux

The Mux Developer Hub

Welcome to the Mux developer hub. You'll find comprehensive guides and documentation to help you start working with Mux as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started

Brightcove SDK for iOS

Brightcove's native SDK for iOS is based on AVPlayerLayer and as such, integration with Mux Data is simple. You will need to refer to Integration Guide: AVPlayer for more detailed information, but Brightcove-specific details are included below.

Requirements

  • Brightcove SDK for iOS 6.x

Integration instructions

Brightcove's SDK manages the lifecycle of the underlying AVPlayerLayer instances, and as such, you need to intercept the event where the Brightcove SDK creates a new AVPlayerLayer. This happens on the - (void)playbackController:(id<BCOVPlaybackController>)controller didAdvanceToPlaybackSession:(id<BCOVPlaybackSession>)session callback of the BCOVPlaybackControllerBasicDelegate. In this callback, you should both destroy any previous player you tracked through MUXSDKStats, as well as monitor the new AVPlayerLayer.

See below for sample code.

// ViewController.m

@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] initWithPropertyKey:@"EXAMPLE_PROPERTY_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];
}

Updated about a year ago

Brightcove SDK for iOS


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.