Skip to main contentIBM Video Streaming Developers

Development Process

Step 1: Create credentials for your mobile app

Log in to your account, navigate to the Dashboard and select “API/SDK access” under the “Integrations & Apps” menu.

Click on “Create new credentials” and provide a name for your application in the “Application name” field. Your credentials will be listed under the “API/SDK access” page based on this name.

Select iOS in the “Platform” drop-down. Enter the “bundle id” in its respective field.

After you completed all fields, hit “Save” to generate your SDK credentials. Make sure that the “bundle id” is introduced correctly, as you will have no possibility to update them later. If you accidentally saved wrong values, start the process from the beginning and create new credentials with the correct values.

Step 2: Download SDK package

After hitting “Save” in the “Create new credentials” step, you will see your credentials listed.

The created credentials entry will have a “Download iOS Player SDK” button at the bottom, click it to download the SDK package.

Step 3: Explore the SDK package

The provided zip archive contains the binary frameworks and a sample application.

Step 4: Create (or open) your project

Open the project that you would like to integrate the SDK in.

Step 5: Add the SDK to the project

Drag IBMVideoPlayerSDK.xcframework and IBMCoreSDK.xcframework into the Embedded Binaries section of your target.

Step 6: Register your app at IBM

The SDK requires the use of an IBM Player SDK key, which is validated whenever the SDK communicates with IBM’s streaming servers. The sample application contains a sample SDK key which you can use for testing. The sample SDK key can only be used to play content on the test channel(s) that are used in the sample app.

Note: Although there is a provided SDK key for the sample app’s sample content, you still need to register your identifier at IBM.

Before you can start using the Player SDK for playing content from your own channel(s), you will need to:

  • Get a valid IBM Player SDK key belonging to the Account that owns the content you would like to play.
  • Register the bundle identifier(s) of every app in which you will integrate the IBM Player SDK in.

The application identifier is typically structured as com.company.project.

Before you can create and use an instance of the player you must configure the lib with your IBM Player SDK key:

Objective-C
[USUstreamPlayer configureWithApiKey:<#place your SDK key here#>];
Swift
USUstreamPlayer.configure(withApiKey:<#place your SDK key here#>)

Step 7: Create a Player

USUstreamPlayer can be instantiated in the usual way. The created player object is a subclass of the USUstreamPlayer optimized for the targeted device (iPhone or iPad).

Objective-C
#import <IBMVideoPlayerSDK/IBMVideoPlayerSDK.h>
self.ustreamPlayer = [[USUstreamPlayer alloc] init];
self.ustreamPlayer.delegate = self;
self.ustreamPlayer.view.frame = self.view.bounds;
[self.view addSubview:self.ustreamPlayer.view];
Swift
import IBMVideoPlayerSDK
self.ustreamPlayer = USUstreamPlayer()
self.ustreamPlayer.delegate = self
self.ustreamPlayer.view.frame = self.view.bounds
self.view.addSubview(self.ustreamPlayer.view)

Step 8: Play live or recorded content

By now you have configured your player and it is ready to stream video content through IBM’s services.

USUstreamPlayer can play different kinds of media:

  • Live streams
  • Recorded videos

For example, to watch the live video playing on your channel:

Objective-C
self.mediaDescriptor = [USMediaDescriptor channelDescriptorWithID:<#place your channel ID here#>];
[self.ustreamPlayer playMedia:self.mediaDescriptor];
Swift
self.mediaDescriptor = USMediaDescriptor.channelDescriptor(withID:<#place your channel ID here#>)
self.ustreamPlayer.playMedia(self.mediaDescriptor)

Step 9: Handle Player callbacks

Content owners can control access to their media using various “locks” that implement password protection, age restriction and other protections. Streaming servers reject clients trying to connect whenever lock conditions are not met. The SDK calls the appropriate callback function to indicate this to the application.

Generic callbacks

USUstreamPlayer reports its state changes using the USPlayerDelegate protocol. Some callbacks may also require user interaction in case the servers notify the Player about content restrictions. For example, when “lock” conditions are not met.

In order to receive these callbacks, you need to define a handler conforming to protocol USPlayerDelegate and set it as a delegate of your player instance.

Objective-C
self.ustreamPlayer.delegate = self;
Swift
self.ustreamPlayer.delegate = self

Player state is changed

The player instance reports its state changes so that application states can be updated accordingly. For example, your app can change the layout of the player screen depending on whether playback is in progress.

The most important callback indicating such change is the playerStateDidChange:, which reports the state of the Player. The states are listed in the USPlayerState enum.

Interactive callbacks

Callbacks listed below are “interactive”, this means they can be used to reconnect for playback after some kind of user input.

Password lock

When the Player sends the callback: playerRequiresPassword: it waits for a password belonging to the locked content. You can provide the password using continueWithPassword: When you provide the password, the server validates it and starts playing the content if the password is valid. Otherwise it calls back again with playerRequiresPassword:.

Age lock (deprecated)

When the Player sends either callback playerRequiresAgeConfirmation:ageRequired: or playerRequiresBirthdate: you need to ask the user’s birth date without hints to the required age. If the user-specified age is not less than the required age, you can continue the playback with continueWithAgeConfirmed.

Hash lock (deprecated)

A deprecated custom viewer authentication flow. Use [Viewer auth] instead.

Viewer auth

Implementing custom viewer authentication flow is possible using the Viewer Authentication API. If the channel or video is set up with custom viewer authentication, the player sends the callback playerRequiresViewerAuthToken:fromURL: where the application should present the custom authentication flow for the user. For more information on implementing the flow please refer to the Viewer Authentication API documentation. Once the authentication flow is finished, USUstreamPlayer continueWithViewerAuthToken: should be called with the resulting token object of the authentication flow. If the provided token object is validated the player gains access to the restricted resource and starts playing it back.