This is my code:
self.playerView?.transform = CGAffineTransformMakeRotation(CGFloat(M_PI_2));
self.playerView?.setVideoGravity(AVLayerVideoGravityResizeAspectFill)
self.playerView?.setMovieToPlayer(mp)
First line to transform from portrait to landscape... mp is AVPlayer..
Storyboard pic and black color is the playerView
inside ViewController MainView
and the constraints are
trailing = Player View.trailing
Player View.bottom = Bottom Layout Guide.top
Player View.top = top
Player View.leading = leading
The output is: View is not Occupying the full screen but leaving some space at left and right
Somebody help please? Atleast Provide some tutorial...
This is because of AVLayerVideoGravityResizeAspectFill
that you specify when initialize your playerView
. According to docs :
AVLayerVideoGravityResizeAspectFill
Specifies that the player should preserve the video's aspect ratio and fill the layer's bounds.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.