Record video and play video at the same time

前端 未结 1 918
北恋
北恋 2021-01-07 11:04

I want to play a video (with sound) and record video from the front-facing camera at the same time. The view finder for the camera should appear as a small \"picture-in-pict

相关标签:
1条回答
  • 2021-01-07 11:43

    Check out the AVFoundation framework, which is used for much of the audio and video programming in iOS.

    In your case you could use an AVPlayer and AVPlayerLayer to play your movie, and an AVCaptureSession, an AVCaptureVideoPreviewLayer, and an AVCaptureMovieFileOutput to record.

    If you are familiar with Core Animation, you can set the bounds and add sublayers to AVPlayerLayer and AVCaptureVideoPreviewLayer to achieve you desired interface layout.

    These classes are very well documented, and the AVFoundation Programming Guide clearly explains their interaction.

    Feel free to comment with any questions.

    0 讨论(0)
提交回复
热议问题