Is there a way to capture video continuously in ReactNative, and storing the last N seconds when stopped?
I would like to know how to solve this scenario in an android/ios device with React Native.
In a soccer match, your favorite team could make a goal. When viewing the match on TV (preferrable real-time) you could have replays. However, it could be the case that you want to record the goals with your mobile device while in the match (perhaps because the match is not streamed on TV, or just you want to have the goals recorded because you love your team so much).
For this to work, I'd need the following features:
- Specify a window time. E.g. 30 seconds.
- Continuously capture with my camera. In my example, I'd point my cellphone's back camera to the field (in particular, to the goal area if I see the ball there and players struggling to score).
- Hit the "record" button with my camera when I want to record something.
- The video will be recorded until such point, starting 30 seconds in the past (or less than 30 seconds if the recording started less than 30 seconds ago). The key feature here, is that I need to record the video and silently discarding video data recorded more than 30 seconds ago.
What I was checking was react-native-camera but the totalSeconds argument is not a window time but just a video maximum length (i.e. does not continue recording by discarding off-time recorded data).
I thought I could use one of two alternatives:
- Find a technology that records, keeps a time window of recorded data, and then when you want to copy you just hit the appropriate button / call the appropriate method and it dumps the video to your desired storage/target/whatever.
- Find a way to record seamless video chunks/segments, and dropping the off-time segments (a library named SCRecorder exists doing that but it works on iOS and it barely-to-no documented at all), and then dumping the actual video to your desired storage/target/whatever.
Is there a library (or setting in the react-native-camera, if any) that could help me with this need?