Commit 13a9917b by 严久程

咨询声网接听页面外放

parent 1ed4124c
......@@ -42,8 +42,8 @@ ext {
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.48.22",
"m-consultant" : "0.0.59.8",
"m-confide" : "0.0.48.29",
"m-consultant" : "0.0.59.15",
"m-fm" : "0.0.29.3",
"m-user" : "0.0.60.3",
"m-home" : "0.0.22.2",
......@@ -75,7 +75,7 @@ ext {
"ydl-webview" : "0.0.38.29",
"ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17",
"m-audioim" : "0.0.49.0",
"m-audioim" : "0.0.49.8",
"ydl-flutter-base": "0.0.14.12",
//以下 几乎不会动
......@@ -121,7 +121,7 @@ ext {
"ydl-webview" : "0.0.38.29",
"ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17",
"m-audioim" : "0.0.49.0",
"m-audioim" : "0.0.49.8",
"ydl-flutter-base": "0.0.10.9",
//以下 几乎不会动
......
......@@ -190,7 +190,7 @@ class AudioHomeActivity :
LogUtil.e("[agora]发生警告回调$warn")
runOnUiThread {
when (warn) {
103, 104, 105, 106, 107 -> {
103, 105, 107 -> {
writeAgoraLog("通话挂断:网络异常(${warn})")
showToast("当前网络较差,请更换网络!")
//通话结束或挂断时,上传日志文件
......
......@@ -19,26 +19,46 @@ class AudioPlayer {
private var mContext: Context? = null
private var audioManager: AudioManager? = null
constructor(mContext: Context?) {
constructor(mContext: Context?, isSpeakerphoneOn: Boolean = false) {
this.mContext = mContext
mPlayer = MediaPlayer()
mPlayer?.setAudioStreamType(AudioManager.STREAM_VOICE_CALL)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
var attributes = AudioAttributes.Builder()
.setLegacyStreamType(AudioManager.STREAM_VOICE_CALL)
if (isSpeakerphoneOn) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
var attributes = AudioAttributes.Builder()
.setLegacyStreamType(AudioManager.STREAM_MUSIC)
.build()
mPlayer?.setAudioAttributes(attributes)
mPlayer?.setAudioAttributes(attributes)
} else {
mPlayer?.setAudioStreamType(AudioManager.STREAM_MUSIC)
}
audioManager = mContext!!.getSystemService(Context.AUDIO_SERVICE) as AudioManager?
audioManager?.setStreamVolume(
AudioManager.STREAM_MUSIC,
audioManager!!.getStreamMaxVolume(AudioManager.STREAM_MUSIC),
AudioManager.STREAM_MUSIC
)
} else {
mPlayer?.setAudioStreamType(AudioManager.STREAM_VOICE_CALL)
}
audioManager = mContext!!.getSystemService(Context.AUDIO_SERVICE) as AudioManager?
audioManager?.setStreamVolume(AudioManager.STREAM_VOICE_CALL,
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
var attributes = AudioAttributes.Builder()
.setLegacyStreamType(AudioManager.STREAM_VOICE_CALL)
.build()
mPlayer?.setAudioAttributes(attributes)
} else {
mPlayer?.setAudioStreamType(AudioManager.STREAM_VOICE_CALL)
}
audioManager = mContext!!.getSystemService(Context.AUDIO_SERVICE) as AudioManager?
audioManager?.setStreamVolume(
AudioManager.STREAM_VOICE_CALL,
audioManager!!.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL) / 2,
AudioManager.STREAM_VOICE_CALL)
//默认听筒模式
audioManager?.isSpeakerphoneOn = false
AudioManager.STREAM_VOICE_CALL
)
}
audioManager?.isSpeakerphoneOn = isSpeakerphoneOn
}
......@@ -48,7 +68,7 @@ class AudioPlayer {
*/
fun setDataSource(id: Int) {
val file = mContext?.resources?.openRawResourceFd(id)
if (null == file){
if (null == file) {
return
}
if (mPlayer != null) {
......@@ -146,11 +166,13 @@ class AudioPlayer {
*/
fun requestFocus() {
try {
val result = audioManager?.requestAudioFocus(afChangeListener,
// Use the music stream.
AudioManager.STREAM_VOICE_CALL,
// Request permanent focus.
AudioManager.AUDIOFOCUS_GAIN)
val result = audioManager?.requestAudioFocus(
afChangeListener,
// Use the music stream.
AudioManager.STREAM_VOICE_CALL,
// Request permanent focus.
AudioManager.AUDIOFOCUS_GAIN
)
} catch (e: Exception) {
}
......
......@@ -263,7 +263,7 @@ class ConsultantAudioHomeActivity :
//107:打开频道请求被服务器拒绝。服务器可能没有办法处理该请求或该请求是非法的
runOnUiThread {
when (warn) {
103, 104, 105, 106, 107 -> {
103, 105, 107 -> {
writeAgoraLog("通话挂断:网络异常($warn)")
showToast("当前网络较差,请更换网络!")
//通话结束或挂断时,上传日志文件
......@@ -434,7 +434,7 @@ class ConsultantAudioHomeActivity :
wave_view.setInterpolator(AccelerateInterpolator(1.2f))
//启动背景动画
wave_view.start()
mPlayer = AudioPlayer(this)
mPlayer = AudioPlayer(this, true)
mPlayer!!.setDataSource(R.raw.audioim_call_music)
mPlayer!!.start(isLooping = true, isSetOnCompletionListener = false)
......@@ -779,7 +779,7 @@ class ConsultantAudioHomeActivity :
*/
private fun playFinishMusic() {
if (mPlayer == null) {
mPlayer = AudioPlayer(this)
mPlayer = AudioPlayer(this, true)
}
mPlayer!!.setDataSource(R.raw.audioim_hand_down_music)
// mPlayer!!.switchPlayType(true)
......@@ -802,7 +802,7 @@ class ConsultantAudioHomeActivity :
.subscribe({}, {}, {
if (!isConnectSuccess) {
writeAgoraLog("通话未接通挂断:连接中的状态超过5s自动挂断")
showToast( "用户已挂断")
showToast("用户已挂断")
close(RESULT_NOT_ANSWERED_CODE, "")
}
})
......
......@@ -361,9 +361,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
v_loading.visibility = View.VISIBLE
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
if (fromPageType != -1) {
doctorAdapter.setEntrance(fromPages[fromPageType], 0)
}
doctorAdapter.setEntrance(0)
}
/**
......
......@@ -59,11 +59,9 @@ class ExpertSearchAdapter(
var hasMore = true
var entranceName: String? = null
var pageIndex: Int = 0
fun setEntrance(entranceName: String, pageIndex: Int) {
this.entranceName = entranceName
fun setEntrance(pageIndex: Int) {
this.pageIndex = pageIndex
}
......@@ -465,14 +463,6 @@ class ExpertSearchAdapter(
} else {
ToastHelper.show("请联系客服,专家参数错误!")
}
if (!TextUtils.isEmpty(entranceName)) {
LogUtil.d("entrance name: $entranceName")
BuryPointUtils.getInstance().createMap()
.put("expert_entrance", entranceName ?: "")
.put("expert_ID", doctor.doctorId ?: 0)
.put("expert_name", doctor.name ?: "")
.burryPoint("Chat_click")
}
}
}
}
......
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