C++ Based Player SDK(Nowtilus SSAI)
Step by step integration of the Mediamelon Player SDK with Nowtilus SSAI for C++ based Player
Step1: Fetching Media Data
If type of the stream is live fetch the media URL and vast URL through an API call. If type of the stream is VoD fetch the media data in the form of JSON which also contains the ad data.
Step2: Initialise SSAI Ad Manager
After the fetching the media data, initialise the SSAI Ad Manager by sending the media data into it. Please refer to the below code for initialisation:
Step3: Send Playhead Position to the Ad Manager
For SDK to detect the ads and fire callbacks for ad events, absolute playhead position should be shared to the MediaMelon SDK. This position value should be shared through reportPlaybackPosition
function call. The position value should be different for live and VoD streams as mentioned below:
Live Stream: Pass the absolute playhead position of the player in the unix timestamp format in milliseconds.
VoD Stream: Pass the absolute playhead position of the player in milliseconds.
Step4: Listen for the Ad Callbacks
When the SSAI Ad Manger detects an ad, a series of ad callbacks will be fired and those callbacks can be listened as shown in the below code snippet.
Handling Trick Play Scenarios:
The callback associated with the onAdCueTimelineEnter
can be employed to signal the video player to disable the seek bar, thereby preventing the ad from being skipped. Correspondingly, upon conclusion of the ad break, the video player will receiveonAdCueTimelineExit
, prompting the enable of the seek bar.
Step5: Ad Playback Error
When an ad playback error occurs, call the function named signalAdPlaybackError()
from the sample application. Calling this function will trigger the onAdError callback which contains the ad data.
Step6: Stop SSAI Ad Manager
To stop the SSAI Ad Manager, call the function named stopSSAIAdManager()
from the sample application. Calling this function will stop the manifest and vast network calls as well.
mediaUrl
String containing the media URL.
vastUrl
String containing the vast URL for live streams. For VoD, it should be an empty string.
isLive
A boolean variable. It should be true for live streams and false for VoD streams.
json_VOD_response
VoD stream curl response in JSON format. It should be Empty JSON object for live streams.
playheadPosition
int64 value containing absolute playhead position of the stream playing.
Last updated