BMPPlayerView
Objective-C
@interface BMPPlayerView
: UIView <BMPUserInterfaceApi, BMPUserInterfaceEventHandler>
Swift
class PlayerView : UIView, UserInterfaceApi, UserInterfaceEventHandler
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, or using the
according property if the view is created using the interface builder.
@discussion
If you are composing the view via the interface builder make sure you use the obj-c class name BMPPlayerView
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
}
}
-
Undocumented
Declaration
Objective-C
@property (nullable, nonatomic, strong) id<BMPPlayer>playerSwift
var player: Player? { get set } -
Get/set a fullscreen handler for this
PlayerView. See the documentation of theFullscreenHandlerfor more information.Declaration
Objective-C
@property (nonatomic, weak) id<BMPFullscreenHandler> _Nullable fullscreenHandler;Swift
weak var fullscreenHandler: FullscreenHandler? { get set } -
Creates a new instance of the
PlayerView.Declaration
Objective-C
- (nonnull instancetype)initWithPlayer:(nonnull id<BMPPlayer>)player frame:(CGRect)frame;Swift
init(player: Player, frame: CGRect)Parameters
playerThe
Playerinstance which will be associated with thisPlayerViewinstanceframeThe
CGRectwhich will be passed to theUIViewinitializer -
When the hosting App supports more
UIDeviceOrientationthis method should be called before the view will rotate.Note
This can be implemented inside the
viewWillTransitionmethod.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
Objective-C
- (void)willRotate;Swift
func willRotate() -
When the hosting App supports more
UIDeviceOrientationthis method should be called after the view rotated.Note
This can be implemented inside the
viewWillTransitionmethod.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
Objective-C
- (void)didRotate;Swift
func didRotate()
BMPPlayerView Class Reference