Commit bd50dab8 by 刘鹏

Merge branch 'feat/qj/audio_play2' into 'd/4.4.10'

换音频文件

See merge request app_android_lib/YDL-Component!353
parents 2a482d02 c734eb47
......@@ -1592,7 +1592,7 @@ class AudioHomeActivity :
/**
* 网络状态
*/
private fun showNetStatus(msg: String, status: Int = 0) {
fun showNetStatus(msg: String, status: Int = 0) {
LogUtil.e("showNetStatus: msg=$msg,status=$status")
if (tv_nte_status.visibility == View.VISIBLE) {
return
......
......@@ -9,6 +9,7 @@ import android.widget.TextView
import com.tencent.mmkv.MMKV
import com.ydl.audioim.http.AudioApiRequestUtil
import com.ydl.audioim.http.RtcEvent
import com.ydl.consultantim.ConsultantAudioHomeActivity
import com.ydl.ydl_av.voice.listener.RtcNetInterface
import com.ydl.ydl_av.voice.manager.YDLVoiceManager
import com.ydl.ydlcommon.utils.log.XLog
......@@ -101,6 +102,11 @@ class NetQuality(
voiceManage?.getVoiceApi()
?.playEffect(3001, getNetLowEffect(activity))
}
if (activity is AudioHomeActivity) {
activity.showNetStatus("对方的网络状况不佳", 0)
} else if (activity is ConsultantAudioHomeActivity) {
activity.showNetStatus("对方的网络状况不佳", 0)
}
}
}
}
......@@ -120,7 +126,7 @@ class NetQuality(
}
fun getNetLowEffect(context: Context): String {
return context.filesDir.absolutePath + "/sounds/effect_net_quality_low.mp3"
return context.filesDir.absolutePath + "/sounds/effect_net_quality_low.m4a"
}
fun copySoundFile(context: Context?) {
......@@ -131,13 +137,14 @@ class NetQuality(
if (!soundFile.exists()) {
soundFile.mkdir()
}
val filesName = arrayOf("effect_hand_up.mp3", "effect_net_quality_low.mp3")
val filesName = arrayOf("effect_hand_up.mp3", "effect_net_quality_low.m4a")
filesName.forEach {
val file = File(soundFile, it)
if (!file.exists()) {
file.createNewFile()
val fileOutputStream = FileOutputStream(file)
context.assets.open(it).copyTo(fileOutputStream)
fileOutputStream.close()
}
}
}
......
......@@ -959,7 +959,7 @@ class ConsultantAudioHomeActivity :
/**
* 网络状态
*/
private fun showNetStatus(msg: String, status: Int = 0) {
fun showNetStatus(msg: String, status: Int = 0) {
runOnUiThread {
if (TextUtils.isEmpty(msg)) {
tv_nte_status.visibility = View.GONE
......
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