VideoPlayerView

@interface VideoPlayerView : UIView

A UIView sub-class encapsulating a native video player instance (AVPlayer)

  • this UIView’s AVPlayer video player instance

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) AVPlayer *player;

    Swift

    var player: AVPlayer! { get set }
  • this player’s parent view

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) UIView *parentView;

    Swift

    var parentView: UnsafeMutablePointer
  • initialise this video player view with a frame.

    Declaration

    Objective-C

    - (id)initWithFrame:(CGRect)frame;

    Swift

    init!(frame: CGRect)

    Parameters

    frame

    A particular frame where view will be displayed.

    Return Value

    VideoPlayerView instance.

  • initialise and add this video player as a subview to a parent UIView instance.

    Declaration

    Objective-C

    - (id)initWithParentView:(UIView *)parentUIView;

    Swift

    init!(parentView parentUIView: Any!)

    Parameters

    parentUIView

    a UIView within which to show video player.

    Return Value

    VideoPlayerView instance.

  • Specifies how the video is displayed within the view-frame bounds.

    Declaration

    Objective-C

    - (void)setVideoFillMode:(NSString *)fillMode;

    Swift

    func setVideoFillMode(_ fillMode: String!)

    Parameters

    fillMode

    constants such as AVLayerVideoGravityResizeAspect, AVLayerVideoGravityResizeAspectFill, and AVLayerVideoGravityResize. The default value is AVLayerVideoGravityResizeAspect.