Class MultiControllerPlaylist.Builder

java.lang.Object
com.castlabs.android.player.playlist.MultiControllerPlaylist.Builder
Enclosing class:
MultiControllerPlaylist

public static final class MultiControllerPlaylist.Builder extends Object
  • Constructor Details

    • Builder

      public Builder(@NonNull PlayerView playerView)
      Creates an instance of the Builder.
      Parameters:
      playerView - the PlayerView from which to use the context.
    • Builder

      public Builder(@NonNull Context context)
      Creates an instance of the Builder.
      Parameters:
      context - the Context to use when creating PlayerController instances.
  • Method Details

    • itemChangeFlags

      public MultiControllerPlaylist.Builder itemChangeFlags(int itemChangeFlags)
      Sets the behaviour that will be applied when a new playlist item is about to be played.
      Parameters:
      itemChangeFlags - flags to set
      Returns:
      the Builder
      See Also:
    • listener

      Parameters:
      listener - the listener to set
      Returns:
      the Builder
    • loop

      public MultiControllerPlaylist.Builder loop(boolean loop)
      Sets the loop flag
      Parameters:
      loop - the looping flag
      Returns:
      the Builder
    • nextItemThresholdMs

      public MultiControllerPlaylist.Builder nextItemThresholdMs(int nextItemThresholdMs)
      Sets the nextItemThreshold in milliseconds.
      Parameters:
      nextItemThresholdMs - the next item threshold in milliseconds
      Returns:
      the Builder
    • backPlayers

      public MultiControllerPlaylist.Builder backPlayers(int backPlayersCount)
      Sets the number of "back players". This is the number of concurrently maintained background players for past playlist items. Defaults to 0.
      Parameters:
      backPlayersCount - the number of back players to use
      Returns:
      the Builder
    • forwardPlayers

      public MultiControllerPlaylist.Builder forwardPlayers(int forwardPlayersCount)
      Sets the number of "forward players". This is the number of concurrently maintained background players for future playlist items. Defaults to 1.
      Parameters:
      forwardPlayersCount - the number of forward players to use
      Returns:
      the Builder
    • playBackground

      public MultiControllerPlaylist.Builder playBackground(boolean playBackground)
      Sets the flag indicating whether or not to immediately start playing the background PlayerControllers. If false, the PlayerController will be in paused state until it is attached.
      Parameters:
      playBackground - whether to allow background playback or not.
      Returns:
      the Builder
    • justEnableAnalyticsForCurrentItem

      public MultiControllerPlaylist.Builder justEnableAnalyticsForCurrentItem(boolean justEnableAnalyticsForCurrentItem)
      If set to true the analytics sessions are just enabled for current item in the playlist.
      Parameters:
      justEnableAnalyticsForCurrentItem - the value
      Returns:
      the Builder
    • seekToDefaultPositionOnItemChange

      public MultiControllerPlaylist.Builder seekToDefaultPositionOnItemChange(boolean seek)
      Determines whether to seek to the default position of each item upon transitioning to it. When false, each controller instance will simply continue from its last position if it hadn't been released when switching back to it.
      Parameters:
      seek - seek to the default position of each item upon transitioning to it
      Returns:
      the Builder
    • get

      Constructs the MultiControllerPlaylist.
      Returns:
      an instance of MultiControllerPlaylist