AVAssetExportSession stuck (not starting) export

后端 未结 1 1592
天命终不由人
天命终不由人 2021-02-04 18:12

I have attempted to export videos from Photo Library, but the export callback is never executed. I periodically check the progress of the export, and the progress is always zero

1条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-04 19:10

    I saw this issue a couple of times on some Github projects and usually it had something to do with how the URL was created. Not sure if the code you put in your question was just some placeholder but I think you should create a fileURL like this instead of "string".

    var tempFileUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0].appendingPathComponent("temp_video_data.mp4", isDirectory: false)
    tempFileUrl = URL(fileURLWithPath: tempFileUrl.path)
    exportSession.outputURL = tempFileUrl
    

    Perhaps this will fix it?

    0 讨论(0)
提交回复
热议问题