How to Play Video and Record Video at the Same Time in iOS Development, and Ensure the Time Error of Both Not Exceeding 0.02 Seconds

  ios, question

The questions are as follows:

There is a video A, while playing this video, start recording video B; When A is finished playing, B’s recording will be finished immediately. It is necessary to ensure the synchronization of the two videos with minimal time error. In other words, when the two videos are collaged together (for example, someone is playing the piano in video a and someone is singing along with this accompaniment in video b), the beat needs to be kept consistent.

I haven’t done it, but I have some ideas.
If you want to realize this function, theVideo aMust be a local video.
Moreover, the resolution of the video should be as small as possible. If the final video needs to be synthesized and the resolution requirement is high, it may be considered toVideo aCompress a small file for playback during recording.
Before the video starts playing, there may be a period of time before parsing the video information and buffering. So you need to wait for the player control to call back.VideoDidPlayedYou can only record it when it is. (Different libraries may be notified by different methods, in short, recording begins when the captured video is officially played.)