Package com.google.android.exoplayer2.testutil

## Class FakeAdaptiveMediaSource

- java.lang.Object
- - com.google.android.exoplayer2.source.BaseMediaSource
  - - com.google.android.exoplayer2.testutil.FakeMediaSource
    - - com.google.android.exoplayer2.testutil.FakeAdaptiveMediaSource

- All Implemented Interfaces:
    `MediaSource`

      public class FakeAdaptiveMediaSource
      extends FakeMediaSource

  Fake `MediaSource` that provides a given timeline. Creating the period returns a `FakeAdaptiveMediaPeriod` from the given `TrackGroupArray`.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.google.android.exoplayer2.testutil.FakeMediaSource

      `FakeMediaSource.InitialTimeline`

    - ### Nested classes/interfaces inherited from interface com.google.android.exoplayer2.source.MediaSource

      `MediaSource.MediaPeriodId, MediaSource.MediaSourceCaller`

  - ### Field Summary

    - ### Fields inherited from class com.google.android.exoplayer2.testutil.FakeMediaSource

      `FAKE_MEDIA_ITEM`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `FakeAdaptiveMediaSource​(Timeline timeline, TrackGroupArray trackGroupArray, FakeChunkSource.Factory chunkSourceFactory)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected MediaPeriod` | `createMediaPeriod​(MediaSource.MediaPeriodId id, TrackGroupArray trackGroupArray, Allocator allocator, MediaSourceEventListener.EventDispatcher mediaSourceEventDispatcher, DrmSessionManager drmSessionManager, DrmSessionEventListener.EventDispatcher drmEventDispatcher, TransferListener transferListener)` | Creates a `MediaPeriod` for this media source.
    `void` | `releaseMediaPeriod​(MediaPeriod mediaPeriod)` | Releases a media period created by `FakeMediaSource.createMediaPeriod(MediaPeriodId, TrackGroupArray, Allocator, MediaSourceEventListener.EventDispatcher, DrmSessionManager, DrmSessionEventListener.EventDispatcher, TransferListener)`.

    - ### Methods inherited from class com.google.android.exoplayer2.testutil.FakeMediaSource

      `assertMediaPeriodCreated, assertReleased, createPeriod, getCreatedMediaPeriods, getInitialTimeline, getMediaItem, getTimeline, isPrepared, isSingleWindow, maybeThrowSourceInfoRefreshError, prepareSourceInternal, releasePeriod, releaseSourceInternal, setAllowPreparation, setNewSourceInfo, setNewSourceInfo`

    - ### Methods inherited from class com.google.android.exoplayer2.source.BaseMediaSource

      `addDrmEventListener, addEventListener, createDrmEventDispatcher, createDrmEventDispatcher, createEventDispatcher, createEventDispatcher, createEventDispatcher, disable, disableInternal, enable, enableInternal, isEnabled, prepareSource, refreshSourceInfo, releaseSource, removeDrmEventListener, removeEventListener`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FakeAdaptiveMediaSource

          public FakeAdaptiveMediaSource​(Timeline timeline,
                                         TrackGroupArray trackGroupArray,
                                         FakeChunkSource.Factory chunkSourceFactory)

  - ### Method Detail

    - #### createMediaPeriod

          protected MediaPeriod createMediaPeriod​(MediaSource.MediaPeriodId id,
                                                  TrackGroupArray trackGroupArray,
                                                  Allocator allocator,
                                                  MediaSourceEventListener.EventDispatcher mediaSourceEventDispatcher,
                                                  DrmSessionManager drmSessionManager,
                                                  DrmSessionEventListener.EventDispatcher drmEventDispatcher,
                                                  @Nullable
                                                  TransferListener transferListener)

      Description copied from class: `FakeMediaSource`
      Creates a `MediaPeriod` for this media source.
      Overrides:
        `createMediaPeriod` in class `FakeMediaSource`
      Parameters:
        `id` - The identifier of the period.
        `trackGroupArray` - The `TrackGroupArray` supported by the media period.
        `allocator` - An `Allocator` from which to obtain media buffer allocations.
        `mediaSourceEventDispatcher` - An `MediaSourceEventListener.EventDispatcher` to dispatch media source events.
        `drmEventDispatcher` - An `MediaSourceEventListener.EventDispatcher` to dispatch DRM events.
        `transferListener` - The transfer listener which should be informed of any data transfers. May be null if no listener is available.
      Returns:
        A new `FakeMediaPeriod`.

    - #### releaseMediaPeriod

          public void releaseMediaPeriod​(MediaPeriod mediaPeriod)

      Description copied from class: `FakeMediaSource`
      Releases a media period created by `FakeMediaSource.createMediaPeriod(MediaPeriodId, TrackGroupArray, Allocator, MediaSourceEventListener.EventDispatcher, DrmSessionManager, DrmSessionEventListener.EventDispatcher, TransferListener)`.
      Overrides:
        `releaseMediaPeriod` in class `FakeMediaSource`