Package com.castlabs.sdk.channels

# Class ChannelManager

java.lang.Object
com.castlabs.sdk.channels.ChannelManager

public class ChannelManager extends Object

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static interface`
  `ChannelManager.Listener`
  Callback interface that can be added to the manager.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ChannelManager(List<Bundle> channelConfigurations, PlayerView playerView, int cacheSize)`
  Initialize the channel manager with a list of Intent Bundles that will be used to open playback sessions (see `PlayerController.open(Bundle)`)

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getCurrentChannelIndex()`
  `void`
  `selectChannel(int index)`
  Selects the channel at the given index and attaches it to the player view.
  `void`
  `setListener(ChannelManager.Listener listener)`
  Set a listener to this manager

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ChannelManager

    public ChannelManager(@NonNull List<Bundle> channelConfigurations, @NonNull PlayerView playerView, int cacheSize)
    Initialize the channel manager with a list of Intent Bundles that will be used to open playback sessions (see `PlayerController.open(Bundle)`)
    Parameters:
      `channelConfigurations` - The channel configs
      `playerView` - The player view
      `cacheSize` - The cache size per side. The final cache will be 2*cacheSize+1

- ## Method Details

  - ### setListener

    public void setListener(@Nullable ChannelManager.Listener listener)
    Set a listener to this manager
    Parameters:
      `listener` - The listener

  - ### getCurrentChannelIndex

    public int getCurrentChannelIndex()
    Returns:
      The current channel index or -1

  - ### selectChannel

    public void selectChannel(int index)
    Selects the channel at the given index and attaches it to the player view.
    Parameters:
      `index` - The index