Post

Replies

Boosts

Views

Activity

Reply to HLS AVPlayer modify master manifest
2 possibilities I used before: Setup a Charles proxy and prepare a rewrite rule using regular expressions that match the unwanted renditions and replace them with a blank string Define a resourceLoaderDelegate (https://developer.apple.com/documentation/avfoundation/avassetresourceloaderdelegate) on your avAsset and give the master m3u8 a custom protocol (e.g. mymasterprotocol://example.com/master.m3u8). Upon interception in the delegate, you can do the actual remote playlist request with http protocol, filter out the stuff you don't want to keep using string operations and only return the renditions you are interested in from the delegate method. When setting up the avAsset: self.avAsset.resourceLoader.setDelegate(resourceLoaderDelegate, queue: self.resourceLoaderDelegateQueue) In the resourceLoaderDelegate implement: func resourceLoader(_ resourceLoader: AVAssetResourceLoader, shouldWaitForLoadingOfRequestedResource loadingRequest: AVAssetResourceLoadingRequest) -> Bool { let request: URLRequest = loadingRequest.request let url: URL = request.url! let scheme: String = url.scheme!     if scheme == "mymasterprotocol" { handleRemoteMasterRequestAndFilterStuff(loadingRequest: loadingRequest)        return true     }           return false }
Sep ’21