FakeMediaSourceFactory


@UnstableApi
public final class FakeMediaSourceFactory implements MediaSourceFactory


Fake MediaSourceFactory that creates a FakeMediaSource.

Summary

Constants

static final Object

The window UID used by media sources that are created by the factory.

Public constructors

Public methods

MediaSource

Creates a new MediaSource with the specified MediaItem.

FakeMediaSource

Returns the last created FakeMediaSource.

int[]

Returns the content types supported by media sources created by this factory.

MediaSourceFactory
setDrmSessionManagerProvider(
    DrmSessionManagerProvider drmSessionManagerProvider
)

Sets the DrmSessionManagerProvider used to obtain a DrmSessionManager for a MediaItem.

MediaSourceFactory
setLoadErrorHandlingPolicy(
    LoadErrorHandlingPolicy loadErrorHandlingPolicy
)

Sets an optional LoadErrorHandlingPolicy.

Inherited methods

From androidx.media3.exoplayer.source.MediaSource.Factory
MediaSource.Factory
@UnstableApi
experimentalParseSubtitlesDuringExtraction(
    boolean parseSubtitlesDuringExtraction
)

This method is deprecated.

This method (and all support for 'legacy' subtitle decoding during rendering) will be removed in a future release.

MediaSource.Factory

Sets the CmcdConfiguration.Factory used to obtain a CmcdConfiguration for a MediaItem.

MediaSource.Factory

Sets the SubtitleParser.Factory to be used for parsing subtitles during extraction.

Constants

DEFAULT_WINDOW_UID

public static final Object DEFAULT_WINDOW_UID

The window UID used by media sources that are created by the factory.

Public fields

Public constructors

FakeMediaSourceFactory

public FakeMediaSourceFactory()

Public methods

createMediaSource

public MediaSource createMediaSource(MediaItem mediaItem)

Creates a new MediaSource with the specified MediaItem.

Parameters
MediaItem mediaItem

The media item to play.

Returns
MediaSource

The new media source.

getLastCreatedSource

public FakeMediaSource getLastCreatedSource()

Returns the last created FakeMediaSource.

Must be called after at least one FakeMediaSource is created.

getSupportedTypes

@C.ContentType
public int[] getSupportedTypes()

Returns the content types supported by media sources created by this factory.

setDrmSessionManagerProvider

public MediaSourceFactory setDrmSessionManagerProvider(
    DrmSessionManagerProvider drmSessionManagerProvider
)

Sets the DrmSessionManagerProvider used to obtain a DrmSessionManager for a MediaItem.

Returns
MediaSourceFactory

This factory, for convenience.

setLoadErrorHandlingPolicy

public MediaSourceFactory setLoadErrorHandlingPolicy(
    LoadErrorHandlingPolicy loadErrorHandlingPolicy
)

Sets an optional LoadErrorHandlingPolicy.

Returns
MediaSourceFactory

This factory, for convenience.