ことはできません:私はちょうどString(describing: filePath)
としてメディアの場所を維持する場合は、その後、私は記録を停止、その後UIVideoAtPathIsCompatibleWithSavedPhotosAlbumは、私はファイルパスを作成し、それを記録しています開いているファイル・スウィフト3
let mediaLocation = (filePath).path
if UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(mediaLocation) {
UISaveVideoAtPathToSavedPhotosAlbum(mediaLocation, self, nil, nil)
} else {
print("Cannot find file to save")
let player = AVPlayer(url: filePath)
let playerController = AVPlayerViewController()
playerController.showsPlaybackControls = true
playerController.player = player
present(playerController, animated: false) {
player.play()
}
}
を
filePath = documentsURL.appendingPathComponent("temp.MOV")
videoFileOutput.startRecording(toOutputFileURL: filePath, recordingDelegate: recordingDelegate)
上記のコードを使用した場合、エラーは「開くことはできませんが、プレーヤーはファイルを再生しますが、
を再生します。完全なエラーは次のとおりです。
ビデオ /var/mobile/Containers/Data/Application/B24F0CD8-479B-483D-AE20-0ED8040101EC/Documents/temp.MOV は、保存された写真をアルバムに保存することはできません:エラー ドメイン= AVFoundationErrorDomainコード= -11829 のUserInfo = {NSLocalizedFailureReason =このメディアが破損する恐れがあり、 NSLocalizedDescription =開くことができない、 NSURL =ファイル "を開くことができない":/// VAR /モバイル/コンテナ/データ/アプリケーション/B24F0CD8-479B-483D-AE20-0ED8040101EC/Documents/temp.MOV、 NSUnderlyingError = 0x170241ef0 {エラードメイン= NSOSStatusErrorDomain コード= -1284 8 "(null)"}}