# FakeAdaptiveMediaSource

Artifact: [androidx.media3:media3-test-utils](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/test/utils/FakeAdaptiveMediaSource.java+class:androidx.media3.test.utils.FakeAdaptiveMediaSource)

*** ** * ** ***

<br />

```
@UnstableApi
class FakeAdaptiveMediaSource : FakeMediaSource
```

<br />

|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) ||||
| ↳ | [androidx.media3.exoplayer.source.BaseMediaSource](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource) |||
|   | ↳ | [androidx.media3.test.utils.FakeMediaSource](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource) ||
|   |   | ↳ | [androidx.media3.test.utils.FakeAdaptiveMediaSource](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeAdaptiveMediaSource) |

*** ** * ** ***

Fake `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource` that provides a given timeline. Creating the period returns a `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeAdaptiveMediaPeriod` from the given `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeAdaptiveMediaSource#FakeAdaptiveMediaSource(androidx.media3.common.Timeline,androidx.media3.exoplayer.source.TrackGroupArray,androidx.media3.test.utils.FakeChunkSource.Factory)( timeline: https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline!, trackGroupArray: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray!, chunkSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeChunkSource.Factory! )` |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeAdaptiveMediaSource#releaseMediaPeriod(androidx.media3.exoplayer.source.MediaPeriod)(mediaPeriod: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod!)` Releases a media period created by `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#createMediaPeriod(androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.source.TrackGroupArray,androidx.media3.exoplayer.upstream.Allocator,androidx.media3.exoplayer.source.MediaSourceEventListener.EventDispatcher,androidx.media3.exoplayer.drm.DrmSessionManager,androidx.media3.exoplayer.drm.DrmSessionEventListener.EventDispatcher,androidx.media3.datasource.TransferListener)`. |

| ### Protected functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeAdaptiveMediaSource#createMediaPeriod(androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.source.TrackGroupArray,androidx.media3.exoplayer.upstream.Allocator,androidx.media3.exoplayer.source.MediaSourceEventListener.EventDispatcher,androidx.media3.exoplayer.drm.DrmSessionManager,androidx.media3.exoplayer.drm.DrmSessionEventListener.EventDispatcher,androidx.media3.datasource.TransferListener)( id: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId!, trackGroupArray: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray!, allocator: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Allocator!, mediaSourceEventDispatcher: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceEventListener.EventDispatcher!, drmSessionManager: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionManager!, drmEventDispatcher: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionEventListener.EventDispatcher!, transferListener: https://developer.android.com/reference/kotlin/androidx/media3/datasource/TransferListener? )` Creates a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod` for this media source. |

### Inherited Constants

From [androidx.media3.test.utils.FakeMediaSource](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource) `const https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#FAKE_MEDIA_ITEM()`

The media item used by the fake media source.

### Inherited functions

From [androidx.media3.exoplayer.source.BaseMediaSource](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#addDrmEventListener(android.os.Handler,androidx.media3.exoplayer.drm.DrmSessionEventListener)(

handler: https://developer.android.com/reference/android/os/Handler.html!,

eventListener: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionEventListener!

)`

Adds a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionEventListener` to the list of listeners which are notified of DRM events for this media source.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#addEventListener(android.os.Handler,androidx.media3.exoplayer.source.MediaSourceEventListener)(

handler: https://developer.android.com/reference/android/os/Handler.html!,

eventListener: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceEventListener!

)`

Adds a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceEventListener` to the list of listeners which are notified of media source events.
`https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionEventListener.EventDispatcher!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#createDrmEventDispatcher(androidx.media3.exoplayer.source.MediaSource.MediaPeriodId)(mediaPeriodId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId?)`

Returns a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionEventListener.EventDispatcher` which dispatches all events to the registered listeners with the specified `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId`
`https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionEventListener.EventDispatcher!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#createDrmEventDispatcher(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId)(

windowIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,

mediaPeriodId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId?

)`

Returns a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionEventListener.EventDispatcher` which dispatches all events to the registered listeners with the specified window index and `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId`.
`https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceEventListener.EventDispatcher!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#createEventDispatcher(androidx.media3.exoplayer.source.MediaSource.MediaPeriodId)(mediaPeriodId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId?)`

Returns a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceEventListener.EventDispatcher` which dispatches all events to the registered listeners with the specified `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId`.
`https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceEventListener.EventDispatcher!` `[createEventDispatcher](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#createEventDispatcher(androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,long))(

mediaPeriodId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId!,

mediaTimeOffsetMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html

)`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#createEventDispatcher(androidx.media3.exoplayer.source.MediaSource.MediaPeriodId)` instead.

<br />

`https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceEventListener.EventDispatcher!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#createEventDispatcher(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId)(

windowIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,

mediaPeriodId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId?

)`

