Enum Class AudioFocusChange

java.lang.Object
java.lang.Enum<AudioFocusChange>
com.jwplayer.pub.api.AudioFocusChange
All Implemented Interfaces:
Serializable, Comparable<AudioFocusChange>, Constable

public enum AudioFocusChange extends Enum<AudioFocusChange>
Audio-focus changes reported to an AudioFocusListener.

Only reported while the SDK manages audio focus, i.e. when ExoPlayerSettings.setAudioFocusHandlingEnabled(boolean) is true.

  • Enum Constant Details

    • GAINED

      public static final AudioFocusChange GAINED
      The player holds audio focus: the focus request was granted, or focus came back after a transient loss.
    • LOST

      public static final AudioFocusChange LOST
      Focus was lost permanently (for example another media app started playing), or a focus request was refused. The player pauses with PauseReason.AUDIO_INTERRUPTION and does not resume by itself.
    • LOST_TRANSIENT

      public static final AudioFocusChange LOST_TRANSIENT
      Focus was lost for a short time (for example a voice-assistant prompt or a phone call). The player pauses with PauseReason.AUDIO_INTERRUPTION and resumes when focus returns, unless playback was paused or played by the user or the app in between.
    • DUCK

      public static final AudioFocusChange DUCK
      Another app asked the player to lower its volume. On Android 8.0 (API 26) and later the system ducks the player automatically and this is not reported. On older versions the player pauses and resumes as for LOST_TRANSIENT.
  • Method Details

    • values

      public static AudioFocusChange[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static AudioFocusChange valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null