iOS: Source Selection

In this topic, you will learn how the Brightcove Native Player SDK for iOS uses a default source (rendition) selection process when playing a video.

Default selection process

When you retrieve videos from the Brightcove catalog or construct a BCOVVideo object with multiple BCOVSource elements, the player has to decide which BCOVSource (rendition) to play back.

Apple introduced App Transport Security in iOS 9, and strongly encourages the use of HTTPS instead of HTTP for all web traffic. Therefore, the Brightcove default source selection policy is: [BCOVBasicSourceSelectionPolicy sourceSelectionHLSWithScheme:NSURLProtectionSpaceHTTPS].

Brightcove provides a default implementation as follows:

  1. It looks for the first source that has a deliveryType of HLS using the HTTPS scheme.
  2. If no such source is found, the first HLS with an HTTP scheme is returned.
  3. If no HLS sources are present, it will fall back to the first source with a deliveryType of MP4.
  4. If none of the above is found, the first playable source of any kind is returned.
  5. The source URL is provided to the AVPlayer for playback.
  6. When playback begins, the AVPlayer is responsible for selecting which bit rate and resolution to serve.
  7. The AVPlayer will start at the first item in the index and adjust accordingly.

When using the default transcode settings, the first HLS source should be the master m3u8 playlist that points to all of your individual renditions.

Alternate source selection policies

You can easily override the default source selection policy if this does not work for you. For details, see the Source Selection section of the Brightcove Player SDK for iOS reference document.

Overriding source

If you want to override which BCOVSource gets provided to the AVPlayer, you can implement the sourceSelectionPolicy block property on the BCOVBasicSessionProviderOptions class.