MediaMelon iOS AVPlayer SDK Integration Document
This guide provides detailed instructions on integrating the MediaMelon AVPlayer SDK into an iOS/tvOS Media Player Application.
Step 1: Setup The SDK
Step 2: Import Frameworks
Step 3: Register and Initialize MediaMelon SDK
Step 4: Additional Custom Metadata
Step 5: Errors and Warnings
Step 6: Report Additional Metadata Fields
Step 7: Cleaning up the SDK Session
Step 8: Update Asset Information
Step 9: Additional Configurations
Step 1: Set up MediaMelon SDK
.package(
url: "https://github.com/MediamelonSDK/mm-ios-sdk-avplayer",
.upToNextMajor(from: "2.6.1")
),target 'SwiftDemo' do
.
.
pod 'MediaMelon-AVPlayer-SDK', '~> 2.5.0'
endStep 2: Import Frameworks
Step 3: Register and Initialize MediaMelon SDK
Step 3.1: Set SDK Registration Information:
Step 3.2: Report Application Information:
Step 3.3: Report Experiment Name & Sub Property ID:
Step 3.4: Set Content Metadata and Initialize Session:
Step 4: Additional Custom Metadata
Check the custom metadata configuration in the SmartSight and report accordingly. If the custom tags are not configured, please configure and use them accordingly.
Use this method to report any additional metadata that doesn’t fall under predefined metadata fields. This provides flexibility to send custom, business, or platform-specific information to the SDK.
Step 5: Errors and Warnings (Important)
The SDK provides two ways to report errors: automatic error capture and manual error reporting via API.
⚙️ Default Behavior (Auto Error Capture):
By default, the SDK automatically listens to and captures player errors that occur after the stream has loaded. SDK will classify the errors based on severity.
🚫 Disabling Auto Error Capture:
If you prefer to handle error reporting manually, you can disable this automatic behavior by calling:
🛠️ Manual Error Reporting APIs:
Use these APIs to custom report errors and warnings to the SDK—especially for errors that occur before or during stream loading, or when auto-capture is disabled.
🔴 Report Fatal Error:
All errors reported via reportError are treated as fatal.
🟠 Report Warning (Non-Fatal):
All warnings reported via reportWarning are treated as non-fatal and will be tracked accordingly.
Step 6: Report Additional Metadata Fields
Step 6.1: CDN:
Report the name or identifier of the Content Delivery Network (CDN) used for streaming. This helps track performance and quality across different CDNs.
Step 6.2: Stream Information:
Report key stream attributes that describe the encoding and delivery method.
Step 6.3: Player Resolution:
Report the width and height of the player window (in pixels). This is useful to understand playback size and user experience across different screen sizes or platforms.
Step 6.4: Report Stream Fallback Event
Report fallback event in case the primary manifest URL fails and falls back on the secondary manifest.
Step 7: Cleaning up the SDK Session
Step 8: Update Asset Information
To update the asset information during a content change or a live session, use the changeAssetForPlayer method as shown below. Whenever the asset information is updated, a new SDK session will be initialised. Please note either changeAssetForPlayer or initializeAssetForPlayer should be called not both.
If Asset Information needs to be updated dynamically during the live session without re-initiating the player, then the updateAssetInfo API can be used to update the new AssetInfo
Step 9: Additional Configurations
Step 9.1: Disable manifest fetch by the SDK (Optional)
If your workflow limits access to the manifest from both the player and the MediaMelon Player SDK at the same time, you have the option to prevent manifest fetching by using the disableManifestsFetch method calling it before initialization.
Step 9.2: Enable or Disable SDK Log Trace
To enable the SDK log trace, use the following API call: enableLogTrace.
Release Notes
Dependency Framework Releases: MediaMelon-QoE-SDK
Last updated