AV Player with Nowtilus SSAI
Step by step integration of the Mediamelon Player SDK with Nowtilus SSAI with AV Player
Step 1: Get the MMGenericFramework Framework Library
Download the MMGenericFramework faremwork
Copy the MMGenericFramework framework to the AVPlayerWithNowtilusSSAI directory
If you are building for the simulator use the MMGenericFramework.framework in the iphonesimulator-x86 and which building for the device use the MMGenericFramework.framework in the iphoneos-arm64 directory
Step 2: Integrating the MMGeneric Framework with the AV Player Sample Application
There are a few steps involved for integrating the MediaMelon Player SDK using the MediaMelonSmartStreaming Framework:
Add the appropriate MMGenericFramework to the AV Player Sample Application
Add the AVPlayerIntegrationWrapper.swift file from the Wrapper directory
Provide Asset information
Add the MMSSAIAdManagerDelegate callbacks
Initializing SSAIAd Manager
Set Macro Substitution data
Stop the Ad Manager
1. Import Frameworks
2. Ad the AVPlayerIntegrationWrapper.swift file
This is the integration layer between the MediaMelon Framework and AV Player. This needs to be added to the project. Unless absolutely necessary , this file should not be modified.
3. Provide Asset information
4. Add the MMSSAIManagerDelegate
Add the MMSSAIManagerDelegate the ViewController class in ViewController.swift. This delegate will be used for receiving Ad related events and data. At every Ad event the Delegate will fire the notifyMMSSAIAdEventsWith function. This can be used to display Ad related data, enable or disable Ad skipping etc.
Ad Events Supported
adCueTimelineStart
Fired at the start of an Ad break
adImpression
Fired on Ad Impression
adStarted
Fired on start of Ad Play
adPlaying
Fired every 1s during Ad Playback
adFirstQuartile
Fired when Ad playback reached the 25% mark
adMidPoint
Fired when the Ad playback reaches the 50% mark
adThirdQuartile
Fired when Ad Playback reaches the 75% mark
adCompleted
Fired when Ad Playback reaches 95% mark
adCueTimelineEnd
Fired at the end of an Ad break
adSkipped
Fired when an Ad break is skipped
Sample output
5. Initialize the SSAI Ad Manager
Initialize the SSAI Ad Manager to track the Ads and report Ad related metric. For live stream the isLive is set to true. The below steps explains how to initialize SSAI Ad Manager without polling for vast. Incase of VOD, STEP 1 and STEP 2 are optional as we get the timeline data from source url. vodResponseData should contain the API response from the source URL.
Read the Manifest data from player API and retreive the Vast file from X-AD-VAST tag in the #EXT-X-DATERANGE metadata in the manifest file. To enable this mode there are a a few steps required
STEP 1: Enable Meta Data Collector
STEP 2: Sync player time with Manifest based time
STEP 3 Initialise the AD Manager
6. Set Macro Substitution Data for Tracking URLs
Provide the macro substitution data into a dictionary as shown below and send it to the AVPlayerIntegrationWrapper file.
7. Stop the SSAI Ad Manager
To stop the SSAI Ad Manager call the following API
List of AvPlayerIntegrationWrapper methods for SSAI
initialiseSSAIAdManager
Initializes the Nowtilus SSAI Ad Manager
setMetaDataCollector
Configiures the Meta Data collector and then returns meta data valuessyn
syncEpochTime
Syncs the player time with the time provided in the Manifest URL
stopSSAIManager
Stops the running instance of the SSAI Ad Manager
getAdPlaybackTime
Gets the playback time of the current ad playing ( Called during an Ad Break)
getAdDuration
Gets duration of the current Ad ( Called during an Ad Break)
getAdId
Gets the Ad Id value( Called during an Ad Break)
getAdTitle
Gets the Ad Title ( Called during an Ad Break)
getAdIndex
Returns in Index of the current ad playing in an Ad break. ( Called during an Ad Break)
getAdTotalAdsInPod
Gets the toal number of Ads inside an Ad Pod( Called during an Ad Break)
getAdServer
Gets the Ad Server Name ( Called during an Ad Break)
getAdDuration
Gets the duration of the events( Called during an Ad Break)
getAdPosition
Gets the position of the Ads . For live Ads this will return "MID"
Last updated