A value that defines how the video is displayed within a layer’s bounds rectangle.
SDKs
- iOS 11.0+
- macOS 10.13+
- Mac Catalyst 13.0+
- tvOS 11.0+
- watchOS 6.0+
Framework
- AVFoundation
Declaration
typedef NSString *AVLayerVideoGravity;
A value that defines how the video is displayed within a layer’s bounds rectangle.
SDKs
Framework
typedef NSString *AVLayerVideoGravity;
AVLayer Video Gravity Resize
The video should be stretched to fill the layer’s bounds.
AVLayer Video Gravity Resize Aspect
The player should preserve the video’s aspect ratio and fit the video within the layer’s bounds.
AVLayer Video Gravity Resize Aspect Fill
The player should preserve the video’s aspect ratio and fill the layer’s bounds.
player
The player for which the player layer displays visual output.
ready For Display
A Boolean value that indicates whether the first video frame has been made ready for display for the current item of the associated player.
video Gravity
A value that specifies how the video is displayed within a player layer’s bounds.
video Rect
The current size and position of the video image as displayed within the receiver's bounds.
pixel Buffer Attributes
The client requirements for the visual output displayed in the player layer during playback.
AVMake Rect With Aspect Ratio Inside Rect
Returns a scaled rectangle that maintains the specified aspect ratio within a bounding rectangle.