Introduction
Brightcove's Player Enhancements for Live SSAI allows you to improve the ad breaks in live streams with ad counts, ad countdown timers, click through ads and companion ads. These live streams can be played using the Brightcove Native SDKs.
Companion slots and click-through behavior depend on the device platform and on the ad UI your app provides. Connected TV platforms do not all offer the browser-based click-through experience available on mobile, so test the features your target device supports.
If you are new to this feature, see the following:
Player Enhancements for Live SSAI requires a Native SDK version that plays NextGen Live SSAI streams:
- Native SDK for Android 10.4.11 or later (latest release recommended)
- Native SDK for iOS/tvOS 7.2.18 or later (latest release recommended)
Steps
To play live streams with an enhanced player using the Brightcove Native SDKs, follow these steps:
- Follow the workflow in the Implementing Player Enhancements for Live SSAI document, up through creating your playback token.
-
Build your app:
- Continue with the workflow in the Implementing Player Enhancements for Live SSAI document.
Android implementation
You will need the following values to build your app using the Native SDK for Android:
- Playback token
- Account Id
- Video Id
- Policy Key
To get your Policy Key, review the Policy Keys document.
Follow these steps to build your app:
- Use the Basic SSAI Sample App as a starting point for your code.
- In the res/values/strings.xml file, replace the following with your own values:
- Account Id
- Video Id
- Policy Key
-
In the MainActivity.java file, replace the
livePlaybackTokenvalue with your playback token.private final String LIVE_PLAYBACK_TOKEN = "your playback token"; -
The
livePlaybackTokenwith your playback token value is added to the HTTP request as a query parameter.HttpRequestConfig httpRequestConfig = new HttpRequestConfig.Builder() .addQueryParameter("livePlaybackToken", LIVE_PLAYBACK_TOKEN) .build(); -
Make the catalog call to the Playback API with your live stream video id and the updated HTTP request.
catalog.findVideoByID(getString(R.string.video_id), httpRequestConfig, new VideoListener() { @Override public void onVideo(Video video) { plugin.processVideo(video); } }); - Your player is ready to play your live stream.
iOS implementation
You will need the following values to build your app using the Native SDK for iOS:
- Playback token
- Account Id
- Video Id
- Policy Key
To get your Policy Key, review the Policy Keys document.
Follow these steps to build your app:
- Use the Basic SSAI Player sample as a starting point for your code.
- In the ViewController.swift file, replace the following with your own values:
- Account Id
- Video Id
- Policy Key
-
Replace the
LivePlaybackTokenvalue with your playback token.static let LivePlaybackToken = "your playback token" -
The
livePlaybackTokenwith your playback token value is added as a query parameter.let queryParameters = [BCOVPlaybackService.ParameterKeyLivePlaybackToken: Constants.LivePlaybackToken] -
Make the catalog call to the Playback API with your live stream video id and the query parameter.
let configuration = [BCOVPlaybackService.ConfigurationKeyAssetID: Constants.VideoId] playbackService.findVideo(withConfiguration: configuration, queryParameters: queryParameters) { [weak self] (video: BCOVVideo?, jsonResponse: Any?, error: Error?) -> Void in guard let _video = video else { print("ViewController Debug - Error retrieving video: \(error?.localizedDescription ?? "unknown error")") return } self?.playbackController?.setVideos([_video]) } - Your player is ready to play your live stream.