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


Java AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION属性代码示例

本文整理汇总了Java中android.media.audiofx.AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION属性的典型用法代码示例。如果您正苦于以下问题:Java AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION属性的具体用法?Java AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION怎么用?Java AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.media.audiofx.AudioEffect的用法示例。


在下文中一共展示了AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDestroy

@Override
public void onDestroy() {
    if (D) Logger.d(TAG, "Destroying service");
    super.onDestroy();

    final Intent audioEffectsIntent = new Intent(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
    audioEffectsIntent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId());
    audioEffectsIntent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName());
    sendBroadcast(audioEffectsIntent);

    mAlarmManager.cancel(mShutdownIntent);

    mPlayerHandler.removeCallbacksAndMessages(null);

    mPlayer.release();
    mPlayer = null;

    mAudioManager.abandonAudioFocus(mAudioFocusListener);
    mMediaSession.release();

    mPlayerHandler.removeCallbacksAndMessages(null);

    unregisterReceiver(mIntentReceiver);

    mWakeLock.release();
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:26,代码来源:MusicPlaybackService.java

示例2: pause

public void pause() {
    if (D) Log.d(TAG, "Pausing playback");
    synchronized (this) {
        mPlayerHandler.removeMessages(FADEUP);
        if (mIsSupposedToBePlaying) {
            final Intent intent = new Intent(
                    AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
            intent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId());
            intent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName());
            sendBroadcast(intent);

            mPlayer.pause();
            notifyChange(META_CHANGED);
            setIsSupposedToBePlaying(false, true);
        }
    }
}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:17,代码来源:MusicService.java

示例3: pause

/**
 * Temporarily pauses playback.
 */
public void pause() {
    if (mPlayerHandler == null) return;
    LogUtils.d(TAG, "Pausing playback");
    synchronized (this) {
        if (mPlayerHandler != null) {
            mPlayerHandler.removeMessages(MusicServiceConstants.FADEUP);
        }
        if (mIsSupposedToBePlaying) {
            final Intent intent = new Intent(
                    AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
            intent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId());
            intent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName());
            sendBroadcast(intent);

            if (mPlayer != null) {
                mPlayer.pause();
            }
            setIsSupposedToBePlaying(false, true);
            stopShakeDetector(false);
        }
    }
}
 
开发者ID:komamj,项目名称:KomaMusic,代码行数:25,代码来源:MusicService.java

示例4: onDestroy

@Override
public void onDestroy() {
    super.onDestroy();
    Extras.getInstance().setwidgetPosition(100);
    audioWidget.cleanUp();
    audioWidget = null;
    Equalizers.EndEq();
    BassBoosts.EndBass();
    Virtualizers.EndVirtual();
    Loud.EndLoudnessEnhancer();
    Reverb.EndReverb();
    receiverCleanup();
    Extras.getInstance().eqSwitch(false);
    audioManager.abandonAudioFocus(this);
    removeProgress();
    fastplay = false;
    isPlaying = false;
    paused = false;
    stopMediaplayer();
    if (!Extras.getInstance().hideLockscreen()) {
        if (mediaSessionLockscreen != null) {
            mediaSessionLockscreen.release();
            mediaSessionLockscreen = null;
        }
    }
    Intent i = new Intent(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
    if (Helper.isActivityPresent(this, i)) {
        i.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, audioSession());
        i.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, this.getPackageName());
        sendBroadcast(i);
    } else {
        Log.d(TAG, "no activity found");
    }
    if (!Extras.getInstance().hideNotify()) {
        removeNotification();
    }
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:37,代码来源:MusicXService.java

示例5: onDestroy

@Override
public void onDestroy() {

    // Check that we're not being destroyed while something is still
    // playing.
    if (chatHead != null)
        windowManager.removeView(chatHead);
    if (isPlaying()) {
        Log.e(LOGTAG, "Service being destroyed while still playing.");
    }

    if (mShakeAction != 0)
        mSensorManager.unregisterListener(this);
    // release all MediaPlayer resources, including the native player and
    // wakelocks

    Intent i = new Intent(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
    i.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId());
    i.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName());
    sendBroadcast(i);
    pause();
    mPlayer.release();
    mPlayer = null;

    mAudioManager.abandonAudioFocus(mAudioFocusListener);
    setRemoteControlClient();

    // make sure there aren't any other messages coming
    mDelayedStopHandler.removeCallbacksAndMessages(null);
    mCurrentMediaPlayerHandler.removeCallbacksAndMessages(null);

    unregisterReceiver(mIntentReceiver);
    dismissAllNotifications();
    super.onDestroy();
}
 
开发者ID:89luca89,项目名称:ThunderMusic,代码行数:35,代码来源:MediaPlaybackService.java

示例6: onDestroy

@Override
public void onDestroy() {
    if (D) Log.d(TAG, "Destroying service");
    super.onDestroy();
    // Remove any sound effects
    final Intent audioEffectsIntent = new Intent(
            AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
    audioEffectsIntent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId());
    audioEffectsIntent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName());
    sendBroadcast(audioEffectsIntent);


    mAlarmManager.cancel(mShutdownIntent);

    mPlayerHandler.removeCallbacksAndMessages(null);

    if (TimberUtils.isJellyBeanMR2())
        mHandlerThread.quitSafely();
    else mHandlerThread.quit();

    mPlayer.release();
    mPlayer = null;

    mAudioManager.abandonAudioFocus(mAudioFocusListener);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
        mSession.release();

    getContentResolver().unregisterContentObserver(mMediaStoreObserver);

    closeCursor();

    unregisterReceiver(mIntentReceiver);
    if (mUnmountReceiver != null) {
        unregisterReceiver(mUnmountReceiver);
        mUnmountReceiver = null;
    }

    mWakeLock.release();
}
 
开发者ID:rohanoid5,项目名称:Muzesto,代码行数:39,代码来源:MusicService.java

示例7: onDestroy

@Override
public void onDestroy() {
    super.onDestroy();
    instance = null;

    if(currentPlaying != null) currentPlaying.setPlaying(false);
    lifecycleSupport.onDestroy();

    try {
        Intent i = new Intent(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
        i.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, audioSessionId);
        i.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName());
        sendBroadcast(i);
    } catch(Throwable e) {
        // Froyo or lower
    }

    mediaPlayer.release();
    if(nextMediaPlayer != null) {
        nextMediaPlayer.release();
    }
    mediaPlayerLooper.quit();
    shufflePlayBuffer.shutdown();
    effectsController.release();

    if(bufferTask != null) {
        bufferTask.cancel();
        bufferTask = null;
    }
    if(nextPlayingTask != null) {
        nextPlayingTask.cancel();
        nextPlayingTask = null;
    }
    if(proxy != null) {
        proxy.stop();
        proxy = null;
    }
    Notifications.hidePlayingNotification(this, this, handler);
    Notifications.hideDownloadingNotification(this, this, handler);
}
 
开发者ID:nvllsvm,项目名称:Audinaut,代码行数:40,代码来源:DownloadService.java

示例8: onDestroy

@Override
public void onDestroy() {
    // Check that we're not being destroyed while something is still
    // playing.
    if (mIsSupposedToBePlaying) {
        Log.e(LOGTAG, "Service being destroyed while still playing.");
    }
    // release all MediaPlayer resources, including the native player and
    // wakelocks
    Intent i = new Intent(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
    i.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId());
    i.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName());
    sendBroadcast(i);
    mPlayer.release();
    mPlayer = null;

    mAudioManager.abandonAudioFocus(mAudioFocusListener);
    mAudioManager.unregisterRemoteControlClient(mRemoteControlClient);

    // make sure there aren't any other messages coming
    mDelayedStopHandler.removeCallbacksAndMessages(null);
    mMediaplayerHandler.removeCallbacksAndMessages(null);

    if (mCursor != null) {
        mCursor.close();
        mCursor = null;
    }
    updateAlbumBitmap();

    unregisterReceiver(mIntentReceiver);
    if (mUnmountReceiver != null) {
        unregisterReceiver(mUnmountReceiver);
        mUnmountReceiver = null;
    }
    mWakeLock.release();
    super.onDestroy();
}
 
开发者ID:hubcarl,项目名称:mobile-manager-tool,代码行数:37,代码来源:ApolloService.java

示例9: stop

/**
 * Stops media playback
 */
public synchronized void stop() {
    // Check if a player exists otherwise there is nothing to do.
    if (mCurrentMediaPlayer != null) {
        // Check if the player for the next song exists already
        if (mNextMediaPlayer != null) {
            // Remove the next player from the currently playing one.
            mCurrentMediaPlayer.setNextMediaPlayer(null);
            // Release the MediaPlayer, not usable after this command
            mNextMediaPlayer.release();

            // Reset variables to clean internal state
            mNextMediaPlayer = null;
            mSecondPrepared = false;
            mSecondPreparing = false;
        }

        // Check if the currently active player is ready
        if (mCurrentPrepared) {
            /*
             * Signal android desire to close audio effect session
             */
            Intent audioEffectIntent = new Intent(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
            audioEffectIntent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, mCurrentMediaPlayer.getAudioSessionId());
            audioEffectIntent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, mPlaybackService.getPackageName());
            mPlaybackService.sendBroadcast(audioEffectIntent);
            Log.v(TAG, "Closing effect for session: " + mCurrentMediaPlayer.getAudioSessionId());
        }
        // Release the current player
        mCurrentMediaPlayer.release();

        // Reset variables to clean internal state
        mCurrentMediaPlayer = null;
        mCurrentPrepared = false;
    }
}
 
