public class FlowplayerLifecycleObserver
Fragments and Activities in Support Library 26.1.0 and later implement the androidx.lifecycle.LifecycleOwner.
Fragments/activities that fall into this category and use class FlowplayerView
instead of either class FlowplayerFragment
or class FlowplayerSupportFragment
, can easily bind the player to their lifecycle by calling FlowplayerLifecycleObserver.registerLifecycle
.
This way the player will automatically listen to the activity's/fragment's lifecycle methods without having to manually call the player's lifecycle methods (onPause, onResume, etc).
It is recommend to use class FlowplayerSupportFragment
or class FlowplayerFragment
instead of class FlowplayerView
when possible, in order to automatically handle not only lifecycle events but also orientation changes.
Modifier and Type | Field and Description |
---|---|
static FlowplayerLifecycleObserver |
INSTANCE
Fragments and Activities in Support Library 26.1.0 and later implement the androidx.lifecycle.LifecycleOwner.
Fragments/activities that fall into this category and use
class FlowplayerView instead of either class FlowplayerFragment
or class FlowplayerSupportFragment , can easily bind the player to their lifecycle by calling FlowplayerLifecycleObserver.registerLifecycle .
This way the player will automatically listen to the activity's/fragment's lifecycle methods without having to manually call the player's lifecycle methods (onPause, onResume, etc). |
Modifier and Type | Method and Description |
---|---|
void |
registerLifecycle(androidx.lifecycle.Lifecycle lifecycle)
This method will add the player as an observer to the activity's/fragment's lifecycle.
|
public static FlowplayerLifecycleObserver INSTANCE
Fragments and Activities in Support Library 26.1.0 and later implement the androidx.lifecycle.LifecycleOwner.
Fragments/activities that fall into this category and use class FlowplayerView
instead of either class FlowplayerFragment
or class FlowplayerSupportFragment
, can easily bind the player to their lifecycle by calling FlowplayerLifecycleObserver.registerLifecycle
.
This way the player will automatically listen to the activity's/fragment's lifecycle methods without having to manually call the player's lifecycle methods (onPause, onResume, etc).
It is recommend to use class FlowplayerSupportFragment
or class FlowplayerFragment
instead of class FlowplayerView
when possible, in order to automatically handle not only lifecycle events but also orientation changes.