mt6735 后台播放FM或者Music,前台进入VideoPlayer再退出,后台不能恢复
时间:10-02
整理:3721RD
点击:
[Audio App]后台播放FM或者Music,前台进入VideoPlayer再退出,后台不能恢复
[DESCRIPTION]
后台播放FM或者Music,前台进入VideoPlayer再退出,后台不能恢复
[SOLUTION]
方案一:
请按照如下修改2个地方:
1. 在fmradioservice.java中onReceive方法
private class FMServiceBroADCastReceiver extends BroadcastReceiver {
。
// other app want FM stop, stop FM
if (ACTION_TOFMSERVICE_powerDOWN.equals(action) || ACTION_FROMATVSERVICE_POWERUP.equals(action)
|| (SOUND_POWER_DOWN_MSG.equals(action) && CMDPAUSE.equals(command))) {
// need remove all messages, make power down will be execute
mFmServiceHandler.removeCallbacksAndMessages(null);
stopFMFocusLoss(AudioManager.AUDIOFOCUS_LOSS_TRANSIENT);//修改该句
。
2.在mediaplaybackservice.java中onReceive方法
。
else if (CMDPAUSE.equals(cmd) || PAUSE_ACTION.equals(action)) {
pause();
mPausedByTransientLossOfFocus = true;//修改此行
}
。
方案二:
在mtkVideoView.java的openVideo()方法中移除如下代码:
。
// Tell the music playback service to pause
// TODO: these constants need to be published somewhere in the php?mod=tag&id=6090" target="_blank" class="relatedlink">Framework.
final Intent i = new Intent("com.android.music.musicservicecommand");
i.putExtra("command", "pause");
mContext.sendBroadcast(i);
。
[DESCRIPTION]
后台播放FM或者Music,前台进入VideoPlayer再退出,后台不能恢复
[SOLUTION]
方案一:
请按照如下修改2个地方:
1. 在fmradioservice.java中onReceive方法
private class FMServiceBroADCastReceiver extends BroadcastReceiver {
。
// other app want FM stop, stop FM
if (ACTION_TOFMSERVICE_powerDOWN.equals(action) || ACTION_FROMATVSERVICE_POWERUP.equals(action)
|| (SOUND_POWER_DOWN_MSG.equals(action) && CMDPAUSE.equals(command))) {
// need remove all messages, make power down will be execute
mFmServiceHandler.removeCallbacksAndMessages(null);
stopFMFocusLoss(AudioManager.AUDIOFOCUS_LOSS_TRANSIENT);//修改该句
。
2.在mediaplaybackservice.java中onReceive方法
。
else if (CMDPAUSE.equals(cmd) || PAUSE_ACTION.equals(action)) {
pause();
mPausedByTransientLossOfFocus = true;//修改此行
}
。
方案二:
在mtkVideoView.java的openVideo()方法中移除如下代码:
。
// Tell the music playback service to pause
// TODO: these constants need to be published somewhere in the php?mod=tag&id=6090" target="_blank" class="relatedlink">Framework.
final Intent i = new Intent("com.android.music.musicservicecommand");
i.putExtra("command", "pause");
mContext.sendBroadcast(i);
。
顶顶顶