Commit 903b4414 by 刘鹏

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

parent 2b3ed756
......@@ -10,7 +10,7 @@ ext {
"m-fm" : "0.0.30.03",
"m-user" : "0.0.61.30",
"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-article" : "0.0.0.8",
......@@ -93,7 +93,7 @@ ext {
"m-fm" : "0.0.30.01",
"m-user" : "0.0.61.18",
"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-article" : "0.0.0.6",
......
......@@ -8,8 +8,8 @@ import android.media.AudioManager;
import android.media.SoundPool;
import com.yidianling.avchatkit.AVChatKit;
import com.yidianling.im.R;
import com.yidianling.avchatkit.common.log.LogUtil;
import com.yidianling.im.R;
/**
* SoundPool 铃声尽量不要超过1M
......@@ -24,7 +24,8 @@ public class AVChatSoundPlayer {
NO_RESPONSE,
PEER_BUSY,
PEER_REJECT,
RING,;
RING,
;
}
private Context context;
......@@ -81,6 +82,8 @@ public class AVChatSoundPlayer {
ringId = R.raw.im_avchat_ring;
loop = true;
break;
default:
break;
}
if (ringId != 0) {
......@@ -116,12 +119,13 @@ public class AVChatSoundPlayer {
private void initSoundPool() {
stop();
if (soundPool == null) {
soundPool = new SoundPool(1, AudioManager.STREAM_RING, 0);
soundPool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0);
soundPool.setOnLoadCompleteListener(onLoadCompleteListener);
audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
ringMode = audioManager.getRingerMode();
}
audioManager.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
registerVolumeReceiver(true);
}
......@@ -149,6 +153,7 @@ public class AVChatSoundPlayer {
context.registerReceiver(ringModeChangeReceiver, filter);
} else {
context.unregisterReceiver(ringModeChangeReceiver);
audioManager.unloadSoundEffects();
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