How to implement AWS signed cookie with avassetresourceloader?

My app has a .m3u8 live stream and I would like to use avassetresourceloader to control the https connection as ssl pinning is required for my app. As the stream is protected with signed cookie function by aws, I cannot find the way to set the cookie to the avplayer at the shouldWaitForLoadingOfRequestedResource callback, and the request to the .ts file keep returns 401.


Another problem is that when i tried a stream without cookie restriction, the playback is success on iOS 12 only. For iOS 11 or lower, the avplayer returns -12884 "CoreMediaErrorDomain" "Playlist File not received".


Is there any way to solve this/other method to do ssl pinning with avplayer playing m3u8 livestream? Thank you