Bitmovin IOS v2.66(Nowtilus SSAI) with Content Provider Metrics
This page describes the integration of the MediaMelon Player SDK ( that supports Content Provide Metrics reporting ) with the Bitmovin Player v2.66 on the IOS platform.
Integrating the MediaMelonSmartStreaming Framework
There are five steps involved for integrating the MediaMelon Player SDK using the MediaMelonSmartStreaming Framework:
Importing the framework
Providing asset information for the content before starting the player and after creating its instance
Cleaning up the SDK integration session
Disable manifest fetching by the SDK
Initializing SSAI
Open the project file ~/sampleintegration/SampleBitmovinPlayer_v2.66_SSAI_MMSDK_v<SDK Version>/BasicPlayback.workspace
in XCode and edit the file ViewController.swift
as mentioned below
1. Import Frameworks
import BitmovinPlayer
import MMGenericFramework
2. Provide Asset information
private func configureMMSDK(mediaURL: String, vastURL: String) {
let assetInfo = MMAssetInformation(assetURL: mediaURL, assetID: "RandomID", assetName: "Test Asset", videoId: "123456789")
assetInfo.setContentType("Movie") //Type of content (Movie / Special / Clip / Scene)
assetInfo.setDrmProtection("Fairplay") //Widevine, Fairplay, Playready etc. Unknown means content is protected, but protection type is unknown. For clear contents, do not set this field
assetInfo.setEpisodeNumber("testEpisode") //Sequence Number of the Episode (string).
assetInfo.setSeriesTitle("testSeries") //Title of the series
assetInfo.setSeason("testSeason") //Season For example - Season1,2,3 etc
assetInfo.setGenre("testGenre") //Genre of the content
// Optional custom metadata
assetInfo.addCustomKVP("CustomKVP1Key", "CustomKVP1Value")
assetInfo.addCustomKVP("CustomKVP2Key", "CustomKVP2Value")
assetInfo.setQBRMode(.QBRModeDisabled, withMetaURL: nil)
let resgistrato = MMRegistrationInformation(customerID: "200417809", playerName: "BitmovinPlayerTesting")
BitmovinPlayerIntegrationWrapper.setPlayerRegistrationInformation(registrationInformation: resgistrato, player: player)
BitmovinPlayerIntegrationWrapper.initializeAssetForPlayer(assetInfo: assetInfo, registrationInformation: resgistrato, player: player)
}
3. Cleaning up the SDK Session
BitmovinPlayerIntegrationWrapper.cleanUp()
5. Disable manifest fetching by the SDK
If your workflow restricts the manifest to be accessible from both player and the MediaMelon Player SDK simultaneously, then, you can disable the fetch of manifest via disableManifestsFetch()
in method _configureMMSDKwithURL()
private func configureMMSDKWithURL(mediaURL: String, vastURL: String) {
.
.
.
BitmovinPlayerIntegrationWrapper.cleanUp()
BitmovinPlayerIntegrationWrapper.disableManifestsFetch(disable: true)
BitmovinPlayerIntegrationWrapper.initializeAssetForPlayer(assetInfo: assetInfo, registrationInformation: registrationInfo, player: player)
}
5. Add the SSAIManagerDelegate
Add the SSAIManagerDelegate to the ViewController class in ViewController.swift
class ViewController: UIViewController, SSAIManagerDelegate
6. Initialize the SSAI Ad Manager
Initialize the SSAI Ad Manager to track the Ads and report Ad related metrics
private func configureMMSDK(mediaURL: String, vastURL: String) {
.
.
.
BitmovinPlayerIntegrationWrapper.shared.initialiseSSAIAdManager(mediaUrl: mediaURL, vastUrl: vastURL, isLive: true)
}
7. Create a new session and update the asset information
During playback updateAssetInfo can be used to create a new session and update the asset information. The usage can be seen in the updateAsset function in the ViewController
func updateAsset() {
let assetInfo = MMAssetInformation(assetURL: mediaURL, assetID: "RandomID", assetName: "Test Asset", videoId: "123456789")
assetInfo.setContentType("Movie") //Type of content (Movie / Special / Clip / Scene)
assetInfo.setDrmProtection("Fairplay") //Widevine, Fairplay, Playready etc. Unknown means content is protected, but protection type is unknown. For clear contents, do not set this field
assetInfo.setEpisodeNumber("testEpisode") //Sequence Number of the Episode (string).
assetInfo.setSeriesTitle("testSeries") //Title of the series
assetInfo.setSeason("testSeason") //Season For example - Season1,2,3 etc
assetInfo.setGenre("testGenre") //Genre of the content
assetInfo.addCustomKVP("CustomKVP1Key", "CustomKVPalue")
assetInfo.addCustomKVP("CustomKVP2Key", "CustomKVPValue")
assetInfo.setQBRMode(.QBRModeDisabled, withMetaURL: nil)
// Create a new session and update the Asset info
BitmovinPlayerIntegrationWrapper.updateAssetInfo(assetInfo: assetInfo, player: player)
}
8. Getting the mediaURL and vastURL from the Session Resolver URL
The session resolver URL as provided by Nowtilus redirects to another resolved URL from which the mediaURL and vastURL required for initializing the Media Melon SDK is obtained. Information about the resolved URL is obtained in the onDownloadFinished event handler for Bitmovin Player. The code below shows how this is done.
func onDownloadFinished(_ event: DownloadFinishedEvent) {
var redirectedMediaURL: String?
if let redirectionLocation = event.lastRedirectLocation {
redirectedMediaURL = redirectionLocation.absoluteString
let tempUrl = redirectedMediaURL?.replacingOccurrences(of: "master.m3u8?sid=", with: "")
if let urlArr = tempUrl?.components(separatedBy: "&"), urlArr.count > 0 {
let vastUrl = urlArr[0] + "/vast.xml"
enableSSAI = true
if !isMMInitialised {
derivedMediaURL = redirectedMediaURL!
self.configureMMSDK(mediaURL: redirectedMediaURL!, vastURL: vastUrl)
isMMInitialised = true
}
}
}
// In case no URL redirection has happened
if redirectedMediaURL == nil {
enableSSAI = false
derivedURL = event.url.absoluteString
redirectedMediaURL = event.url.absoluteString
if !isMMInitialised {
self.configureMMSDK(mediaURL: redirectedMediaURL!, vastURL: "")
isMMInitialised = true
}
}
}
9 Enabling Content Provider Metrics
Content Provider Metric Reporting is enabled by calling the setContentProviderDetails function defined in the BitmovinPlayerIntegrationWrapper.swift. This needs to be done immediately adter the call to configure the Media Melon SDK
self.configureMMSDK(mediaURL: redirectedMediaURL!, vastURL: vastUrl)
BitmovinPlayerIntegrationWrapper.setContentProviderDetails(url:redirectedMediaURL!)
The setContentProviderDetails expects the URL with the Content Provider information as shown in the table below. In case the information is correctly provided it enables content provider metrics reporting.
provider
stzp : Starz tbox: Toolbox
tbtoken
JWT Token for Toolbox endpoint
cid
Content ID
sid
Starz session ID
For enablling Toolbox metrics please pass - provider, tbtoken and cid values as shown below
For enabling Starz content provider metrics please pass: provider, cid and sid values as shown below
Last updated
Was this helpful?