Class DecoderSelectionHelper

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      boolean shouldUseDecoder(DecoderType decoderType, String decoderName, MediaCodecInfo codecInfo) Returns whether the specified codec is usable for decoding on the current device.
      boolean shouldApplySecureExtensionWorkaround(DecoderType decoderType, String decoderName, MediaCodecInfo codecInfo) Returns whether the codec-specific secure extension workaround should be used for the decoder on the current device.
      boolean shouldOverrideBuiltInDecoderSelectionLogic() Returns whether the built-in decoder selection logic of the player should be completely overridden by the DecoderSelectionHelper class.
      boolean isRepresentationSupported(String mimeType, String codecs, double bandwidth, int width, int height, double frameRate, double audioSamplingRate) Returns whether the specified representation is supported on the current device.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DecoderSelectionHelper

        DecoderSelectionHelper()
    • Method Detail

      • shouldUseDecoder

         boolean shouldUseDecoder(DecoderType decoderType, String decoderName, MediaCodecInfo codecInfo)

        Returns whether the specified codec is usable for decoding on the current device. For the default use-case always return TRUE. To apply the workaround on specific devices and decoders (skip a decoder), return FALSE.

        Parameters:
        decoderType - the decoder type, can be "audio" or "video"
        decoderName - the selected decoder name provided by the device for playback.
        codecInfo - more information about the codec (if knowing the name is not enough)
        Returns:

        whether the specified codec is usable for decoding on the current device.

      • shouldApplySecureExtensionWorkaround

         boolean shouldApplySecureExtensionWorkaround(DecoderType decoderType, String decoderName, MediaCodecInfo codecInfo)

        Returns whether the codec-specific secure extension workaround should be used for the decoder on the current device. For the default use-case always return FALSE. To apply the workaround on specific devices and decoders, return TRUE. *

        • The player by default always tries to use the preferred decoder by the device.
        • In some cases these decoders are not the best for certain playback use-cases, so this flag can help to pick an other one.
        • This is a global setting for all player instances. Strongly suggest you to only flip this flag when it is really needed, per device basis.
        • If you find a device where this flag makes a difference, please report it on our Service Desk.
        • This API is in an experimental stage and may be subject to breaking changes.
        Parameters:
        decoderType - the decoder type, can be "audio" or "video"
        decoderName - the selected decoder name provided by the device for playback.
        codecInfo - more information about the codec (if knowing the name is not enough)
        Returns:

        whether the workaround should be applied for the specified codec for decoding on the current device.

      • shouldOverrideBuiltInDecoderSelectionLogic

         boolean shouldOverrideBuiltInDecoderSelectionLogic()

        Returns whether the built-in decoder selection logic of the player should be completely overridden by the DecoderSelectionHelper class. For the default use-case always return FALSE.

        • By default DecoderSelectionHelper enhances the decoder selection logic.
        • When playing a video and selecting a decoder, first the built-in checks of the player will be applied.
        • If a "decoder and device" combination falls through these checks (so the player is not aware of any defective behaviour of the default selected codec)
        • the player assumes it is the right one for playback). Then a call to shouldUseDecoder will happen
        • to see if there are other rules that could improve the decoder selection, and maybe blacklist the current one.
        • If this method return TRUE, the built-in checks will be skipped and every call will be delivered to shouldUseDecoder immediately.
        • NOTE: this means not handling the default built-in use-cases in shouldUseDecoder could cause faulty playback on certain devices.
        Returns:

        whether the built-in decoder selection logic of the player should be completely overridden.

      • isRepresentationSupported

        @ApiStatus.Experimental() boolean isRepresentationSupported(String mimeType, String codecs, double bandwidth, int width, int height, double frameRate, double audioSamplingRate)

        Returns whether the specified representation is supported on the current device. For the default use-case always return TRUE. To apply the workaround on specific devices (skip a representation), return FALSE.

        Parameters:
        mimeType - The mime type of the representation.
        codecs - The codecs specified in the manifest for the representation.
        bandwidth - The bandwidth of the representation.
        width - The width of the representation if it is a video, 0 otherwise.
        height - The height of the representation if it is a video, 0 otherwise.
        frameRate - The frameRate of the representation if it is a video, 0 otherwise.
        audioSamplingRate - The audioSamplingRate of the representation if it is an audio, -1 otherwise.
        Returns:

        whether the specified representation is supported on the current device.