开发者ID:gateship-one,项目名称:odyssey,代码行数:38,代码来源:GaplessPlayer.java

示例10: removeAudioEffects

void removeAudioEffects() {
        // Remove any sound effects
        final Intent audioEffectsIntent = new Intent(
                AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
//        audioEffectsIntent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, mAudioSessionId);
        audioEffectsIntent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, mContext.getPackageName());
        mContext.sendBroadcast(audioEffectsIntent);
    }
 
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:8,代码来源:PlaybackService.java

示例11: onDestroy

@Override
public void onDestroy() {
    // Check that we're not being destroyed while something is still playing.
    if (isPlaying()) {
        Log.e(LOGTAG, "Service being destroyed while still playing.");
    }
    // release all MediaPlayer resources, including the native player and wakelocks
    Intent i = new Intent(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
    i.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId());
    i.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName());
    sendBroadcast(i);
    mPlayer.release();
    mPlayer = null;

    mAudioManager.abandonAudioFocus(mAudioFocusListener);
    mAudioManager.unregisterRemoteControlClient(mRemoteControlClient);
    
    // make sure there aren't any other messages coming
    mDelayedStopHandler.removeCallbacksAndMessages(null);
    mMediaplayerHandler.removeCallbacksAndMessages(null);

    if (mCursor != null) {
        mCursor.close();
        mCursor = null;
    }

    unregisterReceiver(mIntentReceiver);
    if (mUnmountReceiver != null) {
        unregisterReceiver(mUnmountReceiver);
        mUnmountReceiver = null;
    }
    mWakeLock.release();
    super.onDestroy();
}
 
开发者ID:AndroidLearnerchn,项目名称:Android-Application-Using-CAF-Library,代码行数:34,代码来源:MediaPlaybackService.java

示例12: onDestroy

@Override
public void onDestroy() {
    // Check that we're not being destroyed while something is still playing.
    if (isPlaying()) {
        Log.e(LOGTAG, "Service being destroyed while still playing.");
    }
    // release all MediaPlayer resources, including the native player and wakelocks
    Intent i = new Intent(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
    i.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId());
    i.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName());
    sendBroadcast(i);
    mPlayer.release();
    mPlayer = null;

    mAudioManager.abandonAudioFocus(mAudioFocusListener);
    //mAudioManager.unregisterRemoteControlClient(mRemoteControlClient);

    // make sure there aren't any other messages coming
    mDelayedStopHandler.removeCallbacksAndMessages(null);
    mMediaplayerHandler.removeCallbacksAndMessages(null);

    if (mCursor != null) {
        mCursor.close();
        mCursor = null;
    }

    unregisterReceiver(mIntentReceiver);
    if (mUnmountReceiver != null) {
        unregisterReceiver(mUnmountReceiver);
        mUnmountReceiver = null;
    }
    mWakeLock.release();
    mWorker.quit();
    super.onDestroy();
}
 
开发者ID:XiaoMi,项目名称:misound,代码行数:35,代码来源:PlayerService.java

示例13: broadcastCloseIntent

private static void broadcastCloseIntent() {
	final Intent intent = new Intent(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
	intent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, BuildConfig.APPLICATION_ID);
	intent.putExtra(AudioEffect.EXTRA_CONTENT_TYPE, AudioEffect.CONTENT_TYPE_MUSIC);
	intent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, Player.audioSessionId);
	Player.theApplication.sendBroadcast(intent);
}
 
开发者ID:carlosrafaelgn,项目名称:FPlayAndroid,代码行数:7,代码来源:ExternalFx.java

示例14: onDestroy

@Override
public void onDestroy()
{
	super.onDestroy();

	try
	{
		instance = null;
		lifecycleSupport.onDestroy();
		mediaPlayer.release();

		if (nextMediaPlayer != null)
		{
			nextMediaPlayer.release();
		}

		mediaPlayerLooper.quit();
		shufflePlayBuffer.shutdown();

		if (equalizerController != null)
		{
			equalizerController.release();
		}

		if (visualizerController != null)
		{
			visualizerController.release();
		}

		if (bufferTask != null)
		{
			bufferTask.cancel();
		}

		if (nextPlayingTask != null)
		{
			nextPlayingTask.cancel();
		}

		Intent i = new Intent(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
		i.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, mediaPlayer.getAudioSessionId());
		i.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName());
		sendBroadcast(i);

		audioManager.unregisterRemoteControlClient(remoteControlClient);
		clearRemoteControl();

		wakeLock.release();
	}
	catch (Throwable ignored)
	{
	}
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:53,代码来源:DownloadServiceImpl.java

示例15: closeAudioEffectSession

private void closeAudioEffectSession() {
    final Intent audioEffectsIntent = new Intent(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);
    audioEffectsIntent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, playback.getAudioSessionId());
    audioEffectsIntent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName());
    sendBroadcast(audioEffectsIntent);
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:6,代码来源:MusicService.java


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