The Brightcove Native SDK for iOS/tvOS provides a variety of sample apps to help you get started with your own implementations. For a complete list of samples, see the following:
If you are new to the Brightcove Native SDKs, check out the Getting Started with the Native SDKs videos.
You will need the following tools installed on your computer to run the sample apps:.
Xcode 8.0 or laterXcode is an integrated development environment (IDE) used to create software for macOS, iOS, watchOS and tvOS.
CocoaPods 1.0 or later
CocoaPods is a dependency manager used to add the Brightcove SDK framework along with other needed libraries. You can add libraries to your project manually, but CocoaPods makes it easier.
In the player samples for iOS/tvOS repository, you will find samples for the following platforms:
iOS - A mobile operating system for Apple devices, including iPhone, iPad and iPod
tvOS - An operating system for Apple TV
The samples are written in the following languages:
Objective-CObjective-C is a superset of the C programming language and provides object-oriented capabilities and a dynamic runtime. So, it adds syntax for defining classes and methods.
Adding library dependencies
The iOS/tvOS sample apps support the latest version of the Brightcove Native SDK and plugins.
To add the core Brightcove SDK along with other library dependencies, follow these steps:
- If you don't already have CocoaPods, download and install the latest version.
- Clone or download the Player samples for iOS/tvOS to your computer.
- On your computer, e the local sample folder that you are interested in. For this example, we will use the Objective-C version of the VideoCloudBasicPlayer sample.
- In a text editor, open the VideoCloudBasicPlayer/objc/Podfile file. Notice that there is no file extension.
- In the Podfile, you can leave the iOS platform version, or you can change it to the version you want to target in your app.
Open the project folder in the Terminal app. In the Terminal session, run the
pod installcommand. If you notice that the SDK version is less than the current version, you can run the
pod updatecommand to fetch the latest version.
- In the project folder, you should now see a .xcworkspace file. This is the file you will open in Xcode.
Running the sample apps
The sample apps can be run using the following:
- Xcode simulator
Xcode using a physical device connected to your computer
- The device must have iOS version 9.0 or later
- On your device, make sure USB debugging is enabled
To run a sample app, follow these steps:
- If you are new to Xcode, review the Apple developer documentation.
- In Xcode, open the VideoCloudBasicPlayer.xcworkspace file.
- Open the ViewController.m file. You can run the app with the provided values, or you can replace them with your own values. In this sample, you can replace the values for your Video Cloud account ID, video ID and policy key.
- In the toolbar's active scheme menu, VideoCloudBasicPlayer project should be selected.
- Expand the run destination dropdown. If you have a device connected to your computer, you should see it listed here. Select your device or a simulator version.
- Select the Run button.
- You should see the app running on your device or in the simulator.
Xcode provides debugging tools that allow you to set breakpoints, examine variables and evaluate expressions at runtime. To debug your app, do the following:
- In Xcode, locate the line of code where you would like to pause execution.
- In the left gutter for the line of code, click to add a breakpoint. Double click to edit a breakpoint. Right clicking on the breakpoint gives you options including deleting a breakpoint.
- Select the Run button to start execution.
When execution pauses at your breakpoint, you will have several options to inspect variables and expressions, as well as stepping through/over/into lines of code.