本文整理汇总了Java中android.media.AudioManager.AUDIOFOCUS_GAIN_TRANSIENT属性的典型用法代码示例。如果您正苦于以下问题:Java AudioManager.AUDIOFOCUS_GAIN_TRANSIENT属性的具体用法?Java AudioManager.AUDIOFOCUS_GAIN_TRANSIENT怎么用?Java AudioManager.AUDIOFOCUS_GAIN_TRANSIENT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.media.AudioManager
的用法示例。
在下文中一共展示了AudioManager.AUDIOFOCUS_GAIN_TRANSIENT属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onAudioFocusChange
@Override
public void onAudioFocusChange(int focusChange) {
Log.e(TAG, "audioFocusChangeListener.onAudioFocusChange>>>>>>>>>>>>>>>>>>" + focusChange);
switch (focusChange) {
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
// pauseSpeaking();
break;
case AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK:
case AudioManager.AUDIOFOCUS_GAIN_TRANSIENT:
/*if (isSpeaking()) {
synthesizer.resumeSpeaking();
}*/
break;
default:
break;
}
}
示例2: onAudioFocusChange
@Override
public void onAudioFocusChange(int focusChange) {
switch (focusChange) {
case AudioManager.AUDIOFOCUS_LOSS:
abandonAudioFocus();
pause();
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
if (mHelper.isMediaPlaying()) {
pause();
mPauseTransient = true;
}
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
mCallback.mute(true);
break;
case AudioManager.AUDIOFOCUS_GAIN:
case AudioManager.AUDIOFOCUS_GAIN_TRANSIENT:
case AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK:
if (mPauseTransient) {
play();
}
mCallback.mute(false);
break;
}
}
示例3: onAudioFocusChange
@Override
public void onAudioFocusChange(int focusChange) {
switch (focusChange) {
case AudioManager.AUDIOFOCUS_LOSS:
abandonAudioFocus();
pause();
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
if (mGlue.isMediaPlaying()) {
pause();
mPauseTransient = true;
}
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
mPlayer.mute(true);
break;
case AudioManager.AUDIOFOCUS_GAIN:
case AudioManager.AUDIOFOCUS_GAIN_TRANSIENT:
case AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK:
if (mPauseTransient) {
play();
}
mPlayer.mute(false);
break;
}
}
示例4: onAudioFocusChange
@Override
public void onAudioFocusChange(int focusChange) {
switch (focusChange) {
case AudioManager.AUDIOFOCUS_GAIN:
case AudioManager.AUDIOFOCUS_GAIN_TRANSIENT:
case AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK:
mToggleButton.setChecked(true);
break;
default:
mToggleButton.setChecked(false);
}
}
示例5: onAudioFocusChange
@Override
public void onAudioFocusChange(int focusChange) {
if (currentFocus == focusChange) {
return;
}
currentFocus = focusChange;
switch (focusChange) {
case AudioManager.AUDIOFOCUS_GAIN:
case AudioManager.AUDIOFOCUS_GAIN_TRANSIENT:
if (startRequested || pausedForLoss) {
start();
startRequested = false;
pausedForLoss = false;
}
break;
case AudioManager.AUDIOFOCUS_LOSS:
if (isPlaying()) {
pausedForLoss = true;
pause();
}
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
if (isPlaying()) {
pausedForLoss = true;
pause();
}
break;
}
}
示例6: release
public void release() {
mState = AudioManager.AUDIOFOCUS_GAIN_TRANSIENT;
mFocusRequestChangeListeners.clear();
mAudioManager.abandonAudioFocus(onAudioFocusChangeListener);
mAudioManager = null;
}