In order to make your player listen to playback / player events you need to create a class that will implement the EventListener interface of the respective event. Then you create an instance of this class and pass it to the player:
In this example we are inheriting our Activity from FlowplayerFragment. The activity will then listen to the OnCompleteEvent and seek the player back to the beginning of the video and resume playback.
class MyActivity : FlowplayerFragment, OnCompleteListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Obtain playerFragment (from XML or programmatically)
// Check the "Creating player instance documentation" for more information
getPlayerFragment().getPlayer().addEventListener(this)
}
override fun onComplete(event: CompleteEvent) {
// We want to listen to the complete event and seek to beginning to loop the content
val player = getPlayerFragment().getPlayer()
player.seek(0) // Seek to beginning
player.play() // Resume playback
}
}