AirPlay headers...

Hi guys,


I'm currently unable to play my encrypted streams thru AirPlay because i need to add some headers in it. I'm currently doing it in AVPlayer but i have no idea how to add them in the AirPlay receiver or player...


Is there a way to add headers for AirPlay?


This is my code to add headers on AVPlayer.


let fileURL = NSURL(string: self.connexionSources.getPlaylistChannel(numChan: index)) 
            self.headers = ["Authorization": "myAuth"] 
            let avAsset = AVURLAsset(url: fileURL! as URL, options: ["AVURLAssetHTTPHeaderFieldsKey": self.headers]) 
            let playerItem = AVPlayerItem(asset: avAsset) 

            self.playerView.playerLayer.player = AVPlayer(playerItem: playerItem) 

            //This is for AirPlay support 
            self.playerView.playerLayer.player?.allowsExternalPlayback = true 
            self.playerView.playerLayer.player?.usesExternalPlaybackWhileExternalScreenIsActive = false 

            //We start the player 
            self.playerView.playerLayer.player?.play()

I have same question. any idea 😢?

The problem still exists, and is there any quick solution?

Hello @jboisjo, thank you for your post. Media file interception is not currently supported with AVAssetResourceLoader, for example.

If you'd like us to consider adding the necessary functionality, please file an enhancement request using Feedback Assistant. Once you file the request, please post the FB number here.

Please also note that AVURLAssetHTTPHeaderFieldsKey is not a supported API, so you should not use it.

AirPlay headers...
 
 
Q