use of com.google.android.exoplayer2.source.DefaultMediaSourceFactory in project ExoPlayer by google.
the class DefaultMediaSourceFactoryTest method createMediaSource_withSubtitle_isMergingMediaSource.
@Test
public void createMediaSource_withSubtitle_isMergingMediaSource() {
DefaultMediaSourceFactory defaultMediaSourceFactory = new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext());
List<MediaItem.SubtitleConfiguration> subtitleConfigurations = Arrays.asList(new MediaItem.SubtitleConfiguration.Builder(Uri.parse(URI_TEXT)).setMimeType(MimeTypes.APPLICATION_TTML).setLanguage("en").build(), new MediaItem.SubtitleConfiguration.Builder(Uri.parse(URI_TEXT)).setMimeType(MimeTypes.APPLICATION_TTML).setLanguage("de").setSelectionFlags(C.SELECTION_FLAG_DEFAULT).build());
MediaItem mediaItem = new MediaItem.Builder().setUri(URI_MEDIA).setSubtitleConfigurations(subtitleConfigurations).build();
MediaSource mediaSource = defaultMediaSourceFactory.createMediaSource(mediaItem);
assertThat(mediaSource).isInstanceOf(MergingMediaSource.class);
}
use of com.google.android.exoplayer2.source.DefaultMediaSourceFactory in project ExoPlayer by google.
the class DefaultMediaSourceFactoryTest method createMediaSource_undefinedLiveProperties_livePropertiesUnset.
@Test
public void createMediaSource_undefinedLiveProperties_livePropertiesUnset() {
DefaultMediaSourceFactory defaultMediaSourceFactory = new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext());
MediaItem mediaItem = new MediaItem.Builder().setUri(URI_MEDIA + "/file.mp4").build();
MediaSource mediaSource = defaultMediaSourceFactory.createMediaSource(mediaItem);
MediaItem mediaItemFromSource = mediaSource.getMediaItem();
assertThat(mediaItemFromSource.liveConfiguration.targetOffsetMs).isEqualTo(C.TIME_UNSET);
assertThat(mediaItemFromSource.liveConfiguration.minOffsetMs).isEqualTo(C.TIME_UNSET);
assertThat(mediaItemFromSource.liveConfiguration.maxOffsetMs).isEqualTo(C.TIME_UNSET);
assertThat(mediaItemFromSource.liveConfiguration.minPlaybackSpeed).isEqualTo(C.RATE_UNSET);
assertThat(mediaItemFromSource.liveConfiguration.maxPlaybackSpeed).isEqualTo(C.RATE_UNSET);
}
use of com.google.android.exoplayer2.source.DefaultMediaSourceFactory in project ExoPlayer by google.
the class DefaultMediaSourceFactoryTest method createMediaSource_withNull_usesNonNullDefaults.
@Test
public void createMediaSource_withNull_usesNonNullDefaults() {
DefaultMediaSourceFactory defaultMediaSourceFactory = new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext());
MediaItem mediaItem = new MediaItem.Builder().setUri(URI_MEDIA + "/file.mpd").build();
MediaSource mediaSource = defaultMediaSourceFactory.setDrmSessionManagerProvider(null).setLoadErrorHandlingPolicy(null).createMediaSource(mediaItem);
assertThat(mediaSource).isNotNull();
}
use of com.google.android.exoplayer2.source.DefaultMediaSourceFactory in project ExoPlayer by google.
the class DefaultMediaSourceFactoryTest method createMediaSource_withMimeType_dashSource.
@Test
public void createMediaSource_withMimeType_dashSource() {
DefaultMediaSourceFactory defaultMediaSourceFactory = new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext());
MediaItem mediaItem = new MediaItem.Builder().setUri(URI_MEDIA).setMimeType(MimeTypes.APPLICATION_MPD).build();
MediaSource mediaSource = defaultMediaSourceFactory.createMediaSource(mediaItem);
assertThat(mediaSource).isInstanceOf(DashMediaSource.class);
}
use of com.google.android.exoplayer2.source.DefaultMediaSourceFactory in project ExoPlayer by google.
the class DefaultMediaSourceFactoryTest method createMediaSource_withPath_dashSource.
@Test
public void createMediaSource_withPath_dashSource() {
DefaultMediaSourceFactory defaultMediaSourceFactory = new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext());
MediaItem mediaItem = new MediaItem.Builder().setUri(URI_MEDIA + "/file.mpd").build();
MediaSource mediaSource = defaultMediaSourceFactory.createMediaSource(mediaItem);
assertThat(mediaSource).isInstanceOf(DashMediaSource.class);
}
Aggregations