Jump to content

Poweramp + car Bluetooth = Strange ?!


Seb.26

Recommended Posts

Hi world,

I'm curently testing Poweramp, it's really great, I was about to buy the unlocker but ...

I have troubles with bluetooth streaming in my car ... here is the full story :

<< Sometimes, I only want to have GPS (google navigation) instructions and no music, so I put Poweramp in "pause" and navigation is running ... but each time navigation "talks", the music start/pause/stop ?!! ... very strange. >>

Looks like notifications always start/stop music.

Isn't it possible to pause/re-start music during notifications if ( and only if ) the muscic playback was enable before notification.

If user has press the "pause" button, please don't start playing.

Maybe it's a trouble with Android & Notification system, I don't know.

Remarq : I'm using rooted HTC Desire (GSM) with CyanogenMod ROM (cm-7.2.0.1-bravo)

I will be disapointed to cannot buy full version due to this point.

Link to comment
Share on other sites

Hi,

in Android SDK, I've found this implementation example :

public void onAudioFocusChange(int focusChange) {
switch (focusChange) {
case AudioManager.AUDIOFOCUS_GAIN:
// resume playback
if (mMediaPlayer == null) initMediaPlayer();
else if (!mMediaPlayer.isPlaying()) mMediaPlayer.start();
mMediaPlayer.setVolume(1.0f, 1.0f);
break;
case AudioManager.AUDIOFOCUS_LOSS:
// Lost focus for an unbounded amount of time: stop playback and release media player
if (mMediaPlayer.isPlaying()) mMediaPlayer.stop();
mMediaPlayer.release();
mMediaPlayer = null;
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
// Lost focus for a short time, but we have to stop
// playback. We don't release the media player because playback
// is likely to resume
if (mMediaPlayer.isPlaying()) mMediaPlayer.pause();
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
// Lost focus for a short time, but it's ok to keep playing
// at an attenuated level
if (mMediaPlayer.isPlaying()) mMediaPlayer.setVolume(0.1f, 0.1f);
break;
}
}

If you have used that, the result is what I've notice on my terminal.

A better way should be to set a global flag that store if the playback is actually allowed by user and resume it only in that case ... I'm not a Java pro, but this could looks like :


[...]
case AudioManager.AUDIOFOCUS_GAIN:
if( g_playbackFlag )
{
// resume playback
if (mMediaPlayer == null)
initMediaPlayer();
else if (!mMediaPlayer.isPlaying() )
mMediaPlayer.start();
mMediaPlayer.setVolume(1.0f, 1.0f);
}
break;
[...]

This way, after a focus gain, the player only start if playback was enabled before focus was lost.

Note : the g_playbackFlag boolean is updated by play/pause/stop buttons ...

I don't know if you could do anything like that in real life, but this could be great, and I think that you will be the first available player on the market that offer this feature ...

bye.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...