-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: pause & resume recording fix on iOS #1546
Conversation
When recording is paused, then resumed the timestamp should now be correctly calculated. Taken from ankits16 code here: https://github.com/ankits16/CVRecorderFinal/blob/main/framework/CVRecorder/CVRecorder/Recorder%20View/CameraEngine.swift#L297
This was changed to ensure it works even if microphone access is disabled or denied.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Hey - this also seems rather complex. I think ideally AVAssetWriter should understand those timestamp diffs, maybe we should sync to the audio sessions master clock instead of the other way around? |
@mrousavy Hi. That problem still continue. Any solution do you suggest? |
Can you please create a detailed issue report so I can take a look at that? |
Hi @mrousavy . Sorry for late answer.
Normally video duration should be 10 seconds but its 15 seconds. Audio finished after 10 seconds but video still continue. I guess , if i press pause , video recording continue with paused frame view. So, when i pause and play |
Yep same issue works fine in android but not in ios, @mrousavy can you please check ? |
Hey all! I just spent a few days on thinking about a battleproof timestamp synchronization solution, and I came up with a great idea.
This was really complex to built as I had to synchronize timestamps between capture sessions, and the entire thing is a producer model - a video buffer can come like a second or so later than the audio buffer, but I need to make sure the video track starts before the audio track starts, and ends after the audio track ends - that's a huge brainf*ck! 🤯😅 There's also no helper APIs for this on iOS, and it looks like no other Camera framework (not even native Swift/ObjC iOS Camera libraries) support this - they all break when timestamps have a delay (e.g. video stabilization enabled) (or dont even support delays at all) ; so I had to build the thing myself. Check out this PR and try if it fixes the issue for you; #2948 Thanks! ❤️ |
What
When pausing and resuming record on iOS the paused timestamp should now be used in adjusting the final record timestamp. So when recording, then pausing, then resuming record the resulting video will correctly "jump ahead" and skip the time during the pause.
Changes
I implemented the Swift version (https://stackoverflow.com/q/61547473) of the original Objective-C sample (http://www.gdcl.co.uk/2013/02/20/iPhone-Pause.html) intended to correctly adjust the timestamp when pausing record.
Specifically the CameraView RecordVideo extension was modified to track the offset calculated when the record process is first paused. Some ivars were added to the CameraView class to help track this.
Tested on
Related issues