How does the entry photo/video before you clicked the button (Live Photo, etc.)?

Interested in the recording process of the video/photo before you press the record button.
For example, a Live Photo from Apple (1.5-second "video" before pressing the button for 1.5 seconds after) and feature in the video recorder (30 seconds before pressing the button/collision).
Google did not help.
June 16th 19 at 18:45
1 answer
June 16th 19 at 18:47
The video is written into a circular buffer, overwritten with new footage over the old one. At the moment of pressing the button that was in the buffer is saved to a file. This will be the 1.5-30 sec video before pressing.

Find more questions by tags AlgorithmsPhotos