Closed danglu999 closed 6 months ago
Hello @danglu999 I found one solution and I implemented this solution in my project it is working fine. You need to change swift code in SwiftFlutterScreenRecordingPlugin this file. And it is package file.
switch rpSampleBufferType {
case .video:
print("writing sample....")
if self.assetWriter?.status == AVAssetWriter.Status.unknown {
print("Started writing")
self.assetWriter?.startWriting()
self.assetWriter?.startSession(atSourceTime: CMSampleBufferGetPresentationTimeStamp(cmSampleBuffer))
}
if self.assetWriter.status == AVAssetWriter.Status.failed {
print("StartCapture Error Occurred, Status = \(self.assetWriter.status.rawValue), \(self.assetWriter.error!.localizedDescription) \(self.assetWriter.error.debugDescription)")
return
}
if self.assetWriter.status == AVAssetWriter.Status.writing {
if self.videoInput.isReadyForMoreMediaData {
print("Writing a sample")
if self.videoInput.append(cmSampleBuffer) == false {
print("problem writing video")
}
}
}
case .audioMic:
if self.audioMicInput.isReadyForMoreMediaData {
print("audioMic data added")
self.audioMicInput.append(cmSampleBuffer)
}
default:
print("not a video sample")
}
please add one case in above switch case case .audioMic: and also you need to add this switch condition in DispatchQueue.main.async
After that I able to record audio and video in iPhone real device. For your reference follow below link for solution : https://stackoverflow.com/questions/59613660/rpscreenrecorder-shared-startcapture-wont-write-keeps-failing
Is there any updates please ? It still doesn't work on ios
Any updates on this? or @jayu146 are you able to help me implement your solution? Do I need to make a fork of this project and then make the changes. I was a bit confused what to do with "also you need to add this switch condition in DispatchQueue.main.async"
Hi, Thanks for your great work. Recording screen can work well, while I choose record screen & audio, only 1 second is recorded whenever I tap Stop Record.
Flutter version: 3.3.8