Swift 3: How to set multiple cookies for JWPlayer for HLS Streaming
Asked Answered
A

2

5

As I'm using JWPlayer for HLS Streaming at iOS side. For Streaming we have secure Video url to play content in iOS device. For that we are using cloud front domain. What I want is, our web has integrated cloudfront signed cookie where we need to set cookies for cloudfront domain, Is this we can achieve using JW Player in Ios device?

Please refer below URL for more details,

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

Agraffe answered 21/3, 2017 at 5:41 Comment(0)
S
4
let cookies = "cookiesKey=value;cookiesKey=value...."
let config = JWConfig(containtURL:"your url")
config.assetOptions = ["AVURLAssetHTTPHeaderFieldsKey":["cookie":cookies]]

as above code of cookies, create your cookies string with key and value pair and separated by semicolon and use this as cookie in assetOptions.

Scuffle answered 22/3, 2017 at 4:48 Comment(1)
Perfect fix for me, Thanks a lot.Agraffe
M
3

Yes you can for example,

NSString *cookies = "cookies1=value;cookies2=value" 
JWConfig *config = [[JWConfig alloc] initWithContentUrl:@"your url"];
config.assetOptions = @{@"AVURLAssetHTTPHeaderFieldsKey":@{@"cookie": cookies}};
Mazurek answered 21/3, 2017 at 13:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.