[cos]
[添加下载功能]
This commit is contained in:
yangyakun
2026-04-01 20:14:05 +08:00
parent dc0cc9c738
commit c4b9484e94
2 changed files with 23 additions and 12 deletions

View File

@@ -25,6 +25,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.zhidao.loglib.download.DownloadManager
import com.zhidao.loglib.download.OnDownloadListener
import com.zhjt.mogo_core_function_devatools.R
import com.zhjt.mogo_core_function_devatools.badcase.biz.adapter.BagManagerListAdapter
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
@@ -219,19 +220,29 @@ class BadCaseManagerView @JvmOverloads constructor(
}
override fun bagAudio(key: Long, audioUrl: String) {
DownloadManager.getInstance().init(context)
DownloadManager.getInstance().init(context,true)
val downUrl = audioUrl.replace("http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/","")
DownloadManager.getInstance().download(downUrl,
audioSavePath,"${key}.wav")
//延迟播放
Handler().postDelayed({
//音频文件播放
try {
Audition.getInstance().playOrStop("${audioSavePath}${key}.wav")
}catch (e: Exception){
CallerLogger.i(M_DEVA + TAG,"playOrStop=${e}")
}
}, 1500)
audioSavePath,"${key}.wav",object :OnDownloadListener{
override fun onProgress(progress: Float) {
}
override fun onSuccess(localPath: String?) {
UiThreadHandler.post({
try {
Audition.getInstance().playOrStop("${audioSavePath}${key}.wav")
}catch (e: Exception){
CallerLogger.i(M_DEVA + TAG,"playOrStop=${e}")
}
},UiThreadHandler.MODE.QUEUE)
}
override fun onFailed(reason: String?) {
}
})
}
override fun lookMapScreen(key: Long) {