I'm capturing one view through AVCaptureSession for Screen Recording.Now I want to record one mp4 video in that view which will play through AVPlayer.Screen Recording is working fine if I set some background color on that particular view but whenever I put video through AVPlayer, its not recording that video although screen records successfully but without mp4 video frame.
I'm using Screen Recording by https://github.com/alskipp/ASScreenRecorder.
Code for playing mp4 video through AVPlayer:
let fileURL = Bundle.main.url(forResource:"file_example_MP4_480_1_5MG", withExtension: "mp4")
let player = AVPlayer(url: fileURL!)
let playerLayer = AVPlayerLayer(player: player)
playerLayer.frame = viewToRecord.frame
viewToRecord.layer.addSublayer(playerLayer)
player.play()
In above code viewToRecord is the UIView which I need to record with mp4 video in Screen Recording.
Looking for best possible solutions!!!