开发者

Record video and play video at the same time

开发者 https://www.devze.com 2023-04-11 16:17 出处:网络
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-picture\" in the bottom right h

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-picture" in the bottom right hand corner of the screen while the movie plays full screen behind it. Is this开发者_StackOverflow possible? Is layering the appropriate classes on top of each other possible?


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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号