Swift 3: How to set multiple cookies for JWPlayer to stream HLS

How do I use JWPlayer to stream HLS on the iOS side. For Streaming, we have a secure URL for playing content on an iOS device. For this we use a cloud front. What I want, our web interface has a built-in cookie signed in the cloud, where we need to set cookies for the cloud domain, can this be done using the JW Player on the iOS device?

For more information, see the URL below.

http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-signed-cookies.html

+4
source share
2 answers
let cookies = "cookiesKey=value;cookiesKey=value...."

let config = JWConfig (containtURL: "your url") config.assetOptions = ["AVURLAssetHTTPHeaderFieldsKey": ["cookie": cookies]]

as stated above, cookie, create a cookie string with a key and value and separate it with a semicolon and use this as a cookie in assets.

+2
source

Yes, you can, for example,

NSString *cookies = "cookies1=value;cookies2=value" 
JWConfig *config = [[JWConfig alloc] initWithContentUrl:@"your url"];
config.assetOptions = @{@"AVURLAssetHTTPHeaderFieldsKey":@{@"cookie": cookies}};
+3
source

Source: https://habr.com/ru/post/1672779/


All Articles