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