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. For HLS candidates, it considers only clear or FairPlay-protected sources. An HLS source whose systems property names another DRM system, such as Widevine, is skipped.
  2. Among HLS sources that use the HTTPS scheme, it prefers a source whose URL contains hvc1 (HEVC). Otherwise it selects the HTTPS HLS source with the highest ext_x_version that is a string convertible to an integer. Sources with a missing or non-convertible value do not participate in that ranking.
  3. If no HTTPS HLS source is selected, it returns the first eligible HLS source that uses another scheme.
  4. If no HLS source is selected, it returns the first MP4 source.
  5. If none of the above is found, it returns the first source that is not DASH. DASH sources are never selected by this policy.
  6. The selected source URL is provided to the AVPlayer for playback. The SDK does not choose a rendition inside the HLS manifest; the AVPlayer selects and adjusts the bitrate and resolution.

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.