Returns a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceEventListener.EventDispatcher` which dispatches all events to the registered listeners with the specified window index and `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId`.
`https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceEventListener.EventDispatcher!` `[createEventDispatcher](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#createEventDispatcher(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,long))(

windowIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,

mediaPeriodId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId?,

mediaTimeOffsetMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html

)`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#createEventDispatcher(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId)` instead.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#disable(androidx.media3.exoplayer.source.MediaSource.MediaSourceCaller)(caller: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaSourceCaller!)`

Disables the source for the creation of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#disableInternal()()`

Disables the source, see `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource#disable(androidx.media3.exoplayer.source.MediaSource.MediaSourceCaller)`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#enable(androidx.media3.exoplayer.source.MediaSource.MediaSourceCaller)(caller: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaSourceCaller!)`

Enables the source for the creation of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#enableInternal()()`

Enables the source, see `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource#enable(androidx.media3.exoplayer.source.MediaSource.MediaSourceCaller)`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#isEnabled()()`

Returns whether the source is enabled.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#prepareSource(androidx.media3.exoplayer.source.MediaSource.MediaSourceCaller,androidx.media3.exoplayer.analytics.PlayerId,androidx.media3.exoplayer.upstream.BandwidthMeter)(

caller: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaSourceCaller!,

playerId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId!,

bandwidthMeter: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/BandwidthMeter!

)`

Registers a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaSourceCaller`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#prepareSourceCalled()()`

Returns whether the source has `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource#prepareSource(androidx.media3.exoplayer.source.MediaSource.MediaSourceCaller,androidx.media3.exoplayer.analytics.PlayerId,androidx.media3.exoplayer.upstream.BandwidthMeter)` called.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#refreshSourceInfo(androidx.media3.common.Timeline)(timeline: https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline!)`

Updates timeline and manifest and notifies all listeners of the update.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#releaseSource(androidx.media3.exoplayer.source.MediaSource.MediaSourceCaller)(caller: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaSourceCaller!)`

Unregisters a caller, and disables and releases the source if no longer required.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#removeDrmEventListener(androidx.media3.exoplayer.drm.DrmSessionEventListener)(eventListener: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionEventListener!)`

Removes a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionEventListener` from the list of listeners which are notified of DRM events for this media source.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#removeEventListener(androidx.media3.exoplayer.source.MediaSourceEventListener)(eventListener: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceEventListener!)`

Removes a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceEventListener` from the list of listeners which are notified of media source events.
From [androidx.media3.test.utils.FakeMediaSource](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#assertMediaPeriodCreated(androidx.media3.exoplayer.source.MediaSource.MediaPeriodId)(mediaPeriodId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId!)`

Assert that a media period for the given id has been created.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#assertReleased()()`

Assert that the source and all periods have been released.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#canUpdateMediaItem(androidx.media3.common.MediaItem)(mediaItem: https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!)`

Returns whether the `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem` for this source can be updated with the provided item.
`https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod!` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#createPeriod(androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.upstream.Allocator,long)(

id: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId!,

allocator: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Allocator!,

startPositionUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html

)`

Returns a new `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod` identified by `periodId`.
`java-static https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource!` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#createWithWindowId(java.lang.Object)(windowId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!)`

Convenience method to create a `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource` with the given window id.
`(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId!>!` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#getCreatedMediaPeriods()()`

Returns a list of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId`s, with one element for each created media period.
`https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline?` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#getInitialTimeline()()`

Returns the initial placeholder timeline that is returned immediately when the real timeline is not yet known, or null to let the player create an initial timeline.
`https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod!` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#getLastCreatedActiveMediaPeriod()()`

Returns the last created active `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod`.
`https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#getMediaItem()()`

Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem` whose media is provided by the source.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#isPrepared()()`

Returns whether the source is currently prepared.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#isSingleWindow()()`

Returns true if the media source is guaranteed to never have zero or more than one window.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#maybeThrowSourceInfoRefreshError()()`

Throws any pending error encountered while loading or refreshing source information.
`synchronized https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#prepareSourceInternal(androidx.media3.datasource.TransferListener)(mediaTransferListener: https://developer.android.com/reference/kotlin/androidx/media3/datasource/TransferListener?)`

Starts source preparation and enables the source, see `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource#prepareSource(androidx.media3.exoplayer.source.MediaSource.MediaSourceCaller,androidx.media3.exoplayer.analytics.PlayerId,androidx.media3.exoplayer.upstream.BandwidthMeter)`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#releasePeriod(androidx.media3.exoplayer.source.MediaPeriod)(mediaPeriod: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod!)`

Releases the period.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#releaseSourceInternal()()`

Releases the source, see `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource#releaseSource(androidx.media3.exoplayer.source.MediaSource.MediaSourceCaller)`.
`synchronized https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#setAllowPreparation(boolean)(allowPreparation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Sets whether the next call to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#prepareSource(androidx.media3.exoplayer.source.MediaSource.MediaSourceCaller,androidx.media3.exoplayer.analytics.PlayerId,androidx.media3.exoplayer.upstream.BandwidthMeter)` is allowed to finish.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#setCanUpdateMediaItems(boolean)(canUpdateMediaItems: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Sets whether the source allows to update its `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem` via `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#updateMediaItem(androidx.media3.common.MediaItem)`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#setNewSourceInfo(androidx.media3.common.Timeline)(newTimeline: https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline!)`

Sets a new timeline.
`synchronized https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#setNewSourceInfo(androidx.media3.common.Timeline,boolean)(newTimeline: https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline!, sendManifestLoadEvents: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Sets a new timeline.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#setPeriodDefersOnPreparedCallback(boolean)(

periodDefersOnPreparedCallback: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html

)`

Sets whether the created `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaPeriod` should defer to call `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod.Callback#onPrepared(androidx.media3.exoplayer.source.MediaPeriod)`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#updateMediaItem(androidx.media3.common.MediaItem)(mediaItem: https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!)`

Updates the `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem` for this source.
From [androidx.media3.exoplayer.source.MediaSource](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi
[prepareSource](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource#prepareSource(androidx.media3.exoplayer.source.MediaSource.MediaSourceCaller,androidx.media3.datasource.TransferListener,androidx.media3.exoplayer.analytics.PlayerId))(

caller: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaSourceCaller!,

mediaTransferListener: https://developer.android.com/reference/kotlin/androidx/media3/datasource/TransferListener?,

playerId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId!

)`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource#prepareSource(androidx.media3.exoplayer.source.MediaSource.MediaSourceCaller,androidx.media3.exoplayer.analytics.PlayerId,androidx.media3.exoplayer.upstream.BandwidthMeter)` instead.

<br />

### Inherited properties

From [androidx.media3.exoplayer.source.BaseMediaSource](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource) `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/BandwidthMeter?` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#bandwidthMeter()` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId?` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/BaseMediaSource#playerId()` From [androidx.media3.test.utils.FakeMediaSource](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource) `@https://checkerframework.org/api/org/checkerframework/checker/nullness/qual/MonotonicNonNull.html https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline!` `@https://checkerframework.org/api/org/checkerframework/checker/nullness/qual/MonotonicNonNull.html
https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#timeline()`

## Public constructors

### FakeAdaptiveMediaSource

```
FakeAdaptiveMediaSource(
    timeline: Timeline!,
    trackGroupArray: TrackGroupArray!,
    chunkSourceFactory: FakeChunkSource.Factory!
)
```

## Public functions

### releaseMediaPeriod

```
fun releaseMediaPeriod(mediaPeriod: MediaPeriod!): Unit
```

Releases a media period created by `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource#createMediaPeriod(androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.source.TrackGroupArray,androidx.media3.exoplayer.upstream.Allocator,androidx.media3.exoplayer.source.MediaSourceEventListener.EventDispatcher,androidx.media3.exoplayer.drm.DrmSessionManager,androidx.media3.exoplayer.drm.DrmSessionEventListener.EventDispatcher,androidx.media3.datasource.TransferListener)`.

## Protected functions

### createMediaPeriod

```
protected fun createMediaPeriod(
    id: MediaSource.MediaPeriodId!,
    trackGroupArray: TrackGroupArray!,
    allocator: Allocator!,
    mediaSourceEventDispatcher: MediaSourceEventListener.EventDispatcher!,
    drmSessionManager: DrmSessionManager!,
    drmEventDispatcher: DrmSessionEventListener.EventDispatcher!,
    transferListener: TransferListener?
): MediaPeriod!
```

Creates a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod` for this media source.

| Parameters |
|---|---|
| `id: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId!` | The identifier of the period. |
| `trackGroupArray: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray!` | The `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray` supported by the media period. |
| `allocator: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Allocator!` | An `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Allocator` from which to obtain media buffer allocations. |
| `mediaSourceEventDispatcher: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceEventListener.EventDispatcher!` | An `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceEventListener.EventDispatcher` to dispatch media source events. |
| `drmSessionManager: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionManager!` | A `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionManager` to allow DRM interactions. |
| `drmEventDispatcher: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionEventListener.EventDispatcher!` | An `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceEventListener.EventDispatcher` to dispatch DRM events. |
| `transferListener: https://developer.android.com/reference/kotlin/androidx/media3/datasource/TransferListener?` | The transfer listener which should be informed of any data transfers. May be null if no listener is available. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod!` | A new `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod`. |