Package com.google.android.exoplayer2.source

## Class MediaParserExtractorAdapter

- java.lang.Object
- - com.google.android.exoplayer2.source.MediaParserExtractorAdapter

- All Implemented Interfaces:
    `ProgressiveMediaExtractor`

      @RequiresApi(30)
      public final class MediaParserExtractorAdapter
      extends Object
      implements ProgressiveMediaExtractor

  `ProgressiveMediaExtractor` implemented on top of the platform's `MediaParser`.

- - ### Nested Class Summary

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

      `ProgressiveMediaExtractor.Factory`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static ProgressiveMediaExtractor.Factory` | `FACTORY` | A `ProgressiveMediaExtractor.Factory` for instances of this class, which rely on platform extractors through `MediaParser`.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `MediaParserExtractorAdapter()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `disableSeekingOnMp3Streams()` | Disables seeking in MP3 streams.
    `long` | `getCurrentInputPosition()` | Returns the current read position in the input stream, or `C.POSITION_UNSET` if no input is available.
    `void` | `init​(DataReader dataReader, Uri uri, Map<String,​List<String>> responseHeaders, long position, long length, ExtractorOutput output)` | Initializes the underlying infrastructure for reading from the input.
    `int` | `read​(PositionHolder positionHolder)` | Extracts data starting at the current input stream position.
    `void` | `release()` | Releases any held resources.
    `void` | `seek​(long position, long seekTimeUs)` | Notifies the extracting infrastructure that a seek has occurred.

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

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

- - ### Field Detail

    - #### FACTORY

          public static final ProgressiveMediaExtractor.Factory FACTORY

      A `ProgressiveMediaExtractor.Factory` for instances of this class, which rely on platform extractors through `MediaParser`.

  - ### Constructor Detail

    - #### MediaParserExtractorAdapter

          public MediaParserExtractorAdapter()

  - ### Method Detail

    - #### init

          public void init​(DataReader dataReader,
                           Uri uri,
                           Map<String,​List<String>> responseHeaders,
                           long position,
                           long length,
                           ExtractorOutput output)
                    throws IOException

      Description copied from interface: `ProgressiveMediaExtractor`
      Initializes the underlying infrastructure for reading from the input.
      Specified by:
        `init` in interface `ProgressiveMediaExtractor`
      Parameters:
        `dataReader` - The `DataReader` from which data should be read.
        `uri` - The `Uri` from which the media is obtained.
        `responseHeaders` - The response headers of the media, or an empty map if there are none.
        `position` - The initial position of the `dataReader` in the stream.
        `length` - The length of the stream, or `C.LENGTH_UNSET` if length is unknown.
        `output` - The `ExtractorOutput` that will be used to initialize the selected extractor.
      Throws:
        `UnrecognizedInputFormatException` - Thrown if the input format could not be detected.
        `IOException` - Thrown if the input could not be read.

    - #### release

          public void release()

      Description copied from interface: `ProgressiveMediaExtractor`
      Releases any held resources.
      Specified by:
        `release` in interface `ProgressiveMediaExtractor`

    - #### disableSeekingOnMp3Streams

          public void disableSeekingOnMp3Streams()

      Description copied from interface: `ProgressiveMediaExtractor`
      Disables seeking in MP3 streams.

      MP3 live streams commonly have seekable metadata, despite being unseekable.

      Specified by:
        `disableSeekingOnMp3Streams` in interface `ProgressiveMediaExtractor`

    - #### getCurrentInputPosition

          public long getCurrentInputPosition()

      Description copied from interface: `ProgressiveMediaExtractor`
      Returns the current read position in the input stream, or `C.POSITION_UNSET` if no input is available.
      Specified by:
        `getCurrentInputPosition` in interface `ProgressiveMediaExtractor`

    - #### seek

          public void seek​(long position,
                           long seekTimeUs)

      Description copied from interface: `ProgressiveMediaExtractor`
      Notifies the extracting infrastructure that a seek has occurred.
      Specified by:
        `seek` in interface `ProgressiveMediaExtractor`
      Parameters:
        `position` - The byte offset in the stream from which data will be provided.
        `seekTimeUs` - The seek time in microseconds.

    - #### read

          public int read​(PositionHolder positionHolder)
                   throws IOException

      Description copied from interface: `ProgressiveMediaExtractor`
      Extracts data starting at the current input stream position.
      Specified by:
        `read` in interface `ProgressiveMediaExtractor`
      Parameters:
        `positionHolder` - If `Extractor.RESULT_SEEK` is returned, this holder is updated to hold the position of the required data.
      Returns:
        One of the `Extractor``.RESULT_*` values.
      Throws:
        `IOException` - If an error occurred reading from the input.