I use encrypted contents in my app . Before playing I request for decryption key which helps in playing content online . I want to play content offline too . So I download the content. But how can I store decryption keys ?
Post
Replies
Boosts
Views
Activity
I created one product in appstoreconnect and am testing in sandbox mode
Purchase auto renewal product A . Original transaction id is 12345
renews few times and expires
After 3 days , purchase same product A . Again the original transaction id received from receipt is 12345 .
Is this expected behaviour? . If yes how to differentiate between old and new purchase?
I am able to play AES encrypted content in online mode and download it . But the downloaded content does not play in offline mode.
Steps:
Get encrypted content url
call backend api to get token to decrypt the url
play the content . works
download content. works
off the internet and try to play . Fails to play.
I use AVAggregateAssetDownloadTask to download video contents . pause , resume works fine in the normal flow .
AVAssetDownloadDelegate methods are not called when the task is resumed on app relaunch.
Steps:
download content
quit app when download is in progress
relaunch app
create session and get all tasks and resume tasks
delegates not called
I have confirmed that session and tasks are not nil .
func restorePersistenceManager() {
guard !didRestorePersistenceManager else { return }
didRestorePersistenceManager = true
// Grab all the tasks associated with the assetDownloadURLSession
assetDownloadURLSession.getAllTasks { tasksArray in
let downloadsArray = DownloadManager.shared.getAllDownloadedAssets()
// For each task, restore the state in the app by recreating Asset structs and reusing existing AVURLAsset objects.
for task in tasksArray {
guard let assetDownloadTask = task as? AVAggregateAssetDownloadTask, let assetName = task.taskDescription else { break }
let downloadAsset = downloadsArray.filter {$0.stream.name == assetName}
if downloadAsset.count > 0 {
let urlAsset = assetDownloadTask.urlAsset
var asset = Asset(stream: (downloadAsset.first?.stream)!, urlAsset: urlAsset)
self.activeDownloadsMap[assetDownloadTask] = asset
StreamManager.shared.setStream(value: (downloadAsset.first?.stream)!)
self.resumeDownload(for: &asset)
}
}
}
}