Search in sources :

Example 1 with LiveConfiguration

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);
}
Also used : LiveConfiguration(com.google.android.exoplayer2.MediaItem.LiveConfiguration) MediaItem(com.google.android.exoplayer2.MediaItem) Test(org.junit.Test)

Example 2 with LiveConfiguration

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);
}
Also used : LiveConfiguration(com.google.android.exoplayer2.MediaItem.LiveConfiguration) LiveConfiguration(com.google.android.exoplayer2.MediaItem.LiveConfiguration) MediaItem(com.google.android.exoplayer2.MediaItem) Test(org.junit.Test)

Example 3 with LiveConfiguration

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);
}
Also used : LiveConfiguration(com.google.android.exoplayer2.MediaItem.LiveConfiguration) LiveConfiguration(com.google.android.exoplayer2.MediaItem.LiveConfiguration) MediaItem(com.google.android.exoplayer2.MediaItem) Test(org.junit.Test)

Example 4 with LiveConfiguration

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);
}
Also used : LiveConfiguration(com.google.android.exoplayer2.MediaItem.LiveConfiguration) MediaItem(com.google.android.exoplayer2.MediaItem) Test(org.junit.Test)

Example 5 with 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);
}
Also used : LiveConfiguration(com.google.android.exoplayer2.MediaItem.LiveConfiguration) LiveConfiguration(com.google.android.exoplayer2.MediaItem.LiveConfiguration) MediaItem(com.google.android.exoplayer2.MediaItem) Test(org.junit.Test)

Aggregations

MediaItem (com.google.android.exoplayer2.MediaItem)11 LiveConfiguration (com.google.android.exoplayer2.MediaItem.LiveConfiguration)10 Test (org.junit.Test)10 Nullable (androidx.annotation.Nullable)1 Format (com.google.android.exoplayer2.Format)1 DefaultExtractorsFactory (com.google.android.exoplayer2.extractor.DefaultExtractorsFactory)1 Extractor (com.google.android.exoplayer2.extractor.Extractor)1 ExtractorsFactory (com.google.android.exoplayer2.extractor.ExtractorsFactory)1 MediaPeriod (com.google.android.exoplayer2.source.MediaPeriod)1 AdsMediaSource (com.google.android.exoplayer2.source.ads.AdsMediaSource)1 Period (com.google.android.exoplayer2.source.dash.manifest.Period)1 SubtitleExtractor (com.google.android.exoplayer2.text.SubtitleExtractor)1