use of com.google.android.exoplayer2.MediaItem 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).build();
MediaSource mediaSource = defaultMediaSourceFactory.setDrmSessionManagerProvider(null).setLoadErrorHandlingPolicy(null).createMediaSource(mediaItem);
assertThat(mediaSource).isNotNull();
}
use of com.google.android.exoplayer2.MediaItem in project ExoPlayer by google.
the class DefaultMediaSourceFactoryTest method createMediaSource_withStartPosition_isClippingMediaSource.
@Test
public void createMediaSource_withStartPosition_isClippingMediaSource() {
DefaultMediaSourceFactory defaultMediaSourceFactory = new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext());
MediaItem mediaItem = new MediaItem.Builder().setUri(URI_MEDIA).setClippingConfiguration(new MediaItem.ClippingConfiguration.Builder().setStartPositionMs(1000L).build()).build();
MediaSource mediaSource = defaultMediaSourceFactory.createMediaSource(mediaItem);
assertThat(mediaSource).isInstanceOf(ClippingMediaSource.class);
}
use of com.google.android.exoplayer2.MediaItem in project ExoPlayer by google.
the class DefaultMediaSourceFactoryTest method createMediaSource_fromMediaItem_returnsSameMediaItemInstance.
@Test
public void createMediaSource_fromMediaItem_returnsSameMediaItemInstance() {
DefaultMediaSourceFactory defaultMediaSourceFactory = new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext());
MediaItem mediaItem = new MediaItem.Builder().setUri(URI_MEDIA).build();
MediaSource mediaSource = defaultMediaSourceFactory.createMediaSource(mediaItem);
assertThat(mediaSource.getMediaItem()).isSameInstanceAs(mediaItem);
}
use of com.google.android.exoplayer2.MediaItem in project ExoPlayer by google.
the class DefaultMediaSourceFactoryTest method createMediaSource_withoutMimeType_progressiveSource.
@Test
public void createMediaSource_withoutMimeType_progressiveSource() {
DefaultMediaSourceFactory defaultMediaSourceFactory = new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext());
MediaItem mediaItem = new MediaItem.Builder().setUri(URI_MEDIA).build();
MediaSource mediaSource = defaultMediaSourceFactory.createMediaSource(mediaItem);
assertThat(mediaSource).isInstanceOf(ProgressiveMediaSource.class);
}
use of com.google.android.exoplayer2.MediaItem in project ExoPlayer by google.
the class DefaultMediaSourceFactoryTest method createMediaSource_withPath_progressiveSource.
@Test
public void createMediaSource_withPath_progressiveSource() {
DefaultMediaSourceFactory defaultMediaSourceFactory = new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext());
MediaItem mediaItem = new MediaItem.Builder().setUri(URI_MEDIA + "/file.mp3").build();
MediaSource mediaSource = defaultMediaSourceFactory.createMediaSource(mediaItem);
assertThat(mediaSource).isInstanceOf(ProgressiveMediaSource.class);
}
Aggregations