Audiofocus機制

OnFocusChangeListener

audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

//屏蔽正在播放的音樂
   audioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
//恢復音樂

audioManager.abandonAudioFocus(this);

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章