JWPlayerView
@objcMembers
@MainActor
public class JWPlayerView : UIView, JWPlayerViewProtocol, ViewabilityHandlerDelegate
A view for displaying a player. It automatically handles enlarging the player to the size of this container view, and displaying the player.
-
Undocumented
Declaration
Swift
@MainActor public override static var layerClass: AnyClass { get } -
The player associated with the view.
Declaration
Swift
@MainActor public var player: JWPlayer { get } -
The delegate which will receive events related to the JWPlayerView.
Declaration
Swift
@MainActor public weak var delegate: JWPlayerViewDelegate? { get set } -
Declaration
Swift
@MainActor public var allowsPictureInPicturePlayback: Bool { get set } -
This is the currently utilized caption style for side-loaded captions.
What is set here is not necessarily what will be used. If a caption style is designated in a JSON configuration, the style in JSON will take priority. Furthermore, if the user’s accessibility settings do not allow specific settings to be overridden by the video, the user’s settings will take priority.
Declaration
Swift
@MainActor public var captionStyle: JWCaptionStyle? { get set } -
The amount of space to inset the captions from the edges of the player. The default value is 0.
Declaration
Swift
@MainActor public var captionInsets: UIEdgeInsets { get set } -
Declaration
Swift
@MainActor public var videoRect: CGRect { get } -
The picture in picture controller for the player.
Declaration
Swift
@MainActor public var pictureInPictureController: AVPictureInPictureController? { get } -
Indicates how to display the video content within the bounds of the view. The default value is
resizeAspect.Declaration
Swift
@MainActor public var videoGravity: JWVideoGravity { get set } -
Initializes and returns a newly allocated view object with the specified frame rectangle.
Declaration
Swift
@MainActor public override init(frame: CGRect)Parameters
frameThe frame rectangle for the view.
-
Whether the player automatically tears down its ad session when this view is removed from the screen (its window becomes
nil).Google IMA and DAI anchor their ad session on the global
NotificationCenter, which retains the whole player graph — including the contentAVPlayer— so if the view is removed without this teardown the player leaks and its audio can keep playing off-screen. The default (true) covers the common case where the player screen is popped or dismissed.Set this to
falsewhen the integration deliberately keeps a player alive while its view is detached — reusing player instances across recycled collection/table cells, or moving the view between containers — and take responsibility for tearing the player down (release it, or callstop()) when finished. Lefttrue, those setups lose the ad session (and any scheduled IMA/DAI ad breaks) each time the view leaves the screen.Note
This applies only while the view itself is alive. If the view is deallocated while an ad session is active, the session is always torn down regardless of this setting, since the ad SDK’s anchor would otherwise leak the whole player graph with no view left to reattach.Declaration
Swift
@MainActor public var automaticallyTearsDownAdSessionOnViewRemoval: Bool -
Undocumented
Declaration
Swift
@MainActor public override func didMoveToWindow() -
Undocumented
Declaration
Swift
@MainActor public override func didMoveToSuperview() -
Lays out subviews.
Declaration
Swift
@MainActor public override func layoutSubviews()