Class MultiControllerPlaylist.AbstractPlaylistListener
- All Implemented Interfaces:
MultiControllerPlaylist.PlaylistListener
- Enclosing class:
MultiControllerPlaylist
MultiControllerPlaylist.PlaylistListener
.
All methods of the the MultiControllerPlaylist.PlaylistListener
are implemented with empty bodies and you
can extend this class if you only need to implement a subset of the callbacks. Using this
abstract class instead of the interface might also simplify updates of the API.
- Since:
- 4.2.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
onControllerCreate
(PlayerController playerController) Called when aPlayerController
is created.void
onControllerDestroy
(PlayerController playerController) Player controller is destroyed.void
onControllerError
(PlayerController controller, CastlabsPlayerException error, PlayerConfig config) Called if aPlayerController
fires an error.onControllerLoad
(PlayerConfig config, PlayerController playerController) Called right before starting to load an item into the givenPlayerController
.void
onControllerRelease
(PlayerController playerController) Player controller is released.void
onItemChange
(PlayerConfig newConfig, PlayerController oldController, PlayerController newController) Called every time a new playlist item is about to start.void
onPlaylistEndReached
(boolean willLoop) Called whenever the MultiControllerPlaylist has played the last item in the playlist.
-
Constructor Details
-
AbstractPlaylistListener
public AbstractPlaylistListener()
-
-
Method Details
-
onItemChange
public void onItemChange(@NonNull PlayerConfig newConfig, @Nullable PlayerController oldController, @Nullable PlayerController newController) Description copied from interface:MultiControllerPlaylist.PlaylistListener
Called every time a new playlist item is about to start. As the internal implementation uses two separatePlayerControllers
, the client code should take care of binding / unbinding the appropriate listeners and UI elements.This method will be also called for the first element in the playlist, with a null oldController.
You can use
MultiControllerPlaylist.migratePlayerListeners(PlayerController, PlayerController)
to remove player listeners from the old PlayerController and add them to the new one.- Specified by:
onItemChange
in interfaceMultiControllerPlaylist.PlaylistListener
- Parameters:
newConfig
- The config representing the new playlist item, which is about to be played.oldController
- Old PlayerController. Should be used to unbind listeners and UI elements.newController
- New PlayerController, where playback will happen.
-
onControllerCreate
Description copied from interface:MultiControllerPlaylist.PlaylistListener
Called when aPlayerController
is created.- Specified by:
onControllerCreate
in interfaceMultiControllerPlaylist.PlaylistListener
- Parameters:
playerController
- the PlayerController just created
-
onControllerLoad
@Nullable public PlayerConfig onControllerLoad(@NonNull PlayerConfig config, @NonNull PlayerController playerController) Description copied from interface:MultiControllerPlaylist.PlaylistListener
Called right before starting to load an item into the givenPlayerController
.This controller could be in background at the moment and getting ready to play the next item.
- Specified by:
onControllerLoad
in interfaceMultiControllerPlaylist.PlaylistListener
- Parameters:
config
- thePlayerConfig
that is going to be loaded onto the controller.playerController
- the controller which is going to load the config.- Returns:
PlayerConfig
that the Controller will load. You can use this method to create a modified Config from the param. If null, the original config will be used.
-
onControllerRelease
Description copied from interface:MultiControllerPlaylist.PlaylistListener
Player controller is released. This means the controller is no longer loading / playing an item.- Specified by:
onControllerRelease
in interfaceMultiControllerPlaylist.PlaylistListener
- Parameters:
playerController
- the controller being released
-
onControllerDestroy
Description copied from interface:MultiControllerPlaylist.PlaylistListener
Player controller is destroyed. This means the controller will no longer be used.- Specified by:
onControllerDestroy
in interfaceMultiControllerPlaylist.PlaylistListener
- Parameters:
playerController
- the controller being destroyed.
-
onControllerError
public void onControllerError(@NonNull PlayerController controller, @NonNull CastlabsPlayerException error, @NonNull PlayerConfig config) Description copied from interface:MultiControllerPlaylist.PlaylistListener
Called if aPlayerController
fires an error. This controller could be in background and pre-loading an item, or it could be the current controller.- Specified by:
onControllerError
in interfaceMultiControllerPlaylist.PlaylistListener
- Parameters:
controller
- the controller firing the errorerror
- the errorconfig
- thePlayerConfig
which is loaded onto the error-firing controller.
-
onPlaylistEndReached
public void onPlaylistEndReached(boolean willLoop) Description copied from interface:MultiControllerPlaylist.PlaylistListener
Called whenever the MultiControllerPlaylist has played the last item in the playlist.This will also be triggered by calling
MultiControllerPlaylist.nextItem()
while already playing the last item.- Specified by:
onPlaylistEndReached
in interfaceMultiControllerPlaylist.PlaylistListener
- Parameters:
willLoop
- whether the Playlist willMultiControllerPlaylist.enableLooping(boolean)
loop and start over from the first item or not.
-