Add custom HTTP headers (iOS)

Authorize your content request with HTTP headers.

If your content server allows for HTTP header authentication, you can apply custom HTTP headers to your self-hosted, registered content. These headers can be set for individual media items within the asset options.

When sent with requests from the player to your content server, you can prevent unauthorized downloads of your content and validate clients.

Add custom headers

The custom headers are specified as a Dictionary of the type [String:String]. The Dictionary is set as the value of AVURLAssetHTTPHeaderFieldsKey within assetOptions.

The following recipe demonstrates how to add custom headers to the player item.