Open tomihr opened 3 years ago
`session?.saveLocalVideo = true
let cachesDir = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).map(\.path)[0]
let movieName = "\(UUID().uuidString).mp4"
let pathToMovie = URL(fileURLWithPath: cachesDir).appendingPathComponent(movieName).path
session?.saveLocalVideoPath = URL(fileURLWithPath: pathToMovie)`
Then in liveStateDidChange, case stop
` if let videoURL = self.session.saveLocalVideoPath{ UISaveVideoAtPathToSavedPhotosAlbum(videoURL.relativePath, self, #selector(self.image(_:didFinishSavingWithError:contextInfo:)), nil) }
//MARK: - Save Video callback
@objc func image(_ image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeRawPointer) {
if let error = error {
print(error.localizedDescription)
} else {
print("Success")
}
}`
Thanks, will try.
Is it possible to save the video without streaming it to the RMTP server, just to have a save mode that will not relay on RMTP streaming?
Thanks
I stumbled on one issue, if I put the app in the background ad then activate it again and move it to the foreground, I got this message:
Couldn't write a frame
No matter am I recording or not, and streaming is broken. How do I fix this?
Thanks
I am tring to save the video to the device, but I didn't succeed yet. I am setting session property session?.saveLocalVideo = true and providing file name and path, here is my code:
Do I have to do something else?
Thanks