use of com.google.android.exoplayer2.MediaItem.LiveConfiguration in project ExoPlayer by google.
the class DashMediaSourceTest method prepare_withCompleteServiceDescription_withMediaItemLiveProperties_usesMediaItem.
@Test
public void prepare_withCompleteServiceDescription_withMediaItemLiveProperties_usesMediaItem() throws InterruptedException {
MediaItem mediaItem = new MediaItem.Builder().setUri(Uri.EMPTY).setLiveConfiguration(new MediaItem.LiveConfiguration.Builder().setTargetOffsetMs(876L).setMinPlaybackSpeed(23f).setMaxPlaybackSpeed(42f).setMinOffsetMs(100L).setMaxOffsetMs(999L).build()).build();
DashMediaSource mediaSource = new DashMediaSource.Factory(() -> createSampleMpdDataSource(SAMPLE_MPD_LIVE_WITH_COMPLETE_SERVICE_DESCRIPTION)).setFallbackTargetLiveOffsetMs(1234L).createMediaSource(mediaItem);
MediaItem.LiveConfiguration liveConfiguration = prepareAndWaitForTimelineRefresh(mediaSource).liveConfiguration;
assertThat(liveConfiguration.targetOffsetMs).isEqualTo(876L);
assertThat(liveConfiguration.minOffsetMs).isEqualTo(100L);
assertThat(liveConfiguration.maxOffsetMs).isEqualTo(999L);
assertThat(liveConfiguration.minPlaybackSpeed).isEqualTo(23f);
assertThat(liveConfiguration.maxPlaybackSpeed).isEqualTo(42f);
}
use of com.google.android.exoplayer2.MediaItem.LiveConfiguration in project ExoPlayer by google.
the class DashMediaSourceTest method prepare_withoutLiveConfiguration_withOnlyMediaItemTargetOffset_usesUnitSpeed.
@Test
public void prepare_withoutLiveConfiguration_withOnlyMediaItemTargetOffset_usesUnitSpeed() throws InterruptedException {
DashMediaSource mediaSource = new DashMediaSource.Factory(() -> createSampleMpdDataSource(SAMPLE_MPD_LIVE_WITHOUT_LIVE_CONFIGURATION)).createMediaSource(new MediaItem.Builder().setUri(Uri.EMPTY).setLiveConfiguration(new LiveConfiguration.Builder().setTargetOffsetMs(10_000L).build()).build());
MediaItem.LiveConfiguration liveConfiguration = prepareAndWaitForTimelineRefresh(mediaSource).liveConfiguration;
assertThat(liveConfiguration.targetOffsetMs).isEqualTo(10_000L);
assertThat(liveConfiguration.minOffsetMs).isEqualTo(0L);
assertThat(liveConfiguration.maxOffsetMs).isEqualTo(58_000L);
assertThat(liveConfiguration.minPlaybackSpeed).isEqualTo(1f);
assertThat(liveConfiguration.maxPlaybackSpeed).isEqualTo(1f);
}
use of com.google.android.exoplayer2.MediaItem.LiveConfiguration in project ExoPlayer by google.
the class DashMediaSourceTest method prepare_withoutLiveConfiguration_withoutMediaItemTargetOffset_usesDefinedFallbackTargetOffset.
@Test
public void prepare_withoutLiveConfiguration_withoutMediaItemTargetOffset_usesDefinedFallbackTargetOffset() throws InterruptedException {
DashMediaSource mediaSource = new DashMediaSource.Factory(() -> createSampleMpdDataSource(SAMPLE_MPD_LIVE_WITHOUT_LIVE_CONFIGURATION)).setFallbackTargetLiveOffsetMs(1234L).createMediaSource(new MediaItem.Builder().setUri(Uri.EMPTY).setLiveConfiguration(new LiveConfiguration.Builder().setMinPlaybackSpeed(0.95f).build()).build());
MediaItem.LiveConfiguration liveConfiguration = prepareAndWaitForTimelineRefresh(mediaSource).liveConfiguration;
assertThat(liveConfiguration.targetOffsetMs).isEqualTo(1234L);
assertThat(liveConfiguration.minOffsetMs).isEqualTo(0L);
assertThat(liveConfiguration.maxOffsetMs).isEqualTo(58_000L);
assertThat(liveConfiguration.minPlaybackSpeed).isEqualTo(0.95f);
assertThat(liveConfiguration.maxPlaybackSpeed).isEqualTo(C.RATE_UNSET);
}
use of com.google.android.exoplayer2.MediaItem.LiveConfiguration in project ExoPlayer by google.
the class DashMediaSourceTest method prepare_withoutLiveConfiguration_withMediaItemLiveProperties_usesMediaItem.
@Test
public void prepare_withoutLiveConfiguration_withMediaItemLiveProperties_usesMediaItem() throws InterruptedException {
MediaItem mediaItem = new MediaItem.Builder().setUri(Uri.EMPTY).setLiveConfiguration(new MediaItem.LiveConfiguration.Builder().setTargetOffsetMs(876L).setMinPlaybackSpeed(23f).setMaxPlaybackSpeed(42f).setMinOffsetMs(500L).setMaxOffsetMs(20_000L).build()).build();
DashMediaSource mediaSource = new DashMediaSource.Factory(() -> createSampleMpdDataSource(SAMPLE_MPD_LIVE_WITHOUT_LIVE_CONFIGURATION)).setFallbackTargetLiveOffsetMs(1234L).createMediaSource(mediaItem);
MediaItem.LiveConfiguration liveConfiguration = prepareAndWaitForTimelineRefresh(mediaSource).liveConfiguration;
assertThat(liveConfiguration).isEqualTo(mediaItem.liveConfiguration);
}
use of com.google.android.exoplayer2.MediaItem.LiveConfiguration in project ExoPlayer by google.
the class DashMediaSourceTest method prepare_withSuggestedPresentationDelayAndMinBufferTime_usesManifestValue.
@Test
public void prepare_withSuggestedPresentationDelayAndMinBufferTime_usesManifestValue() throws InterruptedException {
DashMediaSource mediaSource = new DashMediaSource.Factory(() -> createSampleMpdDataSource(SAMPLE_MPD_LIVE_WITH_SUGGESTED_PRESENTATION_DELAY_2S_MIN_BUFFER_TIME_500MS)).setFallbackTargetLiveOffsetMs(1234L).createMediaSource(new MediaItem.Builder().setUri(Uri.EMPTY).setLiveConfiguration(new LiveConfiguration.Builder().setMaxPlaybackSpeed(1.05f).build()).build());
MediaItem.LiveConfiguration liveConfiguration = prepareAndWaitForTimelineRefresh(mediaSource).liveConfiguration;
assertThat(liveConfiguration.targetOffsetMs).isEqualTo(2_000L);
assertThat(liveConfiguration.minOffsetMs).isEqualTo(500L);
assertThat(liveConfiguration.maxOffsetMs).isEqualTo(58_000L);
assertThat(liveConfiguration.minPlaybackSpeed).isEqualTo(C.RATE_UNSET);
assertThat(liveConfiguration.maxPlaybackSpeed).isEqualTo(1.05f);
}
Aggregations