androidx.media3.test.utils


Interfaces

ActionSchedule.Callback

Callback to notify listener that the action schedule has finished.

ActionSchedule.PlayerTarget.Callback

Callback to be called when message arrives.

CapturingRenderersFactory.TextRendererFactory

A factory for Renderer instances that handle TRACK_TYPE_TEXT tracks.

DecodeOneFrameUtil.Listener

Listener for decoding events.

DummyMainThread.TestRunnable

Runnable variant which can throw a checked exception.

Dumper.Dumpable

Provides custom dump method.

ExtractorAsserts.ExtractorFactory

A factory for Extractor instances.

FakeMediaPeriod.TrackDataFactory

A factory to create the test data for a particular track.

FakeTrackOutput.Factory

Factory for FakeTrackOutput instances.

HostActivity.HostedTest

Interface for tests that run inside of a HostActivity.

MediaPeriodAsserts.FilterableManifestMediaPeriodFactory

Interface to create media periods for testing based on a FilterableManifest.

VideoFrameProcessorTestRunner.BitmapReader

Reads a Bitmap from VideoFrameProcessor output.

VideoFrameProcessorTestRunner.OnOutputFrameAvailableForRenderingListener
VideoFrameProcessorTestRunner.OnVideoFrameProcessingEndedListener

Classes

Action

Base class for actions to perform during playback tests.

Action.AddMediaItems

Calls addMediaSources.

Action.ClearMediaItems

Calls clearMediaItems}.

Action.ClearVideoSurface

Calls clearVideoSurface.

Action.ExecuteRunnable

Calls Runnable.run().

Action.MoveMediaItem

Calls moveMediaItem.

Action.PlayUntilPosition

Schedules a play action to be executed, waits until the player reaches the specified position, and pauses the player again.

Action.Prepare

Calls prepare.

Action.RemoveMediaItem

Calls removeMediaItem.

Action.RemoveMediaItems

Calls removeMediaItems.

Action.Seek

Calls seekTo or seekTo.

Action.SendMessages

Calls createMessage and send.

Action.SetAudioAttributes

Calls setAudioAttributes.

Action.SetMediaItems

Calls setMediaSources.

Action.SetMediaItemsResetPosition

Calls setMediaSources.

Action.SetPlayWhenReady

Calls setPlayWhenReady.

Action.SetPlaybackParameters

Calls setPlaybackParameters.

Action.SetRendererDisabled

Updates the Parameters of a DefaultTrackSelector to specify whether the renderer at a given index should be disabled.

Action.SetRepeatMode

Calls setRepeatMode.

Action.SetShuffleModeEnabled

Calls setShuffleModeEnabled.

Action.SetShuffleOrder

Calls setShuffleOrder .

Action.SetVideoSurface

Calls setVideoSurface.

Action.Stop

Calls stop.

Action.ThrowPlaybackException

Throws a playback exception on the playback thread.

Action.WaitForIsLoading

Waits for a specified loading state, returning either immediately or after a call to onIsLoadingChanged.

Action.WaitForMessage

Waits for a player message to arrive.

Action.WaitForPendingPlayerCommands

Waits until the player acknowledged all pending player commands.

Action.WaitForPlayWhenReady

Waits for a specified playWhenReady value, returning either immediately or after a call to onPlayWhenReadyChanged.

Action.WaitForPlaybackState

Waits for a specified playback state, returning either immediately or after a call to onPlaybackStateChanged.

Action.WaitForPositionDiscontinuity

Waits for onPositionDiscontinuity.

Action.WaitForTimelineChanged

Waits for onTimelineChanged.

ActionSchedule

Schedules a sequence of Actions for execution during a test.

ActionSchedule.Builder

A builder for ActionSchedule instances.

ActionSchedule.PlayerRunnable

Provides a wrapper for a Runnable which has access to the player.

ActionSchedule.PlayerTarget

Provides a wrapper for a Target which has access to the player when handling messages.

AdditionalFailureInfo

A JUnit Rule that attaches additional info to any errors/exceptions thrown by the test.

