Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.
Carlos Corrêa da Silva edited this page Sep 11, 2019 · 20 revisions

Playback events

You can find public events on Events enum.

Name Description iOS tvOS
didUpdateBuffer Media buffer percentage updated.
didUpdatePosition Media position updated.
ready Player is ready for playback.
stalling Changed to STALLED state.
didFindAudio Audio source is available and ready.
didFindSubtitle Subtitle source is available and ready.
didSelectAudio Audio source was selected.
didSelectSubtitle Subtitle source was selected.
disableMediaControl Media control exhibition was disabled.
enableMediaControl Media control exhibition was enabled.
didComplete Media playback was completed.
willPlay Will change to PLAYING state.
playing Did change to PLAYING state.
willPause Will change to PAUSE state.
didPause Did change to PAUSE state.
willStop Will change to STOP state.
didStop Did change to STOP state.
willSeek Player will start a seek to a part of the video.
didSeek Player did seek to a part of the video.
didUpdateAirPlayStatus Did update Air Play external playback.
requestFullscreen Player is requesting to enter fullscreen.
exitFullscreen Player is requesting to exit fullscreen.
willUpdatePoster Will update poster image.
didUpdatePoster Did update poster image.
error Player or media error detected. userInfo can contain the error that caused the event.
didChangeDvrAvailability The current live media being played supports DVR
didChangeDvrStatus The current live media being played is using the DVR
didUpdateOptions The options has changed
didUpdateBitrate The bitrate was changed

How to use

Below there is an example that shows how to listen the player events

player.on(Event.playing) { userInfo in
    print("on Play")
}

Core events

Name Description iOS tvOS
willHideMediaControl Media control will be hide.
didHideMediaControl Media control is hidden.
willShowMediaControl Media control will be show.
didShowMediaControl Media control is visible.
willDestroy Player will be destroyed.
didDestroy Player was destroyed.
willChangeActiveContainer The active container will be changed.
didChangeActiveContainer The active container did change.
willChangeActivePlayback The active playback will be changed.
didChangeActivePlayback The active playback did change.
willEnterFullscreen Player will enter in fullscreen mode.
didEnterFullscreen Player did enter in fullscreen mode.
willExitFullscreen Player will exit fullscreen mode.
didExitFullscreen Player did exit fullscreen mode.
willShowModal A modal plugin will be displayed.
didShowModal A modal plugin is displayed.
willHideModal A modal plugin will be dismissed.
didHideModal A modal plugin is dismissed.
requestPadding A bottom padding at the bottom of MediaControl was requested.
showDrawerPlugin Request to show a drawer plugin.
willShowDrawerPlugin A drawer plugin will be displayed.
didShowDrawerPlugin A drawer plugin was displayed.
hideDrawerPlugin Request to hide a drawer plugin.
willHideDrawerPlugin A drawer plugin will be dismissed.
didHideDrawerPlugin A drawer plugin was dismissed.

Below there is an example that shows how to listen to core events

core.on(Event.didShowMediaControl.rawValue) { userInfo in
    print("didShowMediaControl")
}

Container events

Name Description iOS tvOS
willLoadSource The source will be loaded.
didLoadSource The source was loaded and the playback was created, but it does not mean that the video can be played.
didNotLoadSource The source could not be loaded and playback was not created.
willChangePlayback Playback will change.
didChangePlayback Playback did change.
didResize Container did resize.

Below there is an example that shows how to listen to container events

container.on(Event.didLoadSource.rawValue) { userInfo in
    print("didLoadSource")
}
Clone this wiki locally