当前位置: 首页>>代码示例>>Java>>正文


Java AudioManager.AUDIOFOCUS_GAIN_TRANSIENT属性代码示例

本文整理汇总了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;
    }
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:18,代码来源:IflySynthesizer.java

示例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;
	}
}
 
开发者ID:NiciDieNase,项目名称:chaosflix-leanback,代码行数:26,代码来源:OverlayFragment.java

示例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;
    }
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:26,代码来源:PlaybackOverlayFragment.java

示例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);
    }
}
 
开发者ID:googlesamples,项目名称:android-media-controller,代码行数:12,代码来源:MediaAppControllerActivity.java

示例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;
    }
}
 
开发者ID:dueeeke,项目名称:dkplayer,代码行数:31,代码来源:BaseIjkVideoView.java

示例6: release

public void release() {
    mState = AudioManager.AUDIOFOCUS_GAIN_TRANSIENT;
    mFocusRequestChangeListeners.clear();
    mAudioManager.abandonAudioFocus(onAudioFocusChangeListener);
    mAudioManager = null;
}
 
开发者ID:zhangyaqiang,项目名称:Fatigue-Detection,代码行数:6,代码来源:AudioFocusRequest.java


注:本文中的android.media.AudioManager.AUDIOFOCUS_GAIN_TRANSIENT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。