Problem with chromecasting from ios with HLS AES 128

Hi there

We are experiencing some strange behavior on Bitmovin chromecast for ios app. The casting connect but do not show any video. We are changing to encrypted stream (HLS AES 128) for trailers.
This problem do not occur in fairplay/widevine, or not even on webplayer casting from mac to chromecast, only on ios to chromecast.

We have been testing on the AdvancedCasting git example from Bitmovin for testing and tried to update for our need.
We are using what we call encrypted stream, also known as HLS AES 128
We do not want to set or use widewine, fairplay etc.

What we try to solve is shown in code below,
This is our updated advancedcasting ViewController code

    // Create HLSSource as an HLS stream is provided
    let sourceConfig = SourceConfig(url: streamUrl, type: .hls)
    // Set title and poster image
    sourceConfig.title = "NF demo"
    sourceConfig.sourceDescription = "Demo Stream"
    sourceConfig.posterSource = posterUrl

    playerConfig.remoteControlConfig.prepareSource = { type, sourceConfig in

        switch type {

        case .cast:

            print("VOD", vod)

            guard let streamUrl = URL(string: vod),
                  let licenseUrl = URL(string: "") else {

                return nil


            // Create DASHSource as a DASH stream is used for casting

            let castSourceConfig = SourceConfig(url: streamUrl, type: .hls)
            castSourceConfig.title = sourceConfig.title
            castSourceConfig.sourceDescription = sourceConfig.sourceDescription
            return castSourceConfig
    player.load(sourceConfig: sourceConfig)


Is it possible on ios with Bitmovin to get this working at all?
Other possibilities is to define our own receiver, and cast to that one, but it will include more work on other areas, ie getting subtitles to work.

Any known solutions, tips og guides?


AES128 works with no DRM server. I believe that merely setting the HLS URL in your source object should allow you to cast it too. You can use the BasicCasting example.

Please let me know in case you are running into any errors

Hi, thanks for your reply.

I test with the code in BasicCasting, still it does not play on chromecast from my ios iphone.
It works perfect on airplay / appletv and on iphone, as well as from browser on mac (webplayer).

The original sample video do work with chromecasting, but not my test url. The difference is in the encryption, AES128 I think. I have a really hard time getting this to work, trying all sorts of things.

The url to the stream is

And have only changed url,

override func viewDidLoad() {

    self.view.backgroundColor = .black

    // Define needed resources
    /* This works, but is probably not in AES128
    guard let streamUrl = URL(string: "") else {
    guard let streamUrl = URL(string: "") else {
    // Create player configuration
    let playerConfig = PlayerConfig()

    // Set your player license key on the player configuration
    playerConfig.key = playerLicenseKey

    // Create analytics configuration with your analytics license key
    let analyticsConfig = AnalyticsConfig(licenseKey: analyticsLicenseKey)

    // Create player based on player and analytics configurations
    player = PlayerFactory.create(
        playerConfig: playerConfig,
        analyticsConfig: analyticsConfig
    // Create player view and pass the player instance to it
    let playerView = PlayerView(player: player, frame: .zero)

    // Listen to player events
    player.add(listener: self)

    playerView.autoresizingMask = [.flexibleHeight, .flexibleWidth]
    playerView.frame = view.bounds


    let sourceConfig = SourceConfig(url: streamUrl, type: .hls)

    // Set title and poster image
    sourceConfig.title = "BipBop - Apple sample stream"

    player.load(sourceConfig: sourceConfig)

If anyone has some concrete experience or advice, I´ll be more than happy.

Thanks :slight_smile: