Search in sources :

Example 1 with PlaybackOutput

use of androidx.media3.test.utils.robolectric.PlaybackOutput in project media by androidx.

the class DashPlaybackTest method emsgNearToPeriodBoundary.

// https://github.com/google/ExoPlayer/issues/8710
@Test
public void emsgNearToPeriodBoundary() throws Exception {
    Context applicationContext = ApplicationProvider.getApplicationContext();
    CapturingRenderersFactory capturingRenderersFactory = new CapturingRenderersFactory(applicationContext);
    ExoPlayer player = new ExoPlayer.Builder(applicationContext, capturingRenderersFactory).setClock(new FakeClock(/* isAutoAdvancing= */
    true)).build();
    player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */
    1)));
    PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);
    player.setMediaItem(MediaItem.fromUri("asset:///media/dash/emsg/sample.mpd"));
    player.prepare();
    player.play();
    TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_ENDED);
    player.release();
    DumpFileAsserts.assertOutput(applicationContext, playbackOutput, "playbackdumps/dash/emsg.dump");
}
Also used : Context(android.content.Context) PlaybackOutput(androidx.media3.test.utils.robolectric.PlaybackOutput) SurfaceTexture(android.graphics.SurfaceTexture) CapturingRenderersFactory(androidx.media3.test.utils.CapturingRenderersFactory) FakeClock(androidx.media3.test.utils.FakeClock) ExoPlayer(androidx.media3.exoplayer.ExoPlayer) Surface(android.view.Surface) Test(org.junit.Test)

Example 2 with PlaybackOutput

use of androidx.media3.test.utils.robolectric.PlaybackOutput in project media by androidx.

the class TsPlaybackTest 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();
    player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */
    1)));
    PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);
    player.setMediaItem(MediaItem.fromUri("asset:///media/ts/" + inputFile));
    player.prepare();
    player.play();
    TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_ENDED);
    player.release();
    DumpFileAsserts.assertOutput(applicationContext, playbackOutput, "playbackdumps/ts/" + inputFile + ".dump");
}
Also used : Context(android.content.Context) PlaybackOutput(androidx.media3.test.utils.robolectric.PlaybackOutput) SurfaceTexture(android.graphics.SurfaceTexture) CapturingRenderersFactory(androidx.media3.test.utils.CapturingRenderersFactory) FakeClock(androidx.media3.test.utils.FakeClock) ExoPlayer(androidx.media3.exoplayer.ExoPlayer) Surface(android.view.Surface) Test(org.junit.Test)

Example 3 with PlaybackOutput

use of androidx.media3.test.utils.robolectric.PlaybackOutput in project media by androidx.

the class Vp9PlaybackTest 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();
    player.setVideoSurface(new Surface(new SurfaceTexture(/* texName= */
    1)));
    PlaybackOutput playbackOutput = PlaybackOutput.register(player, capturingRenderersFactory);
    player.setMediaItem(MediaItem.fromUri("asset:///media/vp9/" + inputFile));
    player.prepare();
    player.play();
    TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_ENDED);
    player.release();
    DumpFileAsserts.assertOutput(applicationContext, playbackOutput, "playbackdumps/vp9/" + inputFile + ".dump");
}
Also used : Context(android.content.Context) PlaybackOutput(androidx.media3.test.utils.robolectric.PlaybackOutput) SurfaceTexture(android.graphics.SurfaceTexture) CapturingRenderersFactory(androidx.media3.test.utils.CapturingRenderersFactory) FakeClock(androidx.media3.test.utils.FakeClock) ExoPlayer(androidx.media3.exoplayer.ExoPlayer) Surface(android.view.Surface) Test(org.junit.Test)

Example 4 with PlaybackOutput

use of androidx.media3.test.utils.robolectric.PlaybackOutput in project media by androidx.

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");
}
Also used : Context(android.content.Context) PlaybackOutput(androidx.media3.test.utils.robolectric.PlaybackOutput) CapturingRenderersFactory(androidx.media3.test.utils.CapturingRenderersFactory) FakeClock(androidx.media3.test.utils.FakeClock) ExoPlayer(androidx.media3.exoplayer.ExoPlayer) Test(org.junit.Test)

Example 5 with PlaybackOutput

use of androidx.media3.test.utils.robolectric.PlaybackOutput in project media by androidx.

the class PlaylistPlaybackTest method test_bypassOnThenOn.

@Test
public void test_bypassOnThenOn() 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/wav/sample.wav"));
    player.addMediaItem(MediaItem.fromUri("asset:///media/mka/bear-opus.mka"));
    player.prepare();
    player.play();
    TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_ENDED);
    player.release();
    DumpFileAsserts.assertOutput(applicationContext, playbackOutput, "playbackdumps/playlists/bypass-on-then-off.dump");
}
Also used : Context(android.content.Context) PlaybackOutput(androidx.media3.test.utils.robolectric.PlaybackOutput) CapturingRenderersFactory(androidx.media3.test.utils.CapturingRenderersFactory) FakeClock(androidx.media3.test.utils.FakeClock) ExoPlayer(androidx.media3.exoplayer.ExoPlayer) Test(org.junit.Test)

Aggregations

ExoPlayer (androidx.media3.exoplayer.ExoPlayer)21 PlaybackOutput (androidx.media3.test.utils.robolectric.PlaybackOutput)21 Test (org.junit.Test)21 Context (android.content.Context)20 CapturingRenderersFactory (androidx.media3.test.utils.CapturingRenderersFactory)20 FakeClock (androidx.media3.test.utils.FakeClock)20 SurfaceTexture (android.graphics.SurfaceTexture)11 Surface (android.view.Surface)11 MediaItem (androidx.media3.common.MediaItem)4 DefaultMediaSourceFactory (androidx.media3.exoplayer.source.DefaultMediaSourceFactory)4 Pair (android.util.Pair)3 AdPlaybackState (androidx.media3.common.AdPlaybackState)3 Player (androidx.media3.common.Player)3 Timeline (androidx.media3.common.Timeline)3 Assertions.checkNotNull (androidx.media3.common.util.Assertions.checkNotNull)3 AnalyticsListener (androidx.media3.exoplayer.analytics.AnalyticsListener)3 PlayerId (androidx.media3.exoplayer.analytics.PlayerId)3 ServerSideAdInsertionUtil.addAdGroupToAdPlaybackState (androidx.media3.exoplayer.source.ads.ServerSideAdInsertionUtil.addAdGroupToAdPlaybackState)3 DumpFileAsserts (androidx.media3.test.utils.DumpFileAsserts)3 FakeMediaSource (androidx.media3.test.utils.FakeMediaSource)3