Player
open class Player: UIViewController
▶️ Player, simple way to play and stream media
-
Player delegate.
Declaration
Swift
open weak var playerDelegate: PlayerDelegate?
-
Playback delegate.
Declaration
Swift
open weak var playbackDelegate: PlayerPlaybackDelegate?
-
Local or remote URL for the file asset to be played.
Declaration
Swift
open var url: URL?
Parameters
url
URL of the asset.
-
For setting up with AVAsset instead of URL Note: Resets URL (cannot set both)
Declaration
Swift
open var asset: AVAsset?
-
Specifies how the video is displayed within a player layer’s bounds. The default value is
AVLayerVideoGravityResizeAspect
. SeePlayerFillMode
.Declaration
Swift
open var fillMode: PlayerFillMode
-
Determines if the video should autoplay when a url is set
Declaration
Swift
open var autoplay: Bool = true
Parameters
bool
defaults to true
-
Mutes audio playback when true.
Declaration
Swift
open var muted: Bool
-
Volume for the player, ranging from 0.0 to 1.0 on a linear scale.
Declaration
Swift
open var volume: Float
-
Pauses playback automatically when resigning active.
Declaration
Swift
open var playbackPausesWhenResigningActive: Bool = true
-
Pauses playback automatically when backgrounded.
Declaration
Swift
open var playbackPausesWhenBackgrounded: Bool = true
-
Resumes playback when became active.
Declaration
Swift
open var playbackResumesWhenBecameActive: Bool = true
-
Resumes playback when entering foreground.
Declaration
Swift
open var playbackResumesWhenEnteringForeground: Bool = true
-
Playback automatically loops continuously when true.
Declaration
Swift
open var playbackLoops: Bool
-
Playback freezes on last frame frame at end when true.
Declaration
Swift
open var playbackFreezesAtEnd: Bool = false
-
Current playback state of the Player.
Declaration
Swift
open var playbackState: PlaybackState = .stopped
-
Current buffering state of the Player.
Declaration
Swift
open var bufferingState: BufferingState = .unknown
-
Playback buffering size in seconds.
Declaration
Swift
open var bufferSizeInSeconds: Double = 10
-
Playback is not automatically triggered from state changes when true.
Declaration
Swift
open var playbackEdgeTriggered: Bool = true
-
Maximum duration of playback.
Declaration
Swift
open var maximumDuration: TimeInterval
-
Media playback’s current time.
Declaration
Swift
open var currentTime: TimeInterval
-
The natural dimensions of the media.
Declaration
Swift
open var naturalSize: CGSize
-
self.view as PlayerView type
Declaration
Swift
public var playerView: PlayerView
-
Return the av player layer for consumption by things such as Picture in Picture
Declaration
Swift
open func playerLayer() -> AVPlayerLayer?
-
Undocumented
Declaration
Swift
open class Player: UIViewController
-
Indicates the desired limit of network bandwidth consumption for this item.
Declaration
Swift
open var preferredPeakBitRate: Double = 0
-
Indicates a preferred upper limit on the resolution of the video to be downloaded.
Declaration
Swift
open var preferredMaximumResolution: CGSize
-
Undocumented
Declaration
Swift
open class Player: UIViewController
-
Undocumented
Declaration
Swift
open class Player: UIViewController
-
Undocumented
Declaration
Swift
open class Player: UIViewController
-
Undocumented
Declaration
Swift
open class Player: UIViewController
-
Undocumented
Declaration
Swift
open class Player: UIViewController
-
Undocumented
Declaration
Swift
open class Player: UIViewController
-
Begins playback of the media from the beginning.
Declaration
Swift
open func playFromBeginning()
-
Begins playback of the media from the current time.
Declaration
Swift
open func playFromCurrentTime()
-
Pauses playback of the media.
Declaration
Swift
open func pause()
-
Stops playback of the media.
Declaration
Swift
open func stop()
-
Updates playback to the specified time.
Declaration
Swift
open func seek(to time: CMTime, completionHandler: ((Bool) -> Swift.Void)? = nil)
Parameters
time
The time to switch to move the playback.
completionHandler
Call block handler after seeking/
-
Updates the playback time to the specified time bound.
Declaration
Swift
open func seekToTime(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime, completionHandler: ((Bool) -> Swift.Void)? = nil)
Parameters
time
The time to switch to move the playback.
toleranceBefore
The tolerance allowed before time.
toleranceAfter
The tolerance allowed after time.
completionHandler
call block handler after seeking
-
Captures a snapshot of the current Player asset.
Declaration
Swift
open func takeSnapshot(completionHandler: ((_ image: UIImage?, _ error: Error?) -> Void)? )
Parameters
completionHandler
Returns a UIImage of the requested video frame. (Great for thumbnails!)