Back to Exoplayer

MediaSource.Factory (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/source/MediaSource.Factory.html

latest6.4 KB
Original Source

Package com.google.android.exoplayer2.source

Interface MediaSource.Factory

  • All Known Subinterfaces:MediaSourceFactoryAll Known Implementing Classes:DashMediaSource.Factory, DefaultMediaSourceFactory, FakeMediaSourceFactory, HlsMediaSource.Factory, ImaServerSideAdInsertionMediaSource.Factory, ProgressiveMediaSource.Factory, RtspMediaSource.Factory, SsMediaSource.FactoryEnclosing interface:MediaSource

public static interfaceMediaSource.Factory

Factory for creating MediaSources from MediaItems.

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | static MediaSource.Factory | UNSUPPORTED | An instance that throws UnsupportedOperationException from createMediaSource(com.google.android.exoplayer2.MediaItem) and getSupportedTypes(). |

Method Summary

All Methods Instance Methods Abstract Methods Default Methods | Modifier and Type | Method | Description | | --- | --- | --- | | MediaSource | createMediaSource​(MediaItem mediaItem) | Creates a new MediaSource with the specified MediaItem. | | @com.google.android.exoplayer2.C.ContentType int[] | getSupportedTypes() | Returns the content types supported by media sources created by this factory. | | default MediaSource.Factory | setCmcdConfigurationFactory​(CmcdConfiguration.Factory cmcdConfigurationFactory) | Sets the CmcdConfiguration.Factory used to obtain a CmcdConfiguration for a MediaItem. | | MediaSource.Factory | setDrmSessionManagerProvider​(DrmSessionManagerProvider drmSessionManagerProvider) | Sets the DrmSessionManagerProvider used to obtain a DrmSessionManager for a MediaItem. | | MediaSource.Factory | setLoadErrorHandlingPolicy​(LoadErrorHandlingPolicy loadErrorHandlingPolicy) | Sets an optional LoadErrorHandlingPolicy. |

Field Detail

- 

UNSUPPORTED

static final[MediaSource.Factory](MediaSource.Factory.html "interface in com.google.android.exoplayer2.source")UNSUPPORTED

An instance that throws UnsupportedOperationException from createMediaSource(com.google.android.exoplayer2.MediaItem) and getSupportedTypes().

Method Detail

- 

setCmcdConfigurationFactory

default[MediaSource.Factory](MediaSource.Factory.html "interface in com.google.android.exoplayer2.source")setCmcdConfigurationFactory​([CmcdConfiguration.Factory](../upstream/CmcdConfiguration.Factory.html "interface in com.google.android.exoplayer2.upstream")cmcdConfigurationFactory)

Sets the CmcdConfiguration.Factory used to obtain a CmcdConfiguration for a MediaItem. Returns:This factory, for convenience.

- 

setDrmSessionManagerProvider

[MediaSource.Factory](MediaSource.Factory.html "interface in com.google.android.exoplayer2.source")setDrmSessionManagerProvider​([DrmSessionManagerProvider](../drm/DrmSessionManagerProvider.html "interface in com.google.android.exoplayer2.drm")drmSessionManagerProvider)

Sets the DrmSessionManagerProvider used to obtain a DrmSessionManager for a MediaItem. Returns:This factory, for convenience.

- 

setLoadErrorHandlingPolicy

[MediaSource.Factory](MediaSource.Factory.html "interface in com.google.android.exoplayer2.source")setLoadErrorHandlingPolicy​([LoadErrorHandlingPolicy](../upstream/LoadErrorHandlingPolicy.html "interface in com.google.android.exoplayer2.upstream")loadErrorHandlingPolicy)

Sets an optional LoadErrorHandlingPolicy. Returns:This factory, for convenience.

- 

getSupportedTypes

[@ContentType](../C.ContentType.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.C.ContentType int[] getSupportedTypes()

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

- 

createMediaSource

[MediaSource](MediaSource.html "interface in com.google.android.exoplayer2.source")createMediaSource​([MediaItem](../MediaItem.html "class in com.google.android.exoplayer2")mediaItem)

Creates a new MediaSource with the specified MediaItem. Parameters:mediaItem - The media item to play.Returns:The new media source.