Lumen help
Mesh Delivery for Streaming can be easily integrated into your iOS app in just a few simple steps using our SDK for iOS. In this guide, we will show you how to integrate the Mesh Delivery SDK with your app for Apple devices.
Not into tutorials?
Framework installation
Mesh Delivery SDK is delivered as an Xcode framework and is available on Cocoapods.
CocoaPods
Note: Cocoapods 1.6.0 + is recommended
To integrate Lumen Mesh SDK into your Xcode project using CocoaPods, specify this in your Podfile:
Then, run the following command:
Configuration
In the Project Navigator, right click on "Info.plist", and "Open as" → "Source Code". Add the following lines with the right parameters values.
Set the Client Delivery Key
In the Project Navigator, right click on the main target "Info.plist", and "Open as" → "Source Code".
Add the following lines with the values of the right parameters:
Here, the key element contained in DeliveryClient refers to the deliveryClientKey that you will find in the Account section of the Mesh Delivery Dashboard. If you don't have a DeliveryClientKey, you can register for a free trial account on our website.
We strongly recommend to set the delivery client key in Info.plist
. However, if not possible, it is also possible to pass your delivieryClientKey during the initialization step.
Code Integration
SDK Initialization
Initialize the Delivery SDK from the AppDelegate
.
Bridge between your player and the LMDeliveryClient
In order to work correctly, the SDK instance uses a PlayerInteractor
.
It is the component in charge of the interactions between the player and the SDK. It monitors Quality of Service (QoS) metrics and allows the SDK to behave accordingly.
When integrating the SDK, you are free to implement this component but we provide an implementation example PlayerInteractor
that satisifies these requirements for AVPlayer in our sample integration.
Instantiate a LMDeliveryClient
Now that the SDK is initialized, you are able to create LMDeliveryClient
instances.
Once your AVPlayer is up and ready, you will need to configure your LMDeliveryClient
instance:
Note: PlayerInteractor
is referencing the bridge class from the previous step. The name maybe different in your case, but it must subclass LMPlayerInteractorBase
Start the SDK instance and get the final URL
Calling the start()
method on the LMDeliveryClient
instance will start the SDK.
While starting, the SDK will generate a new URL to leverage Mesh Delivery streaming capabilities. Once it has started, make sure to retrieve the final URL and instantiate an AVPlayerItem
with it.
Play the stream
Start the player with the new url provided by the LMDeliveryClient
and link it with the PlayerInteractor
:
Hopefully, the video is playing as expected. Congrats!
Stop the SDK
Make sure to stop the LMDeliveryClient
once you are done with the video. We recommend to put it in the viewDidDisappear(:bool)
or any callback terminating the player lifecycle.
You can pass additional options when creating a LMDeliveryClient
Troubleshooting
OFF
. it can be overridden during a LMDeliveryClientPlugin
Creation: You can also use LumenStatsView
, a utils library that allows the display of Mesh Delivery information on the device. For more information, please follow the Monitoring Tools documentation.
Explore CDN Mesh Delivery