FPFlowplayer

@objc
public protocol FPFlowplayer

Flowplayer’s skeleton. This protocol contains all the public functions of the player.

  • Prepares the player with a FPFlowplayerVideo.

    Declaration

    Swift

    func prepare(flowplayerMedia: FPFlowplayerMedia, autoStart: Bool)

    Parameters

    flowplayerMedia

    Contains information about the media to be played.

    autoStart

    If true, the playback will start automatically as soon as the player is prepared. The default is true.

  • Prepares the player with a FPExternalVideo.

    Declaration

    Swift

    func prepare(externalMedia: FPExternalMedia, autoStart: Bool)

    Parameters

    externalMedia

    Contains information about the media to be played.

    autoStart

    If true, the playback will start automatically as soon as the player is prepared. The default is true.

  • If the player was previously prepared but the playback has stopped unexpected, calling this method will try to prepare the player again with the previously specified video.

    Declaration

    Swift

    @discardableResult
    func reload() -> Bool

    Return Value

    True if there was a media to reload. False, otherwise.

  • Tells the player to start the playback.

    Declaration

    Swift

    func play()
  • Tells the player to pause the playback.

    Declaration

    Swift

    func pause()
  • Tells the player to stop the playback. This will reset the player and in order to start playback again, the player needs to be again prepared.

    Declaration

    Swift

    func stop()
  • Tells the player to mute or unmute.

    Declaration

    Swift

    func mute(_ state: Bool)

    Parameters

    state

    True to mute the player, false to bring it back to the system volume.

  • Sets the player ‘s volume level

    Declaration

    Swift

    func setVolume(_ volume: Float)

    Parameters

    volume

    Volume level in scale 0.0f - 1.0f.

  • Returns the player’s current playback state.

    Declaration

    Swift

    func getPlaybackState() -> FPFlowplayerState

    Return Value

    The player’s playback state.

  • Returns the player’s current position (in seconds).

    Declaration

    Swift

    func getCurrentPosition() -> Int64

    Return Value

    The player’s position in seconds.

  • Returns the current media’s duration (in seconds).

    Declaration

    Swift

    func getDuration() -> Int64

    Return Value

    The duration in seconds

  • Tells the player to seek to a new position.

    Declaration

    Swift

    func seek(_ position: Int64)

    Parameters

    position

    The position (in seconds) to which the player should seek.

  • Toggles the player’s fullscreen state. The result is also affected by whether *setFullscreenControlOrientation()is set to true (by default it is true). If *setFullscreenControlOrientation()is set to true and *setFullscreen()is called, then the device’s orientation will automatically change to landscape for fullscreen and to portrait for non-fullscreen. If *setFullscreenControlOrientation()is set to false, then the device’s orientation will not be affected by the player’s fullscreen state changes.

    Declaration

    Swift

    func setFullscreen(_ fullscreen: Bool)

    Parameters

    fullscreen

    True to enter fullscreen, false to exit.

  • Returns the player’s fullscreen state.

    Declaration

    Swift

    func isFullscreen() -> Bool

    Return Value

    True if the player is currently in fullscreen. False, otherwise.

  • Sets the playback speed.

    Declaration

    Swift

    func setSpeed(_ speed: Float)

    Parameters

    speed

    The new playback speed. A value of 0.0 pauses the playback while a value of 1.0 plays the current item at its natural speed. Similarly, a value of 2.0 plays the current item at x2 its natural speed.

  • Tells the player whether or not toggling the fullscreen state should also change the device’s orientation.

    Declaration

    Swift

    func setFullscreenControlOrientation(_ controlOrientation: Bool)

    Parameters

    controlOrientation

    If true, the device will be rotated to landscape every time the player enters fullscreen and to portrait every time the player exits fullscreen. If set to false, the device’s orientation will not be affected by the player’s fullscreen state. The default value is true.

  • Whether or not the player’s fullscreen state dictates the device’s orientation.

    Declaration

    Swift

    func isFullscreenControllOrientation() -> Bool

    Return Value

    True if the player’s fullscreen state controls the device’s orientation (ie. if the device always enters landscape for fullscreen and portrait for non-fullscreen). False, otherwise.

  • Tells the player whether or not it should use the built-in controls

    Note

    Showing the controls after they have already been hidden may lead to unexpected results.

    Declaration

    Swift

    func setUseControls(_ useControls: Bool)

    Parameters

    useControls

    If true, the player will use the built-in controls. Otherwise, no controls will be shown automatically. The default value is true.

  • Whether or not the player uses the built-in controls. The default value is true.

    Declaration

    Swift

    func getUseControls() -> Bool

    Return Value

    True if the player is set to use the built-in controls. False, otherwise.

  • Whether or not the content has paused and ads are currently shown, regardless of whether or not the ads are actually playing or are paused.

    Declaration

    Swift

    func isShowingAds() -> Bool

    Return Value

    True if ads are shown, false otherwise.

  • Adds an event delegate.

    Declaration

    Swift

    func addPlayerDelegate(_ delegate: FPFlowplayerDelegate)

    Parameters

    delegate

    The delegate that will handle player events.

  • Removes an event delegate.

    Declaration

    Swift

    func removePlayerDelegate(_ delegate: FPFlowplayerDelegate)

    Parameters

    delegate

    The delegate to remove.