CoreMediaErrorDomain error -12865

Hello, can anybody help me with this ? I am downloading video in FS, and when I give that url to player it gives me this error. but this comes up only in case of m3u8. other format like mp4 are working fine locally. please help !

{"error": {"code": -12865, "domain": "CoreMediaErrorDomain", "localizedDescription": "The operation couldn’t be completed. (CoreMediaErrorDomain error -12865.)", "localizedFailureReason": "", "localizedRecoverySuggestion": ""}, "target": 13367}

That error is coming out of Core Media, which is part of the video subsystem, and I’ve re-tagged your question accordingly.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I had the same problem. I was because I used the url received in param willDownloadTo of function

urlSession(_:aggregateAssetDownloadTask:willDownloadTo:)

I always received the error -12865

To solve it when download finished in function :

urlSession(_:task:didCompleteWithError:)

I create un bookmarkData with the previous mentioned url, and store it in User defaults with an unique identifier for de asset:

     let userDefaults = UserDefaults.standard
     let bookmark = try downloadURL.bookmarkData()
     userDefaults.set(bookmark, forKey: AssetIdentifier)

With this, when I need the url to playback a recover it from user defaults:

func localAssetFor(withID identifier: String) -> AVURLAsset? { let userDefaults = UserDefaults.standard guard let localFileLocation = userDefaults.value(forKey: identifier) as? Data else { return nil }

    var asset: AVURLAsset?
    var bookmarkDataIsStale = false
    do {
        let url = try URL(resolvingBookmarkData: localFileLocation,
                                bookmarkDataIsStale: &bookmarkDataIsStale)
        if bookmarkDataIsStale {
            fatalError("Bookmark data is stale!")
        }
        
        let urlAsset = AVURLAsset(url: url)
        return urlAsset
    } catch {
        fatalError("Failed to create URL from bookmark with error: \(error)")
    }

}

With this changes I always have to playback offline content without error 12865.

Hope this help

Pedro

Hi did you ever figure out what the issue was here?

CoreMediaErrorDomain error -12865
 
 
Q