Package com.castlabs.android.player

# Interface PeriodInfoProvider

public interface PeriodInfoProvider
Implementations of this interface allows to get additional information on the period being played.

Shall be set via `PlayerController.setPeriodInfoProvider(PeriodInfoProvider)` in order to enable period-based ads handling.

     playerView.getPlayerController().setPeriodInfoProvider(new PeriodInfoProvider() {
            public PeriodInfo getPeriodInfo(@NonNull Timeline.Period period) {
                    // In this example we consider the period to be ads
                    // if period id has the following format xxx-xxx

                    String periodId = period.id instanceof String ? (String)period.id : null;
                    if (periodId != null) {
                            return new PeriodInfo(periodId.split("-").length == 2);
                    }
                    return null;
            }
     });

Since:
  4.2.9

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static class`
  `PeriodInfoProvider.PeriodInfo`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `PeriodInfoProvider.PeriodInfo`
  `getPeriodInfo(com.google.android.exoplayer2.Timeline.Period period)`
  Gets the `PeriodInfoProvider.PeriodInfo` for the specified period

- ## Method Details

  - ### getPeriodInfo

    @Nullable PeriodInfoProvider.PeriodInfo getPeriodInfo(@NonNull com.google.android.exoplayer2.Timeline.Period period)
    Gets the `PeriodInfoProvider.PeriodInfo` for the specified period
    Parameters:
      `period` - The specified period
    Returns:
      The `PeriodInfoProvider.PeriodInfo` for the specified period