Pulse Plugin for Brightcove Player SDK provides a dynamic library framework for installation.
The Pulse plugin supports INVIDI Technologies Pulse SDK version 2.6.21.6.0 for iOS and version 2.6.21.6.0 for tvOS, Pulse iOS and tvOS SDK Reference. The Podspec for the Pulse Plugin for Brightcove Player SDK references Pulse SDK Release History.
You can use CocoaPods to add the Pulse Plugin for Brightcove Player SDK to your project. You can find the latest Brightcove-Player-Pulse
podspec here. The PulseSDK needs to be added to your project, download the latest version here.
source 'https://github.com/CocoaPods/Specs'
source 'https://github.com/brightcove/BrightcoveSpecs.git'
platform :ios, '12.0'
use_frameworks!
target 'MyApp' do
pod 'Brightcove-Player-Pulse'
end
XCFramework can be installed by appending the /XCFramework
subspec in the pod name.
source 'https://github.com/CocoaPods/Specs'
source 'https://github.com/brightcove/BrightcoveSpecs.git'
platform :ios, '12.0'
use_frameworks!
target 'MyApp' do
pod 'Brightcove-Player-Pulse/XCFramework'
end
To add the Pulse Plugin for Brightcove Player SDK to your project manually:
- Download the latest zipped Brightcove Player SDK framework from the releases page.
- Download the latest zip'ed release of the BrightcovePulse plugin from our release page.
- Download the PulseSDK.
- On the "General" tab of your application target, add the dynamic framework,
BrightcovePlayerSDK.framework
orBrightcovePlayerSDK.xcframework
, from the Brightcove Player SDK download to the list of Frameworks, Libraries, and Embedded Content. The universal Framework and XCFramework are found in the ios/dynamic directory of the download. The Embed setting must be "Embed & Sign". - On the "General" tab of your application target, add
BrightcovePulse.framework
orBrightcovePulse.xcframework
from the Pulse Plugin for Brightcove Player SDK download to the list of Frameworks, Libraries, and Embedded Content. The Embed setting must be "Embed & Sign". - On the "General" tab of your application target, add
PulseSDK.xcframework
andOMSDK_Invidi.xcframework
from the INVIDI Technologies download to the list of Frameworks, Libraries, and Embedded Content. The Embed setting for the XCFrameworks must be "Embed & Sign". - On the "Build Settings" tab of your application target, ensure that the "Framework Search Paths" include the paths to the frameworks. This should have been done automatically unless the framework is stored under a different root directory than your project.
- (Universal Framework only) On the "Build Phases" tab, add a "Run Script" phase with the command
bash ${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/BrightcovePulse.framework/strip-frameworks.sh
. Check "Run script only when installing". This will remove unneeded architectures from the build, which is important for App Store submission. - On the "Build Settings" tab of your application target:
- Ensure that
-ObjC
has been added to the "Other Linker Flags" build setting.
- Ensure that
- (Apple Silicon with Universal Framework only) On the "Build Settings" tab of your application target:
- Ensure that
arm64
has been added to your "Excluded Architectures" build setting forAny iOS Simulator SDK
.
- Ensure that
To add the Pulse Plugin for Brightcove Player SDK to your project with Swift Package Manager:
- First follow the steps to add the Core XCFramework with Swift Package Mananger.
- Add the Pulse package to Swift Package Manager using
https://github.com/brightcove/brightcove-player-sdk-ios-pulse.git
. - Download the PulseSDK.
- On the "General" tab of your application target, add
PulseSDK.xcframework
andOMSDK_Invidi.xcframework
from the INVIDI Technologies download to the list of Frameworks, Libraries, and Embedded Content. The Embed setting for the XCFrameworks must be "Embed & Sign". - On the "Build Settings" tab of your application target, ensure that the "Framework Search Paths" include the paths to the frameworks. This should have been done automatically unless the framework is stored under a different root directory than your project.
The Pulse Plugin for Brightcove Player SDK can be imported using:
import BrightcovePulse
The BrightcovePulse plugin is a bridge between PulseSDK and the Brightcove Player SDK for iOS. This snippet shows its basic usage with Server Side Ad Rules.
[1] let contentMetadata = OOContentMetadata()
contentMetadata.category = "<category>"
contentMetadata.tags = ["<tag1>", "<tag2>"]
contentMetadata.flags = ["<flag1>", "<flag2>"]
let requestSettings = OORequestSettings()
requestSettings.linearPlaybackPositions = [30, 60]
let pulseHose = "<pulse domain>"
[2] let pulseOptions: [String:Any] = [
kBCOVPulseOptionPulsePlaybackSessionDelegateKey: self,
kBCOVPulseOptionPulsePersistentIdKey: NSUUID().uuidString
]
let sdkManager = BCOVPlayerSDKManager.sharedManager()
[3] let playbackController = sdkManager.createPulsePlaybackController(withPulseHost: pulseHose,
contentMetadata: contentMetadata,
requestSettings: requestSettings,
adContainer: playerView.contentOverlayView,
companionSlots: nil,
viewStrategy: nil,
options: pulseOptions)
guard let playbackController else {
return
}
playbackController.delegate = self
videoView.addSubview(playerView)
let policyKey = "<your-policy-key>"
let accountID = "<your-account-id>"
let videoID = "<your-video-id>"
let playbackService = BCOVPlaybackService(withAccountId: accountID,
policyKey: policyKey)
let configuration = [
BCOVPlaybackService.ConfigurationKeyAssetID: videoID
]
playbackService.findVideo(withConfiguration: configuration,
queryParameters: nil) { (video: BCOVVideo?,
jsonResponse: Any?,
error: Error?) in
if let video {
playbackController.setVideos([video])
playbackController.play()
}
}
Breaking the code down into steps:
- Create the same OOContentMetadata, OORequestSettings that you would create if you were using INVIDI Technologies's Pulse iOS SDK directly. The Pulse Plugin requires a valid domain and an UIView container to display the ads.
- Optionally, the plugin can receive a NSDictionary with properties to be used in the plugin. The available keys are
kBCOVPulseOptionPulsePlaybackSessionDelegateKey
,kBCOVPulseOptionPulseDeviceContainerKey
andkBCOVPulseOptionPulsePersistentIdKey
. To override the Pulse Session, the PulsePlaybackSessionDelegate needs to be implemented, passing thekBCOVPulseOptionPulsePlaybackSessionDelegateKey
with the class that implements the method. - BrightcovePulse adds some category methods to BCOVPlaybackManager. The first of these is
-createPulsePlaybackControllerWithPulseHost:contentMetadata:requestSettings:adContainer:companionSlots:viewStrategy:options:
. Use this method to create your playback controller.
The Brightcove Pulse Plugin implements custom play and pause logic to ensure the smoothest possible ad experience. Therefore, you will need to make sure that you use the play method on the BCOVPlaybackController
or the -[BCOVSessionProviderExtension pulse_play]
or -[BCOVSessionProviderExtension pulse_pause]
(BCOVSessionProviderExtension), and not the AVPlayer.
As an example, calling play for the first time on BCOVPlaybackController
allows BCOVPulse to process preroll ads without any of the content playing before the preroll. For more information on how BCOVPulse overrides the default BCOVPlaybackController
methods, please check out BCOVSessionProviderExtension.
There are a couple of configuration points in BCOVPulse. You can combine BCOVPulse with another plugin for the Brightcove Player SDK for iOS, you can create a custom view strategy, and you can override the current ads request.
The BCOVPulsePlaybackSessionDelegate
protocol provides a way for the BrightcovePulse plugin to communicate with the host application. This delegate allows you to override the content metadata and request settings before the session starts.
The UIViewController
needs to adopt the BCOVPulsePlaybackSessionDelegate
protocol.
class ViewController: UIViewController, BCOVPulsePlaybackSessionDelegate
Create a NSDictionary passing the kBCOVPulseOptionPulsePlaybackSessionDelegateKey
with the class that will implement the method to override the session.
let pulseOptions = [
kBCOVPulseOptionPulsePlaybackSessionDelegateKey: self
]
Create a BCOVPlaybackSessionProvider
or BCOVPlaybackController
for Pulse using the methods in BCOVPlaybackManager
, remember to pass the dictionary created in the previous step. This example uses a playback controller.
let sdkManager = BCOVPlayerSDKManager.sharedManager()
let playbackController = sdkManager.createPulsePlaybackController(withPulseHost: pulseHose,
contentMetadata: OOContentMetadata(),
requestSettings: OORequestSettings(),
adContainer: playerView.contentOverlayView,
companionSlots: nil,
viewStrategy: nil,
options: pulseOptions)
The createSessionForVideo:withPulseHost:contentMetadata:requestSettings:
method provides the current video, host domain, content metadata and request settings for the session. In this example, the previous objects were empty and will be overriden with a new OOContentMetadata
and OORequestSettings
array.
func createSession(for video: BCOVVideo,
withPulseHost pulseHost: String,
contentMetadata: OOContentMetadata,
requestSettings: OORequestSettings) -> OOPulseSession {
// Override the content metadata.
contentMetadata.category = "new_category_for_midrolls"
// Override the request settings.
requestSettings.linearPlaybackPositions = [15]
return OOPulse.session(with: contentMetadata, requestSettings: requestSettings)
}
If you are using more than one plugin to the Brightcove Player SDK for iOS that needs to create a customized playback controller, you must instead compose a chain of session providers and pass the final session provider to the sdkManager.createPlaybackController(withSessionProvider:viewStrategy:)
method.
When composing session providers, the session preloading can be enabled from BCOVBasicSessionProvider
.
If you'd like to display your own Ad UI during ad playback you can use the playbackController:playbackSession:didEnterAd:
and playbackController:playbackSession:didExitAdSequence:
delegate methods. Here is an example:
// MARK: BCOVPlaybackControllerDelegate
func playbackController(_ controller: BCOVPlaybackController,
playbackSession session: BCOVPlaybackSession,
didEnter ad: BCOVAd) {
displayAdUI(withAdDuration: CMTimeGetSeconds(ad.duration))
}
func playbackController(_ controller: BCOVPlaybackController,
playbackSession session: BCOVPlaybackSession,
didExitAdSequence adSequence: BCOVAdSequence) {
hideAdUI()
}
The Brightcove Pulse plugin does not currently support Picture-in-Picture. Attempting to use Picture-in-Picture functionality with the Pulse plugin will result in unexpected behavior.
This usually happens when the ad container view is not in the view hierarchy, or when the ad view (which is a subview of the ad container view) is covered by other views.
If you have questions, need help or want to provide feedback, please use the Support Portal or contact your Account Manager. To receive notification of new SDK software releases, subscribe to the Brightcove Native Player SDKs Google Group.