Commit c734eb47 by 万齐军

换音频文件

parent b23df313
...@@ -1592,7 +1592,7 @@ class AudioHomeActivity : ...@@ -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") LogUtil.e("showNetStatus: msg=$msg,status=$status")
if (tv_nte_status.visibility == View.VISIBLE) { if (tv_nte_status.visibility == View.VISIBLE) {
return return
......
...@@ -9,6 +9,7 @@ import android.widget.TextView ...@@ -9,6 +9,7 @@ import android.widget.TextView
import com.tencent.mmkv.MMKV import com.tencent.mmkv.MMKV
import com.ydl.audioim.http.AudioApiRequestUtil import com.ydl.audioim.http.AudioApiRequestUtil
import com.ydl.audioim.http.RtcEvent 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.listener.RtcNetInterface
import com.ydl.ydl_av.voice.manager.YDLVoiceManager import com.ydl.ydl_av.voice.manager.YDLVoiceManager
import com.ydl.ydlcommon.utils.log.XLog import com.ydl.ydlcommon.utils.log.XLog
...@@ -101,6 +102,11 @@ class NetQuality( ...@@ -101,6 +102,11 @@ class NetQuality(
voiceManage?.getVoiceApi() voiceManage?.getVoiceApi()
?.playEffect(3001, getNetLowEffect(activity)) ?.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( ...@@ -120,7 +126,7 @@ class NetQuality(
} }
fun getNetLowEffect(context: Context): String { 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?) { fun copySoundFile(context: Context?) {
...@@ -131,13 +137,14 @@ class NetQuality( ...@@ -131,13 +137,14 @@ class NetQuality(
if (!soundFile.exists()) { if (!soundFile.exists()) {
soundFile.mkdir() 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 { filesName.forEach {
val file = File(soundFile, it) val file = File(soundFile, it)
if (!file.exists()) { if (!file.exists()) {
file.createNewFile() file.createNewFile()
val fileOutputStream = FileOutputStream(file) val fileOutputStream = FileOutputStream(file)
context.assets.open(it).copyTo(fileOutputStream) context.assets.open(it).copyTo(fileOutputStream)
fileOutputStream.close()
} }
} }
} }
......
...@@ -959,7 +959,7 @@ class ConsultantAudioHomeActivity : ...@@ -959,7 +959,7 @@ class ConsultantAudioHomeActivity :
/** /**
* 网络状态 * 网络状态
*/ */
private fun showNetStatus(msg: String, status: Int = 0) { fun showNetStatus(msg: String, status: Int = 0) {
runOnUiThread { runOnUiThread {
if (TextUtils.isEmpty(msg)) { if (TextUtils.isEmpty(msg)) {
tv_nte_status.visibility = View.GONE 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