Listening to player events

In order to listen to playback and player related events you have to make your ViewController to implement the FPFlowplayerDelegate protocol and then add the delegates to the FPFlowplayer.

Example

class ViewController: UIViewController, FPFlowplayerDelegate {

    let flowplayer: FPFlowplayer!

    override func viewDidLoad() {
        super.viewDidLoad()

        ...

        flowplayer.delegate = self
    }
}

FPFlowplayerDelegate events

All the available callback and events that FPFlowplayerDelegate supports.

    /**
    This callback is called when the player is in a idle state.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPIdleEvent__.
    */
    func onIdle(event: FPIdleEvent)

    /**
    This callback is called when the player has loaded
    the provided media item and is ready to be played.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPReadyEvent__.
    */
    func onReady(event: FPReadyEvent)

    /**
    This callback is called when the player start / resumes media playback.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPPlayEvent__.
    */
    func onPlay(event: FPPlayEvent)

    /**
    This callback is called when the player pauses the media playback.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPPauseEvent__.
    */
    func onPause(event: FPPauseEvent)

    /**
    This callback is called when the player in a buffered state,
    indicating that the provided media item is loading or being fetched.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPBufferEvent__.
    */
    func onBuffer(event: FPBufferEvent)

    /**
    This callback is called when the player has finished
    the media playback.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPCompleteEvent__.
    */
    func onComplete(event: FPCompleteEvent)

    /**
    Called when the player has been muted. This callback can be triggered by the
    *mute(_:)* method of __FPFlowplayer__ or by the mute button on the Apple TV remote.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPMuteEvent__.
    */
    func onMute(event: FPMuteEvent)

    /**
    Called when the player's sound volume changes. This callback can be triggered by
    the *setVolume(_:)* method of __FPFlowplayer__ or by the volume buttons on the Apple TV remote.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPVolumeEvent__.
    */
    func onVolume(event: FPVolumeEvent)

    /**
    Called when the media playback rate / speed changes. This callback can be triggered by
    the *setSpeed(_:)* method of __FPFlowplayer__.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPSpeedEvent__.
    */
    func onSpeed(event: FPSpeedEvent)

    /**
    This callback is called when the audio assets have been fetched
    and loaded for the current media item.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPAudioTracksEvent__.
    */
    func onAudioTracksLoaded(event: FPAudioTracksEvent)

    /**
    Called when the audio for the current media playback has changed.
    - Parameter event: The payload of the event.
    - Callback for __FPAudioTrackSelectEvent__.
    */
    func onAudioTrackSelect(event: FPAudioTrackSelectEvent)

    /**
    Called when the subtitle of the current media playback has changed.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPSubtitleTrackSelectEvent__.
    */
    func onSubtitleTrackSelect(event: FPSubtitleTrackSelectEvent)

    /**
    This callback is called when the subtitle assets have been fetched
    and loaded for the current media item.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPSubtitleTracksEvent__.
    */
    func onSubtitleTracksLoaded(event: FPSubtitleTracksEvent)

    /**
    This callback will be only triggered for __FPFlowplayerMedia__ media item.
    Will return all `Flowplayer` metadata for the current media item.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPOvpMetadataEvent__.
    */
    func onOvpMetadata(event: FPOvpMetadataEvent)

    /**
    Triggered when a player or media  error occurs.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPErrorEvent__.
    */
    func onError(event: FPErrorEvent)

    /**
    Triggered when an ad break started.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPAdBreakStartEvent__.
    */
    func onAdBreakStart(event: FPAdBreakStartEvent)

    /**
    Triggered when an ad break has completed.
    - Parameter event: The payload of the event.
    - Note: Callback for__FPAdBreakCompleteEvent__.
    */
    func onAdBreakComplete(event: FPAdBreakCompleteEvent)

    /**
    Triggered when an single ad has started.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPAdStartEvent__.
    */
    func onAdStart(event: FPAdStartEvent)

    /**
    Triggered when an single ad pauses.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPAdPauseEvent__.
    */
    func onAdPause(event: FPAdPauseEvent)

    /**
    Triggered when an single ad resumes.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPAdResumeEvent__.
    */
    func onAdResume(event: FPAdResumeEvent)

    /**
    Triggered when the user clicks on an ad.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPAdClickEvent__.
    */
    func onAdClick(event: FPAdClickEvent)

    /**
    Triggered when an user skips an ad.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPAdSkipEvent__.
    */
    func onAdSkip(event: FPAdSkipEvent)

    /**
    Triggered when a single ad has completed.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPAdCompleteEvent__.
    */
    func onAdComplete(event: FPAdCompleteEvent)

    /**
    Triggered when an error occurs with an ad.
    - Parameter event: The payload of the event.
    - Note: Callback for __FPAdErrorEvent__.
    */
    func onAdError(event: FPAdErrorEvent)
Results