use of com.google.android.exoplayer2.testutil.CapturingRenderersFactory in project ExoPlayer by google.
the class Mp4PlaybackTest method test.
@Test
public void test() throws Exception {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory renderersFactory = new CapturingRenderersFactory(applicationContext);
ExoPlayer player = new ExoPlayer.Builder(applicationContext, renderersFactory).setClock(new FakeClock(/* isAutoAdvancing= */
true)).build();
player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */
1)));
PlaybackOutput playbackOutput = PlaybackOutput.register(player, renderersFactory);
player.setMediaItem(MediaItem.fromUri("asset:///media/mp4/" + inputFile));
player.prepare();
player.play();
TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_ENDED);
player.release();
DumpFileAsserts.assertOutput(applicationContext, playbackOutput, "playbackdumps/mp4/" + inputFile + ".dump");
}
use of com.google.android.exoplayer2.testutil.CapturingRenderersFactory in project ExoPlayer by google.
the class PlaylistPlaybackTest method test_bypassOffThenOn.
@Test
public void test_bypassOffThenOn() throws Exception {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory = new CapturingRenderersFactory(applicationContext);
ExoPlayer player = new ExoPlayer.Builder(applicationContext, capturingRenderersFactory).setClock(new FakeClock(/* isAutoAdvancing= */
true)).build();
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);
player.addMediaItem(MediaItem.fromUri("asset:///media/mka/bear-opus.mka"));
player.addMediaItem(MediaItem.fromUri("asset:///media/wav/sample.wav"));
player.prepare();
player.play();
TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_ENDED);
player.release();
DumpFileAsserts.assertOutput(applicationContext, playbackOutput, "playbackdumps/playlists/bypass-off-then-on.dump");
}
use of com.google.android.exoplayer2.testutil.CapturingRenderersFactory in project ExoPlayer by google.
the class WavPlaybackTest method test.
@Test
public void test() throws Exception {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory = new CapturingRenderersFactory(applicationContext);
ExoPlayer player = new ExoPlayer.Builder(applicationContext, capturingRenderersFactory).setClock(new FakeClock(/* isAutoAdvancing= */
true)).build();
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);
player.setMediaItem(MediaItem.fromUri("asset:///media/wav/" + inputFile));
player.prepare();
player.play();
TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_ENDED);
player.release();
DumpFileAsserts.assertOutput(ApplicationProvider.getApplicationContext(), playbackOutput, "playbackdumps/wav/" + inputFile + ".dump");
}
use of com.google.android.exoplayer2.testutil.CapturingRenderersFactory 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.testutil.CapturingRenderersFactory in project ExoPlayer by google.
the class SilencePlaybackTest method test_0ms.
@Test
public void test_0ms() throws Exception {
Context applicationContext = ApplicationProvider.getApplicationContext();
CapturingRenderersFactory capturingRenderersFactory = new CapturingRenderersFactory(applicationContext);
ExoPlayer player = new ExoPlayer.Builder(applicationContext, capturingRenderersFactory).setClock(new FakeClock(/* isAutoAdvancing= */
true)).build();
PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);
player.setMediaSource(new SilenceMediaSource(/* durationUs= */
0));
player.prepare();
player.play();
TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_ENDED);
player.release();
DumpFileAsserts.assertOutput(applicationContext, playbackOutput, "playbackdumps/silence/0ms.dump");
}
Aggregations