List of usage examples for android.media AudioManager AUDIOFOCUS_NONE
int AUDIOFOCUS_NONE
To view the source code for android.media AudioManager AUDIOFOCUS_NONE.
Click Source Link
From source file:androidx.media.widget.VideoView2.java
/** * Sets which type of audio focus will be requested during the playback, or configures playback * to not request audio focus. Valid values for focus requests are * {@link AudioManager#AUDIOFOCUS_GAIN}, {@link AudioManager#AUDIOFOCUS_GAIN_TRANSIENT}, * {@link AudioManager#AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK}, and * {@link AudioManager#AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE}. Or use * {@link AudioManager#AUDIOFOCUS_NONE} to express that audio focus should not be * requested when playback starts. You can for instance use this when playing a silent animation * through this class, and you don't want to affect other audio applications playing in the * background.//from w w w . j a v a 2s.c o m * * @param focusGain the type of audio focus gain that will be requested, or * {@link AudioManager#AUDIOFOCUS_NONE} to disable the use audio focus during * playback. */ public void setAudioFocusRequest(int focusGain) { if (focusGain != AudioManager.AUDIOFOCUS_NONE && focusGain != AudioManager.AUDIOFOCUS_GAIN && focusGain != AudioManager.AUDIOFOCUS_GAIN_TRANSIENT && focusGain != AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK && focusGain != AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE) { throw new IllegalArgumentException("Illegal audio focus type " + focusGain); } mAudioFocusType = focusGain; }
From source file:androidx.media.widget.VideoView2.java
private boolean isAudioGranted() { return mAudioFocused || mAudioFocusType == AudioManager.AUDIOFOCUS_NONE; }
From source file:androidx.media.widget.VideoView2.java
@SuppressWarnings("deprecation") private void resetPlayer() { if (mMediaPlayer != null) { mMediaPlayer.reset();/*from ww w.ja v a2 s . c om*/ mMediaPlayer.release(); mMediaPlayer = null; mTextureView.setMediaPlayer(null); mSurfaceView.setMediaPlayer(null); mCurrentState = STATE_IDLE; mTargetState = STATE_IDLE; if (mAudioFocusType != AudioManager.AUDIOFOCUS_NONE) { mAudioManager.abandonAudioFocus(null); } } mVideoWidth = 0; mVideoHeight = 0; }