Reputation: 684
While playing a decrypted HLS video i am using GCDServer to host m3u8 file and it played well when i am using a decrypted set of chunks in m3u8 file but when i used the decrypted one and tried to decrypt the key and chunks it is not playing there. As the AVAssetResourceLoaderDelegate methods not called with http scheme and if i use custom scheme then the GCDServer finished loading. Any suggestion?
trying something but not succeeded.
let urlComponents = NSURLComponents(url: loadingRequest.request.url!, resolvingAgainstBaseURL: false)
urlComponents?.scheme = "http"
var mutableLoadingRequest = loadingRequest.request
mutableLoadingRequest.url = urlComponents?.url
loadingRequest.request = mutableLoadingRequest
This is what m getting in server log.
[DEBUG] Did open IPv4 listening socket 5
[DEBUG] Did open IPv6 listening socket 7 [INFO] GCDWebServer started on port 8080 and reachable at http://192.168.1.183:8080/ Get host url Optional(http://192.168.1.183:8080/) { URL: tapow://192.168.1.183:8080/ }, request ID = 1, content information request = , data request = >
Upvotes: 2
Views: 672
Reputation: 684
Just want to share the answer in case anyone is in need,
Yes, we can. As the m3u8 is searching for the file in his own folder so just decrypt the m3u8 data in AVAssetResourceLoaderDelegate and return back to method then it will automatically perform the next task. P.S - you can replace it with other server ts too i just used it to for online streaming.
It is true that you can't get the reference of m3u8 in a variable in iOS but you can pass the object directly to required place. I have used GCDserver to host the m3u8 file and i just sent the local path url of m3u8 file in parameter and then GCDserver did its job and host the file on local server. Later i used the gcdserver url for avplayer.
Upvotes: 1