Created
August 24, 2017 06:54
-
-
Save shalyf/2a88608d660fb4623ec28aff80e5d64a to your computer and use it in GitHub Desktop.
Live Photo导出成视频
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let resources = PHAssetResource.assetResources(for: asset) | |
let videoResource = resources.first(where: { $0.type == .video || $0.type == .pairedVideo })! | |
let url = URL(fileURLWithPath: FileManager.Folder.tmp.append(pathComponent: "test.MOV")) | |
let resourceOptions = PHAssetResourceRequestOptions() | |
resourceOptions.isNetworkAccessAllowed = true | |
PHAssetResourceManager.default().writeData(for: videoResource, toFile: url, options: resourceOptions, completionHandler: { (error) in | |
print(error == nil) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment