Package com.castlabs.android.player

# Interface PlayerPlugin

All Known Implementing Classes:
  `DashPlayerPlugin`, `HlsPlayerPlugin`, `IPTVPlayerPlugin`

public interface PlayerPlugin
A plugin interface that is used to initialize player instances for different content formats such as HLS, DASH, or SmoothStreaming.

Instances of this plugin can be registered with `PlayerSDK.register(PlayerPlugin)`.

Since:
  3.0.0

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static class`
  `PlayerPlugin.DrmInitDataProvider<T extends com.google.android.exoplayer2.offline.FilterableManifest>`
  Abstract class for providing DRM initialization data.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `PlayerPlugin.DrmInitDataProvider`
  `createDrmInitDataProvider(ManifestModifier manifestModifier)`
  Creates a `PlayerPlugin.DrmInitDataProvider` instance.
  `default DrmLicenseManager[]`
  `createDrmLicenseManagers(Context context, DrmConfiguration drmConfiguration, ConfigurationProvider configurationProvider, SSLSocketFactory sslSocketFactory, DataSourceFactory dataSourceFactory, NetworkConfiguration networkConfiguration, List<RequestModifier> requestModifiers, List<ResponseModifier> responseModifiers)`
  Returns the array of `DrmLicenseManager` for the given `DrmConfiguration`.
  `com.google.android.exoplayer2.source.MediaSource`
  `createMediaSource(PlayerConfig config, boolean attachInitialPositionProvider, PlayerController playerController)`
  Create the content media source based on the supplied path and the `PlayerController`
  `List<TrackRendererPlugin.TrackRendererContainer>`
  `createRendererContainers(PlayerController playerController, DrmConfiguration drmConfiguration)`
  Create the list of renderer containers based on the supplied `DrmConfiguration` and `PlayerController`
  `com.google.android.exoplayer2.RendererCapabilities[]`
  `getRendererCapabilities(Context context, DrmConfiguration drmConfiguration)`
  Retrieve array of supported RendererCapabilities.
  `boolean`
  `isFormatSupported(int format, DrmConfiguration configuration)`
  Check if this plugin can create a player for the given content format and DRM configuration.
  `default void`
  `setDrmLicenseManagers(com.google.android.exoplayer2.source.MediaSource.Factory factory, PlayerController playerController)`
  Helper to set up DRM license managers into the Factory

- ## Method Details

  - ### isFormatSupported

    boolean isFormatSupported(int format, @Nullable DrmConfiguration configuration)
    Check if this plugin can create a player for the given content format and DRM configuration.
    Parameters:
      `format` - the content format (one of `SdkConsts.CONTENT_TYPE_UNKNOWN`, `SdkConsts.CONTENT_TYPE_DASH`, `SdkConsts.CONTENT_TYPE_HLS`, `SdkConsts.CONTENT_TYPE_SMOOTHSTREAMING`, or `SdkConsts.CONTENT_TYPE_MP4`)
      `configuration` - the drm configuration
    Returns:
      true if this plugin can create a player for the given content format and drm configuration

  - ### getRendererCapabilities

    @Nullable com.google.android.exoplayer2.RendererCapabilities[] getRendererCapabilities(@NonNull Context context, @Nullable DrmConfiguration drmConfiguration)
    Retrieve array of supported RendererCapabilities.
    Parameters:
      `context` - the context
      `drmConfiguration` - the drm configuration
    Returns:
      RendererCapabilities array supported by the player plugin or null

  - ### createDrmInitDataProvider

    @Nullable PlayerPlugin.DrmInitDataProvider createDrmInitDataProvider(ManifestModifier manifestModifier)
    Creates a `PlayerPlugin.DrmInitDataProvider` instance.
    Parameters:
      `manifestModifier` - The manifest modifier.
    Returns:
      The created `PlayerPlugin.DrmInitDataProvider` or null if not supported.

  - ### createDrmLicenseManagers

    @Nullable default DrmLicenseManager[] createDrmLicenseManagers(@NonNull Context context, @Nullable DrmConfiguration drmConfiguration, @Nullable ConfigurationProvider configurationProvider, @Nullable SSLSocketFactory sslSocketFactory, @NonNull DataSourceFactory dataSourceFactory, @NonNull NetworkConfiguration networkConfiguration, @NonNull List<RequestModifier> requestModifiers, @NonNull List<ResponseModifier> responseModifiers)
    Returns the array of `DrmLicenseManager` for the given `DrmConfiguration`.
    Parameters:
      `context` - The context.
      `drmConfiguration` - The DRM configuration.
      `configurationProvider` - The configuration provider `null`
      `sslSocketFactory` - The SSL socket factory or `null`
      `dataSourceFactory` - The data source factory
      `networkConfiguration` - THe network configuration
      `requestModifiers` - The list of request modifiers
      `responseModifiers` - The list of response modifiers
    Returns:
      The array of `DrmLicenseManager` or `null` if no suitable builder was found.

  - ### createMediaSource

    @NonNull com.google.android.exoplayer2.source.MediaSource createMediaSource(@NonNull PlayerConfig config, boolean attachInitialPositionProvider, @NonNull PlayerController playerController)
    Create the content media source based on the supplied path and the `PlayerController`
    Parameters:
      `config` - The `PlayerConfig`
      `attachInitialPositionProvider` - Whether toattach the initial position provider to the media source
      `playerController` - The `PlayerController` instance
    Returns:
      The media source

  - ### setDrmLicenseManagers

    default void setDrmLicenseManagers(@NonNull com.google.android.exoplayer2.source.MediaSource.Factory factory, @NonNull PlayerController playerController)
    Helper to set up DRM license managers into the Factory
    Parameters:
      `factory` - The factory
      `playerController` - The PlayerController with registered DRM license managers

  - ### createRendererContainers

    @NonNull List<TrackRendererPlugin.TrackRendererContainer> createRendererContainers(@NonNull PlayerController playerController, @Nullable DrmConfiguration drmConfiguration) throws CastlabsPlayerException
    Create the list of renderer containers based on the supplied `DrmConfiguration` and `PlayerController`
    Parameters:
      `playerController` - The `PlayerController` instance
      `drmConfiguration` - The `DrmConfiguration`, might be `null`
    Returns:
      The list of renderer containers
    Throws:
      `CastlabsPlayerException` - when render containers can not be created or an error occurs