Quick Start: Create a Simple TV Video App using Swift

Product(s)
Brightcove Player
Video Cloud
Role(s)
Device SDK Developer
Task(s)
Develop with the Native SDKs
Topic(s)
Code Samples
API(s)
Playback API
SDK
Get Started
tvOS

In this topic, you will learn how to build a simple video playback app using the Brightcove Player SDK for tvOS that will be playable on an Apple TV or the Xcode simulator. You will build it using the Swift programming language.

Overview

This example plays a video returned from the Brightcove Playback API, which is the latest and recommended API to retrieve content from your Video Cloud library.

This example plays videos from an internal array of video files.

To use the Playback API, you will need a Policy Key. If you are not familiar with Policy Keys, see the Policy API Overview.

Get started

Follow the steps below to get familiar with setting up an app project that uses the Brightcove Player SDK for tvOS. You can view the complete code for each of the following:

  1. AppDelegate
  2. ViewController

There are two ways to try out this sample:

Download the sample

Download the entire Xcode project for experimentation.

  1. Clone or download the Native SDK for iOS samples to your local system.
  2. Navigate to the Player/AppleTV/swift sample app.
  3. Run the pod install command.
  4. Open and run the newly created workspace.

Build the app by following the steps in this guide

Follow the steps below to get familiar with setting up an app project that uses the Brightcove Player SDK for tvOS. You can view the complete code for each of the following:

  1. AppDelegate
  2. ViewController

Create the project

Set up a project in Xcode. Then add the SDK along with any dependencies to the project.

Set up the Xcode project

Create a new Xcode project for the app.

  1. Start the creation of a new tvOS project in Xcode. Select Create a new Xcode project.

    Create project
    Create project
  2. Choose a tvOS Single View Application for the template and select Next.

    Choose project template
    Choose project template
  3. Set the project information as follows:

    • Product Name: Simple-Video-Playback
    • Team: none

      The Team field is optional. If you want to distribute your app on the App Store, you will need to select a team that you belong to through the Apple Developer Program. The team name is required for code signing. In this example, we'll select none.

    • Organization Name: your company name
    • Organization Identifier: com.example-company
      This makes the product name unique for the app store.
    • Language: Swift
    Add project information
    Add project information
  4. Choose the location where you want to save your project and create it.

    Save the project
    Save the project
  5. Now close the project (yes, close it — this is important!)

Add the SDK and its dependencies to your project

The easiest way to add the SDK and its dependencies to your project is to use CocoaPods.

CocoaPods is a dependency manager that adds libraries to your project. It is not required, but makes installation easier. To install CocoaPods, see the instructions on the CocoaPods site.

  1. In your project folder, create a plain text file called Podfile (no file extension).

  2. Using a text editor, add the following lines of code to the Podfile and save it. This code does the following:

    • Line 67: Defines the GitHub source.
    • Line 69: Sets Pods to use frameworks instead of static libraries.
    • Line 71: Defines the tvOS platform version.
    • Lines 73-75: Install the current version of the Brightcove player SDK.
    source 'https://github.com/brightcove/BrightcoveSpecs.git'
    
    use_frameworks!
    
    platform :tvos, '10.0' # (or whatever version you want)
    
    target 'Simple-Video-Playback' do
    	pod 'Brightcove-Player-Core/dynamic'
    end
  3. Open a Terminal session and navigate to your Simple-Video-Playback Xcode project folder.

    Terminal session
    Terminal session
  4. In the Terminal session, type the command

    pod install

    and press Return to run the it. You should see a series of messages in the terminal indicating that the Brightcove Player SDK has been added to your project.

  5. Notice the last line, which is important — from this point on, you must open the Simple-Video-Playback.xcworkspace file in Xcode, not the Simple-Video-Playback.xcodeproj file. The pod install command creates this .xcworkspace file for your project.

Code the video app

Create the code for a simple video playback app.

Set the audio behavior for the app

The audio session handles audio behavior at the app level. Learn more about the AVAudioSession class.

You can choose from several audio session categories and settings to customize your app's audio behavior. Choose the best audio session category for your app.

For this sample, we will use AVAudioSessionCategoryPlayback. This plays audio even when the screen is locked and with the Ring/Silent switch set to silent. To keep it simple, we will put the code for this in the App Delegate.

  1. In your project, open the App Delegate file (AppDelegate.swift).

  2. In the didFinishLaunchingWithOptions function, add code to set the audio session category. Make sure you import the AVFoundation framework.

    //
    //  AppDelegate.swift
    //  Simple-Video-Playback
    //
    //  Copyright © 2017 Brightcove. All rights reserved.
    //
    
    import UIKit
    import AVFoundation
    
    @UIApplicationMain
    class AppDelegate: UIResponder, UIApplicationDelegate {
    
    		var window: UIWindow?;
    
    		func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    
    				// We need the below code in order to ensure that audio plays back when we
    				// expect it to. For example, without setting this code, we won't hear the video
    				// when the mute switch is on. For simplicity in the sample, we are going to
    				// put this in the app delegate.  Check out https://developer.apple.com/Library/ios/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/Introduction/Introduction.html
    				// for more information on how to use this in your own app.
    
            var categoryError :NSError?;
    				var success: Bool;
    				do {
    						try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback);
    						success = true;
    				} catch let error as NSError {
    						categoryError = error;
    						success = false;
    				}
    
    				if !success {
    						print("AppDelegate Debug - Error setting AVAudioSession category.  Because of this, there may be no sound. \(categoryError!)");
    				}
    
    				return true;
    		}
    
    		func applicationWillResignActive(application: UIApplication) {
    				// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    				// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    		}
    
    		func applicationDidEnterBackground(application: UIApplication) {
    				// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    				// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    		}
    
    		func applicationWillEnterForeground(application: UIApplication) {
    				// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
    		}
    
    		func applicationDidBecomeActive(application: UIApplication) {
    				// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    		}
    
    		func applicationWillTerminate(application: UIApplication) {
    				// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    		}
    }

Build the View Controller

Update the View Controller class to play a video from the Brightcove Playback API.

Update the View Controller class to play a video from a remote URL.

  1. In your project, open the View Controller file (ViewController.swift).

Include view-level services for media playback

The AVKit framework provides a high-level interface for video playback. You will need this framework to use the AVPlayerView class.

  1. Below the existing import directive, add the following to import the AVKit framework:

    	import AVKit
    	

Import the Native SDK

Although the Brightcove Native Player SDK for iOS is written in Obj-C, we can simply import the framework modules into our Swift project.

  1. Below the existing import directive, add the following to import the Brightcove Native Player SDK:

    	import BrightcovePlayerSDK
    	

Customize the project with your values

Add values to access your Video Cloud account.

  1. Below the import directives, add your own values for the following:

    • Line 12: Defines your Brightcove Playback API Policy Key. This example plays a video returned from the Brightcove Playback API, which is the latest and recommended API to retrieve content from your Video Cloud library. If you are not familiar with Policy Keys, see the Policy API Overview.

    • Line 13: Defines your Video Cloud Account ID
    • Line 14: Defines your Video Cloud Video ID
    let kViewControllerPlaybackServicePolicyKey = "BCpkADawqM1W-vUOMe6RSA3pA6Vw-VWUNn5rL0lzQabvrI63-VjS93gVUugDlmBpHIxP16X8TSe5LSKM415UHeMBmxl7pqcwVY_AZ4yKFwIpZPvXE34TpXEYYcmulxJQAOvHbv2dpfq-S_cm"
    let kViewControllerAccountID = "3636334163001"
    let kViewControllerVideoID = "3666678807001"

Set the playback controller delegate

This allows your app to listen and respond to video playback events.

  1. Update the View Controller class to include the Brightcove playback controller delegate.

    class ViewController: UIViewController, BCOVPlaybackControllerDelegate {

Declare constants

  1. In the ViewController class, add the following :

    • Line 17: Defines a constant, which initializes the Brightcove playback service with your Account ID and Policy Key.
    • Line 18: Defines a constant for the player view controller. Using this, the system makes its media content available for playback on an Apple TV and provides additional options for navigating the content. Using the AVPlayerViewController requires the AVKit framework. This is why you added this to the import directives in a previous step.
    • Line 19: Defines a constant for the Brightcove playback controller.

    import AVKit
    import BrightcovePlayerSDK
    
    let kViewControllerPlaybackServicePolicyKey = "BCpkADawqM1W-vUOMe6RSA3pA6Vw-VWUNn5rL0lzQabvrI63-VjS93gVUugDlmBpHIxP16X8TSe5LSKM415UHeMBmxl7pqcwVY_AZ4yKFwIpZPvXE34TpXEYYcmulxJQAOvHbv2dpfq-S_cm"
    let kViewControllerAccountID = "3636334163001"
    let kViewControllerVideoID = "3666678807001"
    
    class ViewController: UIViewController, BCOVPlaybackControllerDelegate {
        let playbackService = BCOVPlaybackService(accountId: kViewControllerAccountID, policyKey: kViewControllerPlaybackServicePolicyKey)
    		let avpvc = AVPlayerViewController()
    		let playbackController :BCOVPlaybackController
    		

Create an init function

  1. Create an initfunction as follows:
    • Lines 24-25: Initialize a shared manager and create the playback controller.
    • Line 29: Optional: Sends your Video Cloud Account ID to analytics. This is only needed if you override the BCOVVideo class or do not use the Brightcove Playback service or catalog.

    • Lines 31-33: Set the delegate and turn on the auto-advance and autoplay features.

    • Lines 37-39: Set the kBCOVAVPlayerViewControllerCompatibilityKey option to true to use the native AVPlayerViewController instead of the BCOVPlaybackSession's AVPlayerLayer. Without this code your video may not play back properly.

    required init?(coder aDecoder: NSCoder)
    {
    		let manager = BCOVPlayerSDKManager.shared()!
    		playbackController = manager.createPlaybackController()
    
    		super.init(coder: aDecoder)
    
    		playbackController.analytics.account = kViewControllerAccountID;
    
    		playbackController.delegate = self
    		playbackController.isAutoAdvance = true
    		playbackController.isAutoPlay = true
    
    		//Tell the playback controller that we're going to use the
    AVPlayerViewController.
    		//This lets the AVPlayerViewController supply the AVPlayerLayer for display
    instead of the BCOVPlaybackSession.
    		var mutableOptions = self.playbackController.options
    		mutableOptions?[kBCOVAVPlayerViewControllerCompatibilityKey] = true
    		self.playbackController.options = mutableOptions
    }

Configure the player

  1. In the viewDidLoad method add the following:

    • Lines 45-47: configure the playback controller's view.
    • Line 48-49: adds the player view as a subview of the main view.
    • Line 51: calls the requestContentFromPlaybackService function, which you will define in the next step.
    override func viewDidLoad() {
    		super.viewDidLoad()
    		// Do any additional setup after loading the view, typically from a nib.
        self.addChildViewController(self.avpvc);
    		self.avpvc.view.frame = self.view.bounds;
    		self.avpvc.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
    		self.view.addSubview(self.avpvc.view);
    		self.avpvc.didMove(toParentViewController: self)
    
    		requestContentFromPlaybackService()
    }

Request content from the Brightcove library

In order to play back video content, you will request a playlist from the catalog service

  1. Create a function named requestContentFromPlaybackService as follows:

    • Lines 55-56: return a video object from the Playback API based on the given video id.
    • Line 58: adds the video to the playback controller.
    • Line 60: writes an error message if a playlist is not returned.
    func requestContentFromPlaybackService() {
    		playbackService?.findVideo(withVideoID: kViewControllerVideoID, parameters: nil) {
    				(video: BCOVVideo?, dict: [AnyHashable:Any]?, error: Error?) in
    				if let v = video {
    						self.playbackController.setVideos([v] as NSFastEnumeration!)
    				} else {
    						print("ViewController Debug - Error retrieving video: %@", error!)
    				}
    		}
    }

The rest

  1. Create a function to handle when the playback session advances.

    func playbackController(_ controller: BCOVPlaybackController!, didAdvanceTo session: BCOVPlaybackSession!)
    {
    		NSLog("ViewController Debug - Advanced to new session.")
    		self.avpvc.player = session.player;
    }
  2. Optional: Log lifecycle events.

    func playbackController(_ controller: BCOVPlaybackController!, playbackSession session: BCOVPlaybackSession!, didReceive lifecycleEvent: BCOVPlaybackSessionLifecycleEvent!)
    {
    		NSLog("Event: %@", lifecycleEvent.eventType)
    }

View the code

The View Controller is now complete. Here is the full code:

//
//  ViewController.swift
//  Simple-Video-Playback
//
//  Created on 9/28/17.
//  Copyright © 2017 Brightcove. All rights reserved.

import UIKit
import AVKit
import BrightcovePlayerSDK

let kViewControllerPlaybackServicePolicyKey = "BCpkADawqM1W-vUOMe6RSA3pA6Vw-VWUNn5rL0lzQabvrI63-VjS93gVUugDlmBpHIxP16X8TSe5LSKM415UHeMBmxl7pqcwVY_AZ4yKFwIpZPvXE34TpXEYYcmulxJQAOvHbv2dpfq-S_cm"
let kViewControllerAccountID = "3636334163001"
let kViewControllerVideoID = "3666678807001"

class ViewController: UIViewController, BCOVPlaybackControllerDelegate {
		let playbackService = BCOVPlaybackService(accountId: kViewControllerAccountID, policyKey: kViewControllerPlaybackServicePolicyKey)
		let avpvc = AVPlayerViewController()
		let playbackController :BCOVPlaybackController


		required init?(coder aDecoder: NSCoder)
		{
				let manager = BCOVPlayerSDKManager.shared()!
				playbackController = manager.createPlaybackController()

				super.init(coder: aDecoder)

				playbackController.analytics.account = kViewControllerAccountID;

				playbackController.delegate = self
				playbackController.isAutoAdvance = true
				playbackController.isAutoPlay = true

				//use the AVPlayerViewController instead of the BCOVPlaybackSession class' AVPlayerLayer
				//this is needed if you want to test in the simulator
				var mutableOptions = self.playbackController.options
				mutableOptions?[kBCOVAVPlayerViewControllerCompatibilityKey] = true
				self.playbackController.options = mutableOptions
		}

		override func viewDidLoad() {
				super.viewDidLoad()
				// Do any additional setup after loading the view, typically from a nib.
				self.addChildViewController(self.avpvc);
				self.avpvc.view.frame = self.view.bounds;
				self.avpvc.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
				self.view.addSubview(self.avpvc.view);
				self.avpvc.didMove(toParentViewController: self)

				requestContentFromPlaybackService()
		}

		func requestContentFromPlaybackService() {
				playbackService?.findVideo(withVideoID: kViewControllerVideoID, parameters: nil) {
						(video: BCOVVideo?, dict: [AnyHashable:Any]?, error: Error?) in
						if let v = video {
								self.playbackController.setVideos([v] as NSFastEnumeration!)
						} else {
								print("ViewController Debug - Error retrieving video: %@", error!)
						}
				}
		}

		func playbackController(_ controller: BCOVPlaybackController!, didAdvanceTo session: BCOVPlaybackSession!)
		{
				NSLog("ViewController Debug - Advanced to new session.")
				self.avpvc.player = session.player;
		}

		func playbackController(_ controller: BCOVPlaybackController!, playbackSession session: BCOVPlaybackSession!, didReceive lifecycleEvent: BCOVPlaybackSessionLifecycleEvent!)
		{
				NSLog("Event: %@", lifecycleEvent.eventType)
		}

		override func didReceiveMemoryWarning() {
				super.didReceiveMemoryWarning()
				// Dispose of any resources that can be recreated.
		}

}

Include view-level services for media playback

The AVKit framework provides a high-level interface for video playback. You will need this framework to use the AVPlayerView class.

  1. Below the existing import directive, add the following to import the AVKit framework:

    	import AVKit
    	

Import the Native SDK

Although the Brightcove Native Player SDK for iOS is written in Obj-C, we can simply import the framework modules into our Swift project.

  1. Below the existing import directive, add the following to import the Brightcove Native Player SDK:

    	import BrightcovePlayerSDK
    	

Customize the project with your values

Define a variable with the value of your Account Id. This will be sent to Brightcove in a later step.

  1. Below the import directives, add your own value for your Brightcove Account Id.

    let kAccountID = "123456789" // for analytics

Set the playback controller delegate

This allows your app to listen and respond to video playback events.

  1. Update the View Controller class to include the Brightcove playback controller delegate.

    class ViewController: UIViewController, BCOVPlaybackControllerDelegate {

Declare constants

  1. In the ViewController class, add the following :

    • Line 15: defines a constant for the player view controller. Using this, the system makes its media content available for playback on an Apple TV and provides additional options for navigating the content. Using the AVPlayerViewController requires the AVKit framework. This is why you added this to the import directives in a previous step.
    • Line 16: defines a constant for the playback controller.
    import UIKit
    import AVKit
    import BrightcovePlayerSDK
    
    let kAccountID = "123456789" // for analytics
    
    class ViewController: UIViewController, BCOVPlaybackControllerDelegate {
        let avpvc = AVPlayerViewController();
    		let playbackController :BCOVPlaybackController;

Create an init function

  1. Create an initfunction as follows:
    • Lines 19-20: initializes a shared manager and creates the playback controller.
    • Line 25: Sends your Video Cloud Account ID to analytics.

       

    • Lines 27-29: set the delegate and turn on the auto-advance and autoplay features.

    • Lines 33-35: Set the kBCOVAVPlayerViewControllerCompatibilityKey option to true to use the native AVPlayerViewController instead of the BCOVPlaybackSession's AVPlayerLayer. Without this code your video may not play back properly.

    required init?(coder aDecoder: NSCoder)
    {
    		let manager = BCOVPlayerSDKManager.shared()!
    		playbackController = manager.createPlaybackController()
    
    		super.init(coder: aDecoder)
    
    		playbackController.analytics.account = kAccountID;
    
    		playbackController.delegate = self
    		playbackController.isAutoAdvance = true
    		playbackController.isAutoPlay = true
    
    		//Tell the playback controller that we're going to use the
    AVPlayerViewController.
    		//This lets the AVPlayerViewController supply the AVPlayerLayer for display
    instead of the BCOVPlaybackSession.
    		var mutableOptions = self.playbackController.options
    		mutableOptions?[kBCOVAVPlayerViewControllerCompatibilityKey] = true
    		self.playbackController.options = mutableOptions
    }

Configure the player

  1. In the viewDidLoad method add the following:

    • Lines 43-45: create an array of video sources using url paths.
    • Lines 47-49: configure the playback controller's view.
    • Lines 50-51: add the player view as a subview of the main view.
    • Line 53: adds the video array to the controller's playback queue, which is set for automatically start playing.
    override func viewDidLoad() {
    		super.viewDidLoad()
    		// Do any additional setup after loading the view, typically from a nib.
    
        // create an array of videos
    		var videoArray = [AnyObject]()
    		videoArray = [videoWithURL(url: NSURL(string: "http://learning-services-media.brightcove.com/videos/hls/laughing_gull/laughing_gull.m3u8")!),
    									videoWithURL(url: NSURL(string: "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8")!)]
    
    		self.addChildViewController(self.avpvc);
    		self.avpvc.view.frame = self.view.bounds;
    		self.avpvc.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
    		self.view.addSubview(self.avpvc.view);
    		self.avpvc.didMove(toParentViewController: self)
    
    		self.playbackController.setVideos(videoArray as NSFastEnumeration!);
    }

Set the delivery method for video sources

  1. Create a function that sets the delivery method for BCOVSources that belong to a video.

    func videoWithURL(url: NSURL) -> BCOVVideo {
    		// set the delivery method for BCOVSources that belong to a video
    		let source:BCOVSource = BCOVSource(url: url as URL!, deliveryMethod: kBCOVSourceDeliveryHLS, properties: nil)
    		let video = BCOVVideo.init(source: source, cuePoints: BCOVCuePointCollection.init(array: []), properties: [NSObject:AnyObject]())
    		return video!
    }

The rest

  1. Create a function to handle when the playback session advances.

    func playbackController(_ controller: BCOVPlaybackController!, playbackSession session: BCOVPlaybackSession!, didReceive lifecycleEvent: BCOVPlaybackSessionLifecycleEvent!) {
    		NSLog("Event: %@", lifecycleEvent.eventType);
    		self.avpvc.player = session.player;
    }
  2. Optional: Log lifecycle events.

    func playbackController(_ controller: BCOVPlaybackController!, playbackSession session: BCOVPlaybackSession!, didReceive lifecycleEvent: BCOVPlaybackSessionLifecycleEvent!) {
    		NSLog("Event: %@", lifecycleEvent.eventType);
    }

View the code

The View Controller is now complete. Here is the full code:

//
//  ViewController.swift
//  Simple-Video-Playback
//
//  Created on 9/28/17.
//  Copyright © 2017 Brightcove. All rights reserved.

import UIKit
import AVKit
import BrightcovePlayerSDK

let kAccountID = "123456789" // for analytics

class ViewController: UIViewController, BCOVPlaybackControllerDelegate {
		let avpvc = AVPlayerViewController();
		let playbackController :BCOVPlaybackController;

		required init?(coder aDecoder: NSCoder)
		{
				let manager = BCOVPlayerSDKManager.shared()!
				playbackController = manager.createPlaybackController()

				super.init(coder: aDecoder)

				playbackController.analytics.account = kAccountID;

				playbackController.delegate = self
				playbackController.isAutoAdvance = true
				playbackController.isAutoPlay = true

				//use the AVPlayerViewController instead of the BCOVPlaybackSession class' AVPlayerLayer
				//this is needed if you want to test in the simulator
				var mutableOptions = self.playbackController.options
				mutableOptions?[kBCOVAVPlayerViewControllerCompatibilityKey] = true
				self.playbackController.options = mutableOptions
		}

		override func viewDidLoad() {
				super.viewDidLoad()
				// Do any additional setup after loading the view, typically from a nib.

				// create an array of videos
				var videoArray = [AnyObject]()
				videoArray = [videoWithURL(url: NSURL(string: "http://learning-services-media.brightcove.com/videos/hls/laughing_gull/laughing_gull.m3u8")!),
											videoWithURL(url: NSURL(string: "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8")!)]

				self.addChildViewController(self.avpvc);
				self.avpvc.view.frame = self.view.bounds;
				self.avpvc.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
				self.view.addSubview(self.avpvc.view);
				self.avpvc.didMove(toParentViewController: self)

				self.playbackController.setVideos(videoArray as NSFastEnumeration!);
		}

		func videoWithURL(url: NSURL) -> BCOVVideo {
				// set the delivery method for BCOVSources that belong to a video
				let source:BCOVSource = BCOVSource(url: url as URL!, deliveryMethod: kBCOVSourceDeliveryHLS, properties: nil)
				let video = BCOVVideo.init(source: source, cuePoints: BCOVCuePointCollection.init(array: []), properties: [NSObject:AnyObject]())
				return video!
		}

		func playbackController(_ controller: BCOVPlaybackController!, playbackSession session: BCOVPlaybackSession!, didReceive lifecycleEvent: BCOVPlaybackSessionLifecycleEvent!) {
				NSLog("Event: %@", lifecycleEvent.eventType);
				self.avpvc.player = session.player;
		}

		override func didReceiveMemoryWarning() {
				super.didReceiveMemoryWarning()
				// Dispose of any resources that can be recreated.
		}

}

Manage Media Security

App Transport Security (ATS) enforces secure connections between your app and web services. With Apple's release of the iOS 9 SDK, a new feature called App Transport Security (ATS) was added.

  1. One of the following situations will apply to your app:

    • By default the Brightcove Native SDK for iOS uses a source selection policy to choose HTTPS over HTTP sources, so you can build your apps with ATS enabled.

      That's it, you are ready to run your app.


    • If you are using HTTP sources or have other HTTP calls in your app, you may encounter the following error message:

      									              App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure.
      									                  Temporary exceptions can be configured via your app's Info.plist file.

      This means that ATS is enabled, but your system is not configured to meet the ATS requirements. To fix this situation, see the Working with App Transport Security (ATS) document.

Run the app

The app is ready to build and run on an Apple TV or the Xcode Simulator. You should be able to play and navigate the specified video using the remote control.

Apple TV sample
Apple TV sample