JWCinematicViewController
@objcMembers
open class JWCinematicViewController: UIViewController,
AVPictureInPictureControllerDelegate,
JWAccessLogMetadataDelegate,
JWAdDelegate,
JWAirPlayDelegate,
JWAVDelegate,
JWDateRangeMetadataDelegate,
JWExternalMetadataDelegate,
JWID3MetadataDelegate,
JWMediaMetadataDelegate,
JWPlayerDelegate,
JWPlayerStateDelegate,
JWPlayerViewDelegate,
JWProgramDateTimeMetadataDelegate,
JWTimeEventListener,
JWRelatedEventDelegate,
JWChaptersDelegate
This view controller creates a sleek, minimalist interface more consistent with a cinematic experience akin to what you would see for viewing movies and long media.
Note
The view created by this controller is intended for full screen use only.-
The player instance.
Declaration
Swift
public var player: JWPlayerProtocol { get }
-
The view displaying the video content.
Declaration
Swift
public var playerView: JWPlayerViewProtocol { get }
-
A delegate receiving state changes from the view controller.
Declaration
Swift
public weak var delegate: JWPlayerCinematicViewControllerDelegate?
-
Enables the lock screen controls to be synchronized with this player. The default is
true
.Declaration
Swift
public var enableLockScreenControls: Bool { get set }
-
Available playback rates.
This property is automatically sorted. If an empty array is specified, 1.0 becomes the only available option. Rates must be greater than 0 and less than or equal to 4.0. Invalid rates are removed from the array.
The default rates are: [0.5, 1.0, 1.25, 1.5, 2.0]
Declaration
Swift
public var playbackRates: [Double] { get set }
-
The number of seconds to wait when fading the interface. The default is 3 seconds.
Note
This only applies wheninterfaceBehavior
is .normal.Declaration
Swift
public var interfaceFadeDelay: TimeInterval { get set }
-
The poster image to display when there is no Internet connection. By default, it displays the poster image of the current video.
Declaration
Swift
public var offlinePosterImage: UIImage? { get set }
-
The message to display when the internet connection is lost.
Note
The default value is “This video cannot be played because of a problem with your internet connection.” which corresponds to the localizable stringjwplayer_errors_bad_connection
.Declaration
Swift
public var offlineMessage: String { get set }
-
The desc the player is initialized with for the ad interface.
Declaration
Swift
public var adInterfaceStyle: JWAdInterfaceStyle { get set }
-
A Boolean value that determines whether the player view allows Picture in Picture playback.
Note
By default, this is value is true.Attention
canStartPictureInPictureAutomaticallyFromInline
is not set to true when enabling this property, Picture-in-Picture mode should only be expected to be initiated when using the UI button designated for this.Declaration
Swift
public var allowsPictureInPicturePlayback: Bool { get set }
-
Sets a custom logo to display on the player.
Declaration
Swift
public var logo: JWLogo? { get set }
-
The behavior desired for the interface. By default, this is .normal.
Declaration
Swift
public var interfaceBehavior: JWInterfaceBehavior { get set }
-
The style defining the Next Up card and its behavior.
Note
If nil is set no Next Up card will be displayed.Declaration
Swift
public var nextUpStyle: JWNextUpStyle? { get set }
-
Undocumented
Declaration
Swift
public init()
-
Undocumented
Declaration
Swift
public required init?(coder aDecoder: NSCoder)
-
Undocumented
Declaration
Swift
open override func viewDidLoad()
-
Sets the font of a group of labels on the player.
Declaration
Swift
public func setFont(_ font: UIFont?, labels: [JWLabelType])
Parameters
font
The font to set the labels to. If
nil
, the default is used.labels
The labels to set the font of.
-
Sets the font of a label on the player.
Declaration
Swift
public func setFont(_ font: UIFont?, label: JWLabelType)
Parameters
font
The font to set the label to. If
nil
, the default is used.label
The label to set the font of.
-
Sets the text color of a group of labels on the player.
Declaration
Swift
public func setTextColor(_ color: UIColor?, labels: [JWLabelType])
Parameters
color
The color to set the labels’ text color to.
labels
The labels to set the text color of.
-
Sets the text color of a label on the player.
Declaration
Swift
public func setTextColor(_ color: UIColor?, label: JWLabelType)
Parameters
color
The color to set the label’s text color to.
label
The label to set the text color of.
-
Sets the font of a group of buttons on the player.
Declaration
Swift
public func setFont(_ font: UIFont?, forState state: UIControl.State, buttons: [JWButtonType])
Parameters
font
The font to set the buttons to. If
nil
, the default is used.state
The state for the font to be applied to.
buttons
The buttons to set the font of.
-
Sets the font of a button on the player.
Declaration
Swift
public func setFont(_ font: UIFont?, forState state: UIControl.State, button: JWButtonType)
Parameters
font
The font to set the button to. If
nil
, the default is used.state
The state for the font to be applied to.
button
The button to set the font of.
-
Sets the title color of a group of buttons on the player.
Declaration
Swift
public func setTitleColor(_ color: UIColor?, forState state: UIControl.State, buttons: [JWButtonType])
Parameters
color
The color to set the buttons’ title color to.
state
The state for the color to be applied to.
buttons
The buttons to set the title color of.
-
Sets the title color of a button on the player.
Declaration
Swift
public func setTitleColor(_ color: UIColor?, forState state: UIControl.State, button: JWButtonType)
Parameters
color
The color to set the button’s title color to.
state
The state for the color to be applied to.
button
The button to set the title color of.
-
Sets the tint color of a group of buttons on the player.
Declaration
Swift
public func setTintColor(_ color: UIColor?, buttons: [JWButtonType])
Parameters
color
The color to set the buttons’ color to. If
nil
, the default is used.buttons
The buttons to set the tint color of.
-
Sets the tint color of a button on the player.
Declaration
Swift
public func setTintColor(_ color: UIColor?, button: JWButtonType)
Parameters
color
The color to set the button’s color to. If
nil
, the default is used.button
The button to set the tint color of.
-
Sets the background color of a group of views on the player.
Declaration
Swift
public func setBackgroundColor(_ color: UIColor?, views: [JWViewType])
Parameters
color
The color to set the views’ background color to. If
nil
, the default is used.views
The views to set the background color of.
-
Sets the background color of a view on the player.
Declaration
Swift
public func setBackgroundColor(_ color: UIColor?, view: JWViewType)
Parameters
color
The color to set the view’s background color to. If
nil
, the default is used.view
The view to set the background color of.
-
Called after the view controller is added or removed from a container view controller. For more information, refer to
UIViewController
documentation.Declaration
Swift
open override func didMove(toParent parent: UIViewController?)
Parameters
parent
The parent view controller, or nil if there is no parent.
-
Declaration
Swift
open func playerView(_ view: JWPlayerView, sizeChangedFrom oldSize: CGSize, to newSize: CGSize)
-
Undocumented
Declaration
Swift
open func controlBarVisibilityChanged(isVisible: Bool)
-
Declaration
Swift
open func jwplayerIsReady(_ player: JWPlayer)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, failedWithError code: UInt, message: String)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, failedWithSetupError code: UInt, message: String)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, encounteredWarning code: UInt, message: String)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, encounteredAdWarning code: UInt, message: String)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, encounteredAdError code: UInt, message: String)
-
Declaration
Swift
open func jwplayerContentWillComplete(_ player: JWPlayer)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, willPlayWithReason reason: JWPlayReason)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, isBufferingWithReason reason: JWBufferReason)
-
Declaration
Swift
open func jwplayerContentIsBuffering(_ player: JWPlayer)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, updatedBuffer percent: Double, position time: JWTimeData)
-
Declaration
Swift
open func jwplayerContentDidComplete(_ player: JWPlayer)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, didFinishLoadingWithTime loadTime: TimeInterval)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, isPlayingWithReason reason: JWPlayReason)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, isAttemptingToPlay playlistItem: JWPlayerItem, reason: JWPlayReason)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, didPauseWithReason reason: JWPauseReason)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, didBecomeIdleWithReason reason: JWIdleReason)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, isVisible: Bool)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, didLoadPlaylist playlist: [JWPlayerItem])
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, didLoadPlaylistItem item: JWPlayerItem, at index: UInt)
-
Declaration
Swift
open func jwplayerPlaylistHasCompleted(_ player: JWPlayer)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, usesMediaType type: JWMediaType)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, seekedFrom oldPosition: TimeInterval, to newPosition: TimeInterval)
-
Declaration
Swift
open func jwplayerHasSeeked(_ player: JWPlayer)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, playbackRateChangedTo rate: Double, at time: TimeInterval)
-
Declaration
Swift
@available(tvOS 14, *) @available(iOS, unavailable) open func jwplayer(_ player: JWPlayer, enteredSkippableRange range: JWSkippableTimeRange)
-
Declaration
Swift
open func onMediaTimeEvent(_ time: JWTimeData)
-
Declaration
Swift
open func onAdTimeEvent(_ time: JWTimeData)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, audioTracksUpdated levels: [JWMediaSelectionOption])
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, audioTrackChanged currentLevel: Int)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, qualityLevelsUpdated levels: [JWVideoSource])
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, qualityLevelChanged currentLevel: Int)
-
Declaration
Swift
public func jwplayer(_ player: JWPlayer, visualQualityChanged currentVisualQuality: JWVisualQuality)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, updatedCaptionList options: [JWMediaSelectionOption])
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, captionTrackChanged index: Int)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, captionPresented caption: [String], at time: JWTimeData)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, airPlayStatusChanged status: JWAirPlayStatus)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, didReceiveMediaMetadata metadata: JWMediaMetadata)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, didReceiveAccessLogMetadata metadata: JWAccessLogMetadata)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, dateRangeMetadataCueParsed metadata: JWDateRangeMetadata)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, dateRangeMetadata metadata: JWDateRangeMetadata)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, id3Metadata metadata: JWID3Metadata)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, externalMetadataCueParsed metadata: JWExternalMetadata)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, externalMetadata metadata: JWExternalMetadata)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, programDateTimeMetadataCueParsed metadata: JWProgramDateTimeMetadata)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, programDateTimeMetadata metadata: JWProgramDateTimeMetadata)
-
Tells the delegate when Picture in Picture is about to start.
Declaration
Swift
open func pictureInPictureControllerWillStartPictureInPicture(_ pictureInPictureController: AVPictureInPictureController)
Parameters
pictureInPictureController
The Picture in Picture controller to which you’ve assigned the delegate.
-
Tells the delegate that Picture in Picture playback has started.
Declaration
Swift
open func pictureInPictureControllerDidStartPictureInPicture(_ pictureInPictureController: AVPictureInPictureController)
Parameters
pictureInPictureController
The Picture in Picture controller to which you’ve assigned the delegate.
-
Tells the delegate when Picture in Picture is about to stop.
Declaration
Swift
open func pictureInPictureControllerWillStopPictureInPicture(_ pictureInPictureController: AVPictureInPictureController)
Parameters
pictureInPictureController
The Picture in Picture controller to which you’ve assigned the delegate.
-
Tells the delegate when Picture in Picture playback stops.
Declaration
Swift
open func pictureInPictureControllerDidStopPictureInPicture(_ pictureInPictureController: AVPictureInPictureController)
Parameters
pictureInPictureController
The Picture in Picture controller to which you’ve assigned the delegate.
-
Tells the delegate when Picture in Picture is about to stop, to give your app an opportunity to restore its video playback user interface.
Note
Make sure to call the completion handler when you have restored the UI, it is important to notify the system of this.Declaration
Swift
open func pictureInPictureController(_ pictureInPictureController: AVPictureInPictureController, restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: @escaping (Bool) -> Void)
Parameters
pictureInPictureController
The Picture in Picture controller to which you’ve assigned the delegate.
completionHandler
To allow the system to finish restoring your user interface, you must call the completion handler with a value of
true
. -
Tells the delegate whether Picture in Picture failed to start.
Declaration
Swift
open func pictureInPictureController(_ pictureInPictureController: AVPictureInPictureController, failedToStartPictureInPictureWithError error: Error)
Parameters
pictureInPictureController
The Picture in Picture controller to which you’ve assigned the delegate.
error
An error describing why Picture in Picture failed to start.
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, loadedNextUpItem item: JWPlayerItem)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, relatedItemBeganPlaying item: JWPlayerItem, atIndex index: Int, withMethod method: JWRelatedMethod)
-
Declaration
Swift
open func jwplayer(_ player: JWPlayer, loadedRelatedPlaylist playlist: [JWPlayerItem])