PlayerView
@available(iOS 14.0, tvOS 14.0, *)
@MainActor
@objcMembers
@objc(BMPPlayerView)
open class PlayerView : UIView
extension PlayerView: UIScrollViewDelegate
extension PlayerView: UserInterfaceApi
extension PlayerView: UserInterfaceEventHandler
extension PlayerView: _PlayerListenerInternal
A view that provides the Bitmovin Player UI and default UI handling to an attached Player
instance.
This view needs a Player
instance to work properly. This Player can be passed to the initializer.
If a custom UI is preferred, an AVPlayerLayer
or an AVPlayerViewController
can be registered via
registerPlayerLayer
/ registerPlayerViewController
. See PlayerView
for more details.
// Create a subclass of UIView
class CustomView: UIView {
init(player: Player, frame: CGRect) {
super.init(frame: frame)
// register the AVPlayerLayer of this view to the Player
player.register(playerLayer)
}
var playerLayer: AVPlayerLayer {
layer as! AVPlayerLayer
}
override class var layerClass: AnyClass {
AVPlayerLayer.self
}
}
-
Declaration
Swift
@MainActor public var player: Player? { get set }
-
Get/set a fullscreen handler for this
PlayerView
. See the documentation of theFullscreenHandler
for more information.Declaration
Swift
@MainActor public weak var fullscreenHandler: FullscreenHandler? { get set }
-
The
SystemUiApi
for interactions regarding the system UI. Using this API just has an effect ifuserInterfaceType
inStyleConfig
is set to.system
. This is the default value on tvOS, on iOS it has to be set specifically.Declaration
Swift
@MainActor public private(set) var systemUi: SystemUiApi? { get }
-
The
PictureInPictureApi
for interactions regarding picture in picture feature. Using this API just has an effect ifpictureInPicture
is enabled. Isnil
ifpictureInPicture
is not enabled.Declaration
Swift
@MainActor public private(set) var pictureInPicture: PictureInPictureApi? { get }
-
The
PlayerViewEventsApi
for interactions regarding event publishers. This API is only available for usage from Swift.Declaration
Swift
@MainActor public let events: PlayerViewEventsApi
-
Creates a new instance of the
PlayerView
.Declaration
Swift
@MainActor public init( player: Player, frame: CGRect )
Parameters
player
The
Player
instance which will be associated with thisPlayerView
instanceframe
The
CGRect
which will be passed to theUIView
initializer -
Creates a new instance of the
PlayerView
.Declaration
Swift
@MainActor public init( player: Player, frame: CGRect, playerViewConfig: PlayerViewConfig )
Parameters
player
The
Player
instance which will be associated with thisPlayerView
instanceframe
The
CGRect
which will be passed to theUIView
initializerplayerViewConfig
A configuration object for the
PlayerView
instance -
Declaration
Swift
@MainActor override public func didMoveToSuperview()
-
When the hosting App supports more
UIDeviceOrientation
s this method should be called before the view will rotate.This can be implemented inside the
viewWillTransition
method.override func viewWillTransition( to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator ) { playerView.willRotate() coordinator.animate( alongsideTransition: { _ in // ... }, completion: { _ in playerView.didRotate() } ) super.viewWillTransition(to: size, with: coordinator) }
Declaration
Swift
@MainActor public func willRotate()
-
When the hosting App supports more
UIDeviceOrientation
s this method should be called after the view rotated.This can be implemented inside the
viewWillTransition
method.override func viewWillTransition( to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator ) { playerView.willRotate() coordinator.animate( alongsideTransition: { _ in // ... }, completion: { _ in playerView.didRotate() } ) super.viewWillTransition(to: size, with: coordinator) }
Declaration
Swift
@MainActor public func didRotate()
-
Declaration
Swift
@MainActor public func viewForZooming(in scrollView: UIScrollView) -> UIView?
-
Declaration
Swift
@MainActor public func scrollViewShouldScrollToTop(_ scrollView: UIScrollView) -> Bool
-
Declaration
Swift
@MainActor public var isFullscreen: Bool { get }
-
Declaration
Swift
@MainActor public var areControlsShown: Bool { get }
-
Declaration
Swift
@MainActor public var isPictureInPictureAvailable: Bool { get }
-
Declaration
Swift
@MainActor public var isPictureInPicture: Bool { get }
-
Declaration
Swift
@MainActor public var scalingMode: ScalingMode { get set }
-
Declaration
Swift
@MainActor public func enterPictureInPicture()
-
Declaration
Swift
@MainActor public func exitPictureInPicture()
-
Declaration
Swift
@MainActor public func enterFullscreen()
-
Declaration
Swift
@MainActor public func exitFullscreen()
-
Declaration
Swift
@MainActor public func setPosterImage(url: URL, keepPersistent: Bool)
-
Declaration
Swift
@MainActor public func setSubtitleStyles(_ subtitleStyles: [AVTextStyleRule]?)
-
Declaration
Swift
@MainActor public func add(listener: UserInterfaceListener)
-
Declaration
Swift
@MainActor public func remove(listener: UserInterfaceListener)
-
Declaration
Swift
@available(tvOS, unavailable) public func onCastWaiting( forDevice event: CastWaitingForDeviceEvent, player: Player )
-
Declaration
Swift
public func onInternalAdPlaybackDidRequestContentPause( _ event: _InternalAdPlaybackDidRequestContentPauseEvent, player: Player )
-
Declaration
Swift
public func onInternalAdPlaybackDidRequestContentResume( _ event: _InternalAdPlaybackDidRequestContentResumeEvent, player: Player )
-
Declaration
Swift
public func onStallStarted(_ event: StallStartedEvent, player: Player)
-
Declaration
Swift
public func onStallEnded(_ event: StallEndedEvent, player: Player)
-
Declaration
Swift
public func onPlayerInactive(_ event: PlayerInactiveEvent, player: Player)
-
Declaration
Swift
public func onAdStarted(_ event: AdStartedEvent, player: Player)
-