本文整理汇总了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();
}
示例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);
}
}
}
示例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);
}
}
}
示例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();
}
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
示例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;
}
}
示例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);
}
示例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();
}
示例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);
}
示例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)
{
}
}
示例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);
}