Lumen help

Lumen Mesh Delivery and CDN Load Balancer removal

For web

Step 1: Remove all Lumen libraries

When using CDN

                <!-- Mesh Delivery wrapper -->
<script src="//cdn.streamroot.io/hlsjs-dna-wrapper/1/stable/hlsjs-dna-wrapper.js?srKey=YOUR_STREAMROOT_KEY"></script>

            

When using npm

                npm install @streamroot/hlsjs-dna-wrapper
            
                import HlsjsDnaWrapper from '@streamroot/hlsjs-dna-wrapper';
            

Step 2: Remove specific code in the HTML <body>

                <video id="demoplayer"></video>
<script>
    var hlsjsConfig = {};
    var dnaConfig = {};
    var hls = new Hls(hlsjsConfig);
    var wrapper = new HlsjsDnaWrapper(hls, 'YOUR_STREAMROOT_KEY', dnaConfig);
    var video = document.getElementById('demoplayer');
    hls.loadSource('YOUR_PLAYLIST_URL');
    hls.attachMedia(video);
    hls.on(Hls.Events.MANIFEST_PARSED,function() {
        video.play();
    });
</script>

            
                                
var hlsjsConfig = {
   "maxBufferSize": 0,
   "maxBufferLength": 30,
   "liveSyncDuration": 30,
   "liveMaxLatencyDuration": Infinity
}
            

For Android & iOS/tvOS

Step 1: Remove all SDK dependencies

                dependencyResolutionManagement {
    repositories {
        maven { url 'https://sdk.streamroot.io/android' }
    }
}

            
                // It is good practice to lock dependencies version
def dc_version = "23.3.0"

implementation "io.streamroot.lumen.delivery.client:mesh-sdk:$dc_version"

            
                target 'MyApp' do
  use_frameworks!
  pod 'LumenMeshSDK'
end
            

Step 2: Remove all specific project configurations

                -keep class io.streamroot.** { *; }
-dontwarn io.streamroot.lumen.**
            
                <uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

            
                <?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="false">127.0.0.1</domain>
    </domain-config>
</network-security-config>

            
                <manifest ...>
    <application
        ...
        android:networkSecurityConfig="@xml/network_security_config">
    </application>
</manifest>

            
                <meta-data
android:name="io.streamroot.lumen.delivery.client.DeliveryClientKey"
android:value="<delivery-client-key>"
/>

            
                <key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>

            
                <key>DeliveryClient</key>
<dict>
  <key>Key</key>
  <string><delivery-client-key></string>
</dict>

            

Step 3: Remove SDK integration code

                class Application: MultiDexApplication() {

    override fun onCreate() {
        super.onCreate()
        /* If you could not add your Delivery Client Key in your AndroidManifest.xml
         * Call instead: LumenDeliveryClient.initializeApp(this, "<delivery-client-key>")
         */
        LumenDeliveryClient.initializeApp(this)
        ...
    }
}

            
                private fun createDeliveryClient(
    player: ExoPlayer,
    loadControl: DefaultLoadControl,
    bandwidthMeter: ExoPlayerBandwidthMeter
) : LumenDeliveryClient {
    val playerInteractor = PlayerInteractor(player, loadControl, bandwidthMeter)
    return LumenDeliveryClient.meshBuilder(this) //< applicationContext
            /*
             * Set the player interactor that will be used by the SDK
             * Check the bridge section to know more
             *
             * param: an instance of a class subclassing LumenPlayerInteractorBase.
             */
            .playerInteractor(playerInteractor)
            /*
             * Set the optional parameters (more details below)
             * NOTE: This is required even if empty
             */
            .options {}
            /*
             * Build a LumenDeliveryClient instance
             *
             * param: String. The video stream url
             */
            .build(manifestUrl)
}

            
                deliveryClient.start()
val finalUrl = deliveryClient.localUrl()

            
                val mediaItem = MediaItem.fromUri(Uri.parse(finalUrl))

            
                @main
class AppDelegate: UIResponder, UIApplicationDelegate {
  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    /*
     * If you can not add your Delivery Client Key in Info.plist
     * Call instead: LMDeliveryClient.initializeApp(withDeliveryKey: "<delivery-client-key>")
     */
    LMDeliveryClient.initializeApp()
    ...
  }

  ...
}

            
                func createDeliveryClient() -> LMDeliveryClient {
  return LMDeliveryClientBuilder.clientBuilder()
         /*
          * Set the player interactor to use
          * Check the bridge section to know more
          *
          * param: an instance of a class subclassing LMPlayerInteractorBase.
          */
         .playerInteractor(PlayerInteractor())
         /*
          * Build a LumenDeliveryClient instance
          *
          * param: String. The video stream url
          */
         .build(url)
            
                var deliveryClient = createDeliveryClient()
deliveryClient.start();

guard let deliveryUrl = deliveryClient.localManifestURL else {
  fatalError("Local url manifest could not be generated")
}

let playerItem = AVPlayerItem(asset: AVURLAsset(url: deliveryUrl))

            
                let player = AVPlayer(playerItem: playerItem)
playerInteractor.linkPlayer(player!, playerItem: playerItem)