Interface MultiControllerPlaylist.PlaylistListener

All Known Implementing Classes:
MultiControllerPlaylist.AbstractPlaylistListener
Enclosing class:
MultiControllerPlaylist

public static interface MultiControllerPlaylist.PlaylistListener
Playlist-related events listener.
  • Method Details

    • onItemChange

      void onItemChange(@NonNull PlayerConfig newConfig, @Nullable PlayerController oldController, @Nullable PlayerController newController)
      Called every time a new playlist item is about to start. As the internal implementation uses two separate PlayerControllers, 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.

      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

      void onControllerCreate(@NonNull PlayerController playerController)
      Called when a PlayerController is created.
      Parameters:
      playerController - the PlayerController just created
    • onControllerLoad

      @Nullable PlayerConfig onControllerLoad(@NonNull PlayerConfig config, @NonNull PlayerController playerController)
      Called right before starting to load an item into the given PlayerController.

      This controller could be in background at the moment and getting ready to play the next item.

      Parameters:
      config - the PlayerConfig 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

      void onControllerRelease(@NonNull PlayerController playerController)
      Player controller is released. This means the controller is no longer loading / playing an item.
      Parameters:
      playerController - the controller being released
    • onControllerDestroy

      void onControllerDestroy(@NonNull PlayerController playerController)
      Player controller is destroyed. This means the controller will no longer be used.
      Parameters:
      playerController - the controller being destroyed.
    • onControllerError

      void onControllerError(@NonNull PlayerController controller, @NonNull CastlabsPlayerException error, @NonNull PlayerConfig config)
      Called if a PlayerController fires an error. This controller could be in background and pre-loading an item, or it could be the current controller.
      Parameters:
      controller - the controller firing the error
      error - the error
      config - the PlayerConfig which is loaded onto the error-firing controller.
    • onPlaylistEndReached

      void onPlaylistEndReached(boolean willLoop)
      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.

      Parameters:
      willLoop - whether the Playlist will MultiControllerPlaylist.enableLooping(boolean)loop and start over from the first item or not.