use of com.google.android.exoplayer2.source.DefaultMediaSourceFactory in project ExoPlayer by google.
the class DefaultMediaSourceFactoryTest method createMediaSource_defaultToEnd_isNotClippingMediaSource.
@Test
public void createMediaSource_defaultToEnd_isNotClippingMediaSource() {
DefaultMediaSourceFactory defaultMediaSourceFactory = new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext());
MediaItem mediaItem = new MediaItem.Builder().setUri(URI_MEDIA).setClippingConfiguration(new MediaItem.ClippingConfiguration.Builder().setEndPositionMs(C.TIME_END_OF_SOURCE).build()).build();
MediaSource mediaSource = defaultMediaSourceFactory.createMediaSource(mediaItem);
assertThat(mediaSource).isInstanceOf(ProgressiveMediaSource.class);
}
use of com.google.android.exoplayer2.source.DefaultMediaSourceFactory in project ExoPlayer by google.
the class WebvttPlaybackTest method test.
@Test
public void test() throws Exception {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory = new CapturingRenderersFactory(applicationContext);
MediaSource.Factory mediaSourceFactory = new DefaultMediaSourceFactory(applicationContext).experimentalUseProgressiveMediaSourceForSubtitles(true);
ExoPlayer player = new ExoPlayer.Builder(applicationContext, capturingRenderersFactory).setClock(new FakeClock(/* isAutoAdvancing= */
true)).setMediaSourceFactory(mediaSourceFactory).build();
player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */
1)));
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);
MediaItem mediaItem = new MediaItem.Builder().setUri("asset:///media/mp4/preroll-5s.mp4").setSubtitleConfigurations(ImmutableList.of(new MediaItem.SubtitleConfiguration.Builder(Uri.parse("asset:///media/webvtt/" + inputFile)).setMimeType(MimeTypes.TEXT_VTT).setLanguage("en").setSelectionFlags(C.SELECTION_FLAG_DEFAULT).build())).build();
player.setMediaItem(mediaItem);
player.prepare();
player.play();
TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_ENDED);
player.release();
DumpFileAsserts.assertOutput(applicationContext, playbackOutput, "playbackdumps/webvtt/" + inputFile + ".dump");
}
use of com.google.android.exoplayer2.source.DefaultMediaSourceFactory in project ExoPlayer by google.
the class DefaultMediaSourceFactoryTest method getSupportedTypes_smoothstreamingModule_containsTypeSS.
@Test
public void getSupportedTypes_smoothstreamingModule_containsTypeSS() {
int[] supportedTypes = new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext()).getSupportedTypes();
assertThat(supportedTypes).asList().containsExactly(C.TYPE_OTHER, C.TYPE_SS);
}
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.ism").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_withManifestPath_smoothstreamingSource.
@Test
public void createMediaSource_withManifestPath_smoothstreamingSource() {
DefaultMediaSourceFactory defaultMediaSourceFactory = new DefaultMediaSourceFactory((Context) ApplicationProvider.getApplicationContext());
MediaItem mediaItem = new MediaItem.Builder().setUri(URI_MEDIA + ".ism/Manifest").build();
MediaSource mediaSource = defaultMediaSourceFactory.createMediaSource(mediaItem);
assertThat(mediaSource).isInstanceOf(SsMediaSource.class);
}
Aggregations