com.brightcove.player.util

## Class VideoFormatSelectorUtil

- java.lang.Object
- - com.brightcove.player.util.VideoFormatSelectorUtil

-     public final class VideoFormatSelectorUtil
      extends java.lang.Object

  Selects from possible video formats. The class is a derivative of VideoFormatSelectorUtil Google ExoPlayer 1 SDK.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int[]` | `selectVideoFormats(java.util.List<? extends com.google.android.exoplayer2.source.dash.manifest.Representation> formatWrappers, java.lang.String[] allowedContainerMimeTypes, boolean filterHdFormats, boolean orientationMayChange, int viewportWidth, int viewportHeight)` Chooses a suitable subset from a number of video formats.
    `static int[]` | `selectVideoFormatsForDefaultDisplay(android.content.Context context, java.util.List<? extends com.google.android.exoplayer2.source.dash.manifest.Representation> formatWrappers, java.lang.String[] allowedContainerMimeTypes, boolean filterHdFormats)` Chooses a suitable subset from a number of video formats, to be rendered on the device's default display.

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

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

- - ### Method Detail

    - #### selectVideoFormatsForDefaultDisplay

          public static int[] selectVideoFormatsForDefaultDisplay(android.content.Context context,
                                                                  java.util.List<? extends com.google.android.exoplayer2.source.dash.manifest.Representation> formatWrappers,
                                                                  java.lang.String[] allowedContainerMimeTypes,
                                                                  boolean filterHdFormats)
                                                           throws com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException

      Chooses a suitable subset from a number of video formats, to be rendered on the device's default display.
      Parameters:
        `context` - A context.
        `formatWrappers` - Wrapped formats from which to select.
        `allowedContainerMimeTypes` - An array of allowed container mime types. Null allows all mime types.
        `filterHdFormats` - True to filter HD formats. False otherwise.
      Returns:
        An array holding the indices of the selected formats.
      Throws:
        `com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException` - Thrown if there was an error querying decoders.

    - #### selectVideoFormats

          public static int[] selectVideoFormats(java.util.List<? extends com.google.android.exoplayer2.source.dash.manifest.Representation> formatWrappers,
                                                 java.lang.String[] allowedContainerMimeTypes,
                                                 boolean filterHdFormats,
                                                 boolean orientationMayChange,
                                                 int viewportWidth,
                                                 int viewportHeight)
                                          throws com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException

      Chooses a suitable subset from a number of video formats.

      A format is filtered (i.e. not selected) if:

      - `allowedContainerMimeTypes` is non-null and the format does not have one of the permitted mime types.
      - `filterHdFormats` is true and the format is HD.
      - It's determined that the video decoder isn't powerful enough to decode the format.
      - There exists another format of lower resolution whose resolution exceeds the maximum size in pixels that the video can be rendered within the viewport.
      Parameters:
        `formatWrappers` - Wrapped formats from which to select.
        `allowedContainerMimeTypes` - An array of allowed container mime types. Null allows all mime types.
        `filterHdFormats` - True to filter HD formats. False otherwise.
        `orientationMayChange` - True if the video's orientation may change with respect to the viewport during playback.
        `viewportWidth` - The width in pixels of the viewport within which the video will be displayed. If the viewport size may change, this should be set to the maximum possible width.
        `viewportHeight` - The height in pixels of the viewport within which the video will be displayed. If the viewport size may change, this should be set to the maximum possible height.
      Returns:
        An array holding the indices of the selected formats.
      Throws:
        `com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException`