Configure your application to use the Wowza Flowplayer Apple SDK

This page describes how to configure your iOS or tvOS application so you can work with the Wowza Flowplayer Apple SDK, its API, and the integrated player.

Set an access token

The Info.plist file contains information about the configuration for your iOS or tvOS application. To allow the player to display content in your application, you must update your target's Info.plist file.

You can add the token value in Xcode, as mentioned here. For information about getting an access token, see Create or revoke a player token in Wowza Video.

  1. In the Project Navigator for your Xcode project, click the Info.plist file.
  2. Click the + icon to add a Key property to the Information Property List.
  3. Add the new FPAccessToken property, set it to a string type, and enter the token in the Value column.
Xcode update info.plist token value
You can also accomplish the same task by setting the Flowplayer.current.accessToken in the AppDelegate.swift file before initializing the SDK. For more, see Configure the SDK.

Configure the SDK

To function smoothly and avoid unwanted errors or crashes, you must configure the Wowza Flowplayer Apple SDK during app startup. This step enables users to load the SDK and edit its configuration options according to their specific requirements.

important

It's important to call the configuration method before using any other API from the SDK. By doing so, you ensure the SDK is correctly initialized and ready to handle subsequent API calls.

As in the following example, you can configure the SDK using the AppDelegate.swift file:

Copy
Copied
// AppDelegate.swift
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

  Flowplayer.current.accessToken = /* Set the accessToken programmatically */
  Flowplayer.current.config = /* Add your desired configuration options here */
  Flowplayer.current.configure()

  return true
}

Configuration option are outlined in the following table.

Configuration propertyDescription
loggerEnabledIndicates if logging is enabled (default) or disabled for the SDK. Set to false to disable logging.
loggerLevels: [LogLevel]Defines the logger levels to be used when logging SDK events. Includes info, error, and warning by default.

Configure your audio session

To enable AVPlayer to play audio on physical devices, you must use the AVAudioSession object to configure your application's audio session. This should be done before starting any video or audio playback. When retrieving a shared audio session, set it to the .playback category, as shown in the following example:
Copy
Copied
try! AVAudioSession.sharedInstance().setCategory(.playback)
With this category, activating the session interrupts any other audio on the device when the player starts. See additional information about the playback property from Apple.