Search code examples
iosobjective-cavplayeravplayerlayer

AVPlayer not showing FullScreen


I am working on playing a recorded video recorded by AVCapture.I am saving the video URL in string named outputFileURL. I tried playing back the video using AVPlayerLayer concept. The code I used is

AVPlayer *avPlayerq = [AVPlayer playerWithURL:outputFileURL];
avPlayerq.actionAtItemEnd = AVPlayerActionAtItemEndNone;
AVPlayerLayer *videoLayer = [AVPlayerLayer playerLayerWithPlayer:avPlayerq];
videoLayer.frame= self.view.bounds;

[self.view.layer addSublayer:videoLayer];
[avPlayerq play];

But the video I am getting is not full screen. Can anyone can help me to solve?


Solution

  • I added the following code and I am able to get the full screen.

    videoLayer.videoGravity=AVLayerVideoGravityResizeAspectFill;
    

    Hope this may help.