react-native-vision-camera icon indicating copy to clipboard operation
react-native-vision-camera copied to clipboard

fix: Pause on iOS not working correctly

Open DragonSpirit opened this issue 3 years ago • 2 comments

What

This PR fixes a gap while video on pause

Changes

This PR stores the difference between the last timestamp and the timestamp when the video was paused. Subsequently, the diff is taken to add new frames.

Tested on

iPhone 11, iOS 15.4

Related issues

#973

Additional

It works correctly in case of video, but I still have an issue with sound. Any help would be appreciated.

DragonSpirit avatar May 17 '22 16:05 DragonSpirit

Phew, this looks pretty complicated. Wouldn't it be possible to just add a single new variable that keeps track of the latest recorded timestamp when pause was initiated? Maybe we can abstract this into a separate object to avoid having everything in the CameraView...

mrousavy avatar May 24 '22 11:05 mrousavy

In the case of storing the last recorded timestamp, we may encounter the problem of multiple pauses in the same video. I dunno a simpler way when we use a timestamp to add in a buffer.

DragonSpirit avatar May 24 '22 12:05 DragonSpirit

Any progress on this PR? Would be a huge help.

kevyg03 avatar Nov 22 '22 23:11 kevyg03

Hey thanks for your PR and sorry for the long radio silence here! I think this approach is a bit messy, I wonder why AVAssetWriter doesn't properly work with the timestamp difference when paused. Maybe we should use another master clock?

mrousavy avatar Sep 30 '23 13:09 mrousavy