AssetContentProvider

A ContentProvider for reading asset data.

BitmapPixelTestUtil

Utilities for pixel tests.

BitmapPixelTestUtil.ImageBuffer

Represents a ByteBuffer read from an Image.

CacheAsserts

Assertion methods for Cache.

CacheAsserts.RequestSet

Defines a set of data requests.

CapturingAudioSink

A ForwardingAudioSink that captures configuration, discontinuity and buffer events.

CapturingImageOutput

A ImageOutput that captures image availability events.

CapturingRenderersFactory

A RenderersFactory that captures interactions with the audio and video instances and ImageOutput instances.

DataSourceContractTest

A collection of contract tests for DataSource implementations.

DataSourceContractTest.FakeTransferListener

A TransferListener that only keeps track of the transferred bytes.

DataSourceContractTest.TestResource

Information about a resource that can be used to test the DataSource instance.

DataSourceContractTest.TestResource.Builder

Builder for TestResource instances.

DecodeOneFrameUtil

Utilities for decoding a video frame for tests.

DecoderCountersUtil

Assertions for DecoderCounters.

DefaultRenderersFactoryAsserts

Assertions for DefaultRenderersFactory.

DownloadBuilder

Builder for Download.

DummyMainThread

Helper class to simulate main/UI thread in tests.

DumpFileAsserts

Helper class to enable assertions based on golden-data dump files.

DumpableFormat

Wraps a Format to allow dumping it.

DumpableMp4Box

Wraps an Mp4 box to allow dumping it.

Dumper

Helper utility to dump field values.

ExoHostedTest

A HostedTest for ExoPlayer playback tests.

ExoPlayerTestRunner

Helper class to run an ExoPlayer test.

ExoPlayerTestRunner.Builder

Builder to set-up an ExoPlayerTestRunner.

ExtractorAsserts

Assertion methods for Extractor.

ExtractorAsserts.AssertionConfig

A config for the assertions made (e.g. dump file location).

ExtractorAsserts.AssertionConfig.Builder

Builder for AssertionConfig instances.

ExtractorAsserts.SimulationConfig

A config of different environments to simulate and extractor behaviours to test.

FailOnCloseDataSink

A DataSink that can simulate caching the bytes being written to it, and then failing to persist them when close is called.

FailOnCloseDataSink.Factory

Factory to create a FailOnCloseDataSink.

FakeAdaptiveDataSet

Fake data set emulating the data of an adaptive media source.

FakeAdaptiveDataSet.Factory

Factory for FakeAdaptiveDataSets.

FakeAdaptiveDataSet.Iterator

MediaChunkIterator for the chunks defined by a fake adaptive data set.

FakeAdaptiveMediaPeriod

Fake MediaPeriod that provides tracks from the given TrackGroupArray.

FakeAdaptiveMediaSource

Fake MediaSource that provides a given timeline.

FakeAudioRenderer

A FakeRenderer that supports TRACK_TYPE_AUDIO.

FakeChunkSource

Fake ChunkSource with adaptive media chunks of a given duration.

FakeChunkSource.Factory

Factory for a FakeChunkSource.

FakeClock

Fake Clock implementation that allows to advance the time manually to trigger pending timed messages.

FakeClock.HandlerMessage

Message data saved to send messages or execute runnables at a later time on a Handler.

FakeCryptoConfig

Fake CryptoConfig.

FakeDataSet

Collection of FakeData to be served by a FakeDataSource.

FakeDataSet.FakeData

Container of fake data to be served by a FakeDataSource.

FakeDataSet.FakeData.Segment

A segment of FakeData.

FakeDataSource

A fake DataSource capable of simulating various scenarios.

FakeDataSource.Factory

Factory to create a FakeDataSource.

FakeExoMediaDrm

A fake implementation of ExoMediaDrm for use in tests.

FakeExoMediaDrm.Builder

Builder for FakeExoMediaDrm instances.

FakeExoMediaDrm.LicenseServer

An license server implementation to interact with FakeExoMediaDrm.

FakeExtractorInput

A fake ExtractorInput capable of simulating various scenarios.

FakeExtractorInput.Builder

Builder of FakeExtractorInput instances.

FakeExtractorOutput

A fake ExtractorOutput.

FakeMediaChunk

Fake MediaChunk.

FakeMediaChunkIterator

Fake MediaChunkIterator.

FakeMediaClockRenderer

Fake abstract Renderer which is also a MediaClock.

FakeMediaPeriod

Fake MediaPeriod that provides tracks from the given TrackGroupArray.

FakeMediaSource

Fake MediaSource that provides a given timeline.

FakeMediaSource.InitialTimeline

A forwarding timeline to provide an initial timeline for fake multi window sources.

FakeMediaSourceFactory

Fake MediaSourceFactory that creates a FakeMediaSource.

FakeMetadataEntry

A fake Metadata.Entry.

FakeMultiPeriodLiveTimeline

A fake Timeline that produces a live window with periods according to the available time range.

FakeRenderer

Fake Renderer that supports any format with the matching track type.

FakeSampleStream

Fake SampleStream that outputs a given Format and any amount of items.

FakeSampleStream.FakeSampleStreamItem

Item to customize a return value of readData.

FakeShuffleOrder

Fake ShuffleOrder which returns a reverse order.

FakeTimeline

Fake Timeline which can be setup to return custom TimelineWindowDefinitions.

FakeTimeline.TimelineWindowDefinition

Definition used to define a FakeTimeline.

FakeTrackOutput

A fake TrackOutput.

FakeTrackSelection

A fake ExoTrackSelection that only returns 1 fixed track, and allows querying the number of calls to its methods.

FakeTrackSelector

A fake MappingTrackSelector that returns FakeTrackSelections.

FakeTrackSelector.FakeTrackSelectionFactory

A factory for the androidx.media3.test.utils.FakeTrackSelection instances requested by the FakeTrackSelector.

FakeVideoRenderer

A FakeRenderer that supports TRACK_TYPE_VIDEO.

HostActivity

A host activity for performing playback tests.

HttpDataSourceTestEnv

A JUnit Rule that creates test resources for HttpDataSource contract tests.

MediaPeriodAsserts

Assertion methods for MediaPeriod.

MediaSourceTestRunner

A runner for MediaSource tests.

MssimCalculator

Image comparison tool that calculates the Mean Structural Similarity (MSSIM) of two images, developed by Wang, Bovik, Sheikh, and Simoncelli.

OggFileAudioBufferSink

A sink for audio buffers that writes output audio as .ogg files with a given path prefix.

SsimHelper

A helper for calculating SSIM score for transcoded videos.

StubExoPlayer

An abstract ExoPlayer implementation that throws UnsupportedOperationException from every method.

StubPlayer

An abstract Player implementation that throws UnsupportedOperationException from every method.

TestExoPlayerBuilder

A builder of ExoPlayer instances for testing.

TestSpeedProvider

SpeedProvider for tests

TestUtil

Utility methods for tests.

TextureBitmapReader

Reads from an OpenGL texture.

ThreadTestUtil

Static utility to coordinate threads in testing environments.

ThrowingSubtitleParserFactory

A SubtitleParser.Factory for SubtitleParser instances that throw an exception on every call to parse.

TimelineAsserts

Assertion methods for Timeline.

VideoDecodingWrapper

A wrapper for decoding a video using MediaCodec.

VideoFrameProcessorTestRunner

A test runner for VideoFrameProcessor tests.

VideoFrameProcessorTestRunner.Builder

A builder for VideoFrameProcessorTestRunner instances.

VideoFrameProcessorTestRunner.SurfaceBitmapReader

Reads from a Surface.

WebServerDispatcher

A Dispatcher for okhttp3.mockwebserver.MockWebServer that allows per-path customisation of the static data served.

WebServerDispatcher.Resource

A resource served by WebServerDispatcher.

WebServerDispatcher.Resource.Builder

Builder for Resource.

Exceptions