THEOPlayer tvOS XCFramework

Step 1: Integrating the MMTHEOPlayerTVOSFramework

There are four steps involved for integrating the SmartSight Player SDK

  1. Importing the framework

  2. Providing asset information for the content before starting the player and after creating its instance

  3. Cleaning up the SDK integration session

  4. Disable manifest-fetching by the SDK

1. Import Frameworks

import THEOplayerSDK
//Integration Step 1
import MMTHEOPlayerTVOSFramework

2. Provide asset information

2a) Add the following method to integrate the MediaMelon Player SDK to the class ViewController

 class ViewController: UIViewController {
    var theoplayer: THEOplayer!
    var assetInfo:MMAssetInformation!
    var configInfo:IntegrationConfiguration!
    //Integration step 2a
    func integrateMMSDK(){
        if configInfo.enableLogs{
            TheoPlayerIntegrationWrapper.shared.enableLogTrace(logStTrace: true)
            TheoPlayerIntegrationWrapper.shared.enableLogTrace(logStTrace: false)
        let regInfo = MMRegistrationInformation(customerID: "200417809", playerName:"TheoPlayerApp")
        regInfo.setPlayerInformation(brand: "Theo", model: "VODPlayer", version: ".11")
        regInfo.setSubscriberInformation(subscriberID: "", subscriberType: "Basic", subscriberTag: "TestAppUser")
        TheoPlayerIntegrationWrapper.setPlayerRegistrationInformation(registrationInformation: regInfo, player: theoplayer)

Call to setPlayerRegistrationInformation is mandatory.Call to setPlayerInformation and setSubscriberInformation is optional.

2b) Call the method integrateMMSDK after setting up the player

override func viewDidLoad() {
      //Integration Step 2b
      self.theoplayer.source = sampleSource

2c) Create and Set the Asset Information

The application may like to set the auxiliary information of the asset so that it can be recorded in the Smartsight. This information could be assetId, assetName, videoId (describing the title to which assets belong), custom metadata etc. The app can produce this information to the SmartSight Player SDK by utilizing the metadata field of the SourceDescription used by the Theo player.

let assetInfo = MMAssetInformation(assetURL: $ASSETURL, assetID: $ASSETID, assetName: $ASSETNAME, videoId: $VIDEOID)
     assetInfo.addCustomKVP($CUSTOMKEY, $CUSTOMVALUE)
     let encodedAssetInfo = try? JSONEncoder().encode(assetInfo)
     var jsonAssetInfo = ""
     if let encodedAssetInfo = encodedAssetInfo{
         jsonAssetInfo = String(data: encodedAssetInfo, encoding: .utf8) ?? ""

2d) Adding Custom parameters.

Call to addCustomKVP is optional. However, when a call is made, setting both custom key and the value is mandatory

return SourceDescription(
         source: TypedSource(
             src: "",
             type: "application/x-mpegurl"
         //Integration Step 2d
         metadata : MetadataDescription(metadataKeys: [TheoPlayerIntegrationWrapper.KAssetInformationKey:jsonAssetInfo])

3) Cleanup of session

When the view controller used for playback is removed, call the cleanUp method of the SmartSight Player SDK and add the following method in class ViewController


4) Disable Manifest

Disable Manifest Fetch is optional

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 integrateMMSDK()

 func integrateMMSDK(){
     TheoPlayerIntegrationWrapper.setPlayerRegistrationInformation(registrationInformation: regInfo, player: theoplayer)
     TheoPlayerIntegrationWrapper.disableManifestsFetch(disable: true)

Last updated