Commit 903b4414 by 刘鹏

feat: 戴耳机接听来电时,通过耳机播放铃声 m-im 升级到18.51

parent 2b3ed756
...@@ -10,7 +10,7 @@ ext { ...@@ -10,7 +10,7 @@ ext {
"m-fm" : "0.0.30.03", "m-fm" : "0.0.30.03",
"m-user" : "0.0.61.30", "m-user" : "0.0.61.30",
"m-home" : "0.0.22.60", "m-home" : "0.0.22.60",
"m-im" : "0.0.18.49", "m-im" : "0.0.18.51",
"m-dynamic" : "0.0.7.21", "m-dynamic" : "0.0.7.21",
"m-article" : "0.0.0.8", "m-article" : "0.0.0.8",
...@@ -93,7 +93,7 @@ ext { ...@@ -93,7 +93,7 @@ ext {
"m-fm" : "0.0.30.01", "m-fm" : "0.0.30.01",
"m-user" : "0.0.61.18", "m-user" : "0.0.61.18",
"m-home" : "0.0.22.54", "m-home" : "0.0.22.54",
"m-im" : "0.0.18.40", "m-im" : "0.0.18.51",
"m-dynamic" : "0.0.7.19", "m-dynamic" : "0.0.7.19",
"m-article" : "0.0.0.6", "m-article" : "0.0.0.6",
......
...@@ -8,8 +8,8 @@ import android.media.AudioManager; ...@@ -8,8 +8,8 @@ import android.media.AudioManager;
import android.media.SoundPool; import android.media.SoundPool;
import com.yidianling.avchatkit.AVChatKit; import com.yidianling.avchatkit.AVChatKit;
import com.yidianling.im.R;
import com.yidianling.avchatkit.common.log.LogUtil; import com.yidianling.avchatkit.common.log.LogUtil;
import com.yidianling.im.R;
/** /**
* SoundPool 铃声尽量不要超过1M * SoundPool 铃声尽量不要超过1M
...@@ -24,7 +24,8 @@ public class AVChatSoundPlayer { ...@@ -24,7 +24,8 @@ public class AVChatSoundPlayer {
NO_RESPONSE, NO_RESPONSE,
PEER_BUSY, PEER_BUSY,
PEER_REJECT, PEER_REJECT,
RING,; RING,
;
} }
private Context context; private Context context;
...@@ -81,6 +82,8 @@ public class AVChatSoundPlayer { ...@@ -81,6 +82,8 @@ public class AVChatSoundPlayer {
ringId = R.raw.im_avchat_ring; ringId = R.raw.im_avchat_ring;
loop = true; loop = true;
break; break;
default:
break;
} }
if (ringId != 0) { if (ringId != 0) {
...@@ -116,12 +119,13 @@ public class AVChatSoundPlayer { ...@@ -116,12 +119,13 @@ public class AVChatSoundPlayer {
private void initSoundPool() { private void initSoundPool() {
stop(); stop();
if (soundPool == null) { if (soundPool == null) {
soundPool = new SoundPool(1, AudioManager.STREAM_RING, 0); soundPool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0);
soundPool.setOnLoadCompleteListener(onLoadCompleteListener); soundPool.setOnLoadCompleteListener(onLoadCompleteListener);
audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
ringMode = audioManager.getRingerMode(); ringMode = audioManager.getRingerMode();
} }
audioManager.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
registerVolumeReceiver(true); registerVolumeReceiver(true);
} }
...@@ -149,6 +153,7 @@ public class AVChatSoundPlayer { ...@@ -149,6 +153,7 @@ public class AVChatSoundPlayer {
context.registerReceiver(ringModeChangeReceiver, filter); context.registerReceiver(ringModeChangeReceiver, filter);
} else { } else {
context.unregisterReceiver(ringModeChangeReceiver); context.unregisterReceiver(ringModeChangeReceiver);
audioManager.unloadSoundEffects();
isRingModeRegister = false; isRingModeRegister = false;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment