We have everything implemented properly, however when we're trying to play offline enabled content, we got this error:
asset.urlAsset.resourceLoader delegate: Optional(<HLSCatalog.AssetLoaderDelegate: 0x174279d40>)
resourceLoader(_:shouldWaitForLoadingOfRequestedResource:) was called in AssetLoaderDelegate with loadingRequest:
<AVAssetResourceLoadingRequest: 0x170200470, URL request = <NSMutableURLRequest: 0x170200120>
{ URL: skd://key65 }, request ID = 1, content information request = <AVAssetResourceLoadingContentInformationRequest: 0x1702002f0, content type = "(null)", content length = 0>
, byte range access supported = NO, disk caching permitted = NO, renewal date = (null)>,
data request = <AVAssetResourceLoadingDataRequest: 0x17001fe30, requested offset = 0, requested length = 9223372036854775807, requests all data to end of resource = YES, current offset = 0>>
assetIDString: key65
status code: 200
Error creating persistent content key: Error Domain=AVFoundationErrorDomain Code=-11835
"Cannot Open" UserInfo={NSUnderlyingError=0x1742438a0 {Error Domain=NSOSStatusErrorDomain Code=-42681 "(null)"},
NSLocalizedFailureReason=This content is not authorized., NSLocalizedDescription=Cannot Open}
The m3u8 file looks like this:
#EXTM3U
#EXT-X-VERSION:7
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-TARGETDURATION:1
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-KEY:METHOD=SAMPLE-AES,URI="skd://key65",KEYFORMAT="com.apple.streamingkeydelivery",KEYFORMATVERSIONS="1"
#EXT-X-SESSION-KEY:METHOD=SAMPLE-AES,URI="skd://key65",KEYFORMAT="com.apple.streamingkeydelivery",KEYFORMATVERSIONS="1"
#EXTINF:0.004000,
#EXT-X-BYTERANGE:91368@0
8ebe7d452ab6edee09100da286cd5e88.ts
#EXT-X-ENDLIST
is there anything wrong with the M3U8 file?
In order to enable offline playback we added the #EXT-X-SESSION-KEY line additionally to the m3u8 file.
Online playback works properly, we get this error only when we are trying to play back content offline.