내가 파일 경로를 생성하고 그것을로 기록하고있다 : 내가처럼 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 사용자 정보 = {NSLocalizedFailureReason =이 미디어가 손상 될 수 NSLocalizedDescription = 열 수 없습니다, NSURL = 파일을 "열 수 없습니다". /// VAR/모바일/용기/데이터/응용 프로그램 /B24F0CD8-479B-483D-AE20-0ED8040101EC/Documents/temp.MOV, NSUnderlyingError = 0x170241ef0 {오류 도메인 = NSOSStatusErrorDomain 코드 = -1284 8 "(null)"}}