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
-
Method Summary
Modifier and TypeMethodDescriptiongetPeriodInfo
(com.google.android.exoplayer2.Timeline.Period period) Gets thePeriodInfoProvider.PeriodInfo
for the specified period
-
Method Details
-
getPeriodInfo
@Nullable PeriodInfoProvider.PeriodInfo getPeriodInfo(@NonNull com.google.android.exoplayer2.Timeline.Period period) Gets thePeriodInfoProvider.PeriodInfo
for the specified period- Parameters:
period
- The specified period- Returns:
- The
PeriodInfoProvider.PeriodInfo
for the specified period
-