音频焦点分为两种
1永久占用((AudioManager) getSystemService(AUDIO_SERVICE)) .requestAudioFocus(null, AudioManager.STREAM_MUSIC,
AudioManager.AUDIOFOCUS_GAIN);
2临时占用((AudioManager) getSystemService(AUDIO_SERVICE)) .requestAudioFocus(null, AudioManager.STREAM_MUSIC,
AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
释放音频焦点((AudioManager) getSystemService(AUDIO_SERVICE)).abandonAudioFocus(null);
时间: 2024-10-09 03:37:45