You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I download a video from a URL, and then i cache the Data to the cache using Cache.
Then later on I want to play that video i cached, so i check if it's cached, which it is, but then I put the Data into an url like (videoData being the NSData from the cache):
let url = URL(dataRepresentation: videoData as Data, relativeTo: nil)!
If i then try to play the video using the url, it's not working. Help please?
I know one could store the file locally, and the find the path to that file, but that defeats the purpose of caching a video using this library, because then you can't control expiration date etc.
And I see that the cached files get a .cache file type, so I can't reference the path directly as a .mp4 file and play it from the cached folder.
The text was updated successfully, but these errors were encountered:
I'm running into the same issue. What I ended up doing as a temporary fix is to get the video data from the cache, then save it to the user temp directory as an MP4 file and getting the url for that instead.
if let cachedVideoData = cache.object(forKey: videoUrl.absoluteString){lettempVideo=File<NSData>(path:Path.userTemporary +"temp.mp4")try! tempVideo.create()try! tempVideo.write(cachedVideoData, atomically: true)
// use tempVideo.path.url
}
I'm using FileKit, but this can be done in the same way with FileManager
I don't really like this solution, but it will have to do for the time being.
I download a video from a URL, and then i cache the Data to the cache using Cache.
Then later on I want to play that video i cached, so i check if it's cached, which it is, but then I put the Data into an url like (videoData being the NSData from the cache):
let url = URL(dataRepresentation: videoData as Data, relativeTo: nil)!
If i then try to play the video using the url, it's not working. Help please?
I know one could store the file locally, and the find the path to that file, but that defeats the purpose of caching a video using this library, because then you can't control expiration date etc.
And I see that the cached files get a .cache file type, so I can't reference the path directly as a .mp4 file and play it from the cached folder.
The text was updated successfully, but these errors were encountered: