Commit f6456cb1 by 徐健

Merge branch 'feature/audio_xj' into feature/test_home_pager

parents cfab77e2 b4f45bd1
......@@ -43,7 +43,7 @@ ext {
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.29",
"m-confide" : "0.0.31.8",
"m-consultant" : "0.0.44",
"m-fm" : "0.0.21",
"m-user" : "0.0.34",
......@@ -70,7 +70,7 @@ ext {
"ydl-webview" : "0.0.28",
"ydl-media" : "0.0.14",
"ydl-pay" : "0.0.11",
"m-audioim" : "0.0.29",
"m-audioim" : "0.0.31.9",
//以下 几乎不会动
"router" : "0.0.1",
......@@ -110,7 +110,7 @@ ext {
"ydl-webview" : "0.0.28",
"ydl-media" : "0.0.14",
"ydl-pay" : "0.0.11",
"m-audioim" : "0.0.29",
"m-audioim" : "0.0.31.9",
//以下 几乎不会动
......
......@@ -83,10 +83,12 @@ dependencies {
//开发时使用
api project(':ydl-platform')
api project(':ydl-webview')
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-audioim-api')
}else {
//发布时使用
api rootProject.ext.dependencies["ydl-webview"]
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-audioim-api"]
api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
......
......@@ -38,10 +38,7 @@ import com.ydl.ydl_image.config.SimpleImageOpConfiger
import com.ydl.ydl_image.manager.YDLImageCacheManager
import com.ydl.ydl_av.chat.bean.AudioMessageBean
import com.ydl.audioim.contract.IAudioHomeActivityContract
import com.ydl.audioim.http.command.ConnectCommand
import com.ydl.audioim.http.command.ConnectFinishCommand
import com.ydl.audioim.http.command.ConnectStartCommand
import com.ydl.audioim.http.command.NoticePushCommand
import com.ydl.audioim.http.command.*
import com.ydl.audioim.player.AudioPlayer
import com.ydl.audioim.presenter.AudioHomePresenterImpl
import com.ydl.audioim.utils.DateUtils
......@@ -51,10 +48,12 @@ import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.webview.RefreshWebEvent
import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.YdlCommonRouterManager
import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus
import io.agora.rtc.IRtcEngineEventHandler
import io.reactivex.Observable
......@@ -174,6 +173,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override fun onWarning(warn: Int) {
super.onWarning(warn)
uploadException("mRtcEventHandler-onWarning:warnCode--%${warn}")
//103:没有可用的频道资源。可能是因为服务端没法分配频道资源
//104:查找频道超时。在加入频道时 SDK 先要查找指定的频道,出现该警告一般是因为网络太差,连接不到服务器
//105:查找频道请求被服务器拒绝。服务器可能没有办法处理这个请求或请求是非法的
......@@ -192,6 +192,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override fun onError(err: Int) {
super.onError(err)
uploadException("mRtcEventHandler-onError:errorCode--%${err}")
//3:SDK 初始化失败。Agora 建议尝试以下处理方法
//7:SDK 尚未初始化,就调用其 API。请确认在调用 API 之前已创建 RtcEngine 对象并完成初始化
//10:API 调用超时。有些 API 调用需要 SDK 返回结果,如果 SDK 处理时间过长,超过 10 秒没有返回,会出现此错误
......@@ -288,6 +289,17 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
}
//
/**
* 上传错误日志
*/
private fun uploadException(message: String) {
var time: String = (System.currentTimeMillis() / 1000).toString()
var uid: String = ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid!!
var payLoad = PayLoad(channelId?:"0", time, uid, "1", "999", message)
var connectException = ConnectExceptionCommand(time, "2", "99", payLoad)
getPresenter().connectException(connectException)
}
override fun createPresenter(): IAudioHomeActivityContract.Presenter {
return AudioHomePresenterImpl()
}
......@@ -609,13 +621,13 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
remainTime!!.toInt() - localRemainTime!!, callId!!,
"0","0","$callStartTime",
"${System.currentTimeMillis()}",3)
mPresenter.connectFinish(param)
// mPresenter.connectFinish(param)
}else{
//接通开始回调
callStartTime = System.currentTimeMillis()
var param = ConnectStartCommand(listenerUid!!, relationId!!, callId!!,
"${System.currentTimeMillis()}","3","0","0","0","0")
mPresenter.connectStart(param)
// mPresenter.connectStart(param)
}
}
......
package com.ydl.audioim.contract
import com.ydl.audioim.bean.ConnectBean
import com.ydl.audioim.http.command.ConnectCommand
import com.ydl.audioim.http.command.ConnectFinishCommand
import com.ydl.audioim.http.command.ConnectStartCommand
import com.ydl.audioim.http.command.NoticePushCommand
import com.ydl.audioim.http.command.*
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.mvp.base.BasePresenter
......@@ -66,13 +63,18 @@ interface IAudioHomeActivityContract {
* 通话开始(更新专家状态)
* @param param 请求参数
*/
fun connectStart(param: ConnectStartCommand)
// fun connectStart(param: ConnectStartCommand)
/**
* 通话结束(更新专家状态)
* @param param 请求参数
*/
fun connectFinish(param: ConnectFinishCommand)
// fun connectFinish(param: ConnectFinishCommand)
/**
* 通话异常
*/
fun connectException(param: ConnectExceptionCommand)
/**
......@@ -91,12 +93,17 @@ interface IAudioHomeActivityContract {
/**
* 通话开始回调(更新专家状态)
*/
fun connectStart(param: ConnectStartCommand): Observable<BaseAPIResponse<Any>>
// fun connectStart(param: ConnectStartCommand): Observable<BaseAPIResponse<Any>>
/**
* 通话结束(更新专家状态)
*/
fun connectFinish(param: ConnectFinishCommand): Observable<BaseAPIResponse<Any>>
// fun connectFinish(param: ConnectFinishCommand): Observable<BaseAPIResponse<Any>>
/**
* 通话异常
*/
fun connectException(param: ConnectExceptionCommand): Observable<BaseAPIResponse<Any>>
/**
......
......@@ -3,10 +3,7 @@ package com.ydl.audioim.http
import com.google.gson.Gson
import com.ydl.audioim.bean.AgoraTokenResponse
import com.ydl.audioim.bean.ConnectBean
import com.ydl.audioim.http.command.ConnectCommand
import com.ydl.audioim.http.command.NoticePushCommand
import com.ydl.audioim.http.command.ConnectFinishCommand
import com.ydl.audioim.http.command.ConnectStartCommand
import com.ydl.audioim.http.command.*
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.data.http.RxUtils
......@@ -41,12 +38,12 @@ class AudioApiRequestUtil {
* @param param
* @return
*/
fun connectStart(param: ConnectStartCommand): Observable<BaseAPIResponse<Any>> {
// val list = YdlRetrofitUtils.getPostList(param)
var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str) as RequestBody
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).connectStart(body)
}
// fun connectStart(param: ConnectStartCommand): Observable<BaseAPIResponse<Any>> {
//// val list = YdlRetrofitUtils.getPostList(param)
// var str = Gson().toJson(param)
// val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str) as RequestBody
// return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).connectStart(body)
// }
/**
* 通话结束回调
......@@ -54,11 +51,23 @@ class AudioApiRequestUtil {
* @param param
* @return
*/
fun connectFinish(param: ConnectFinishCommand): Observable<BaseAPIResponse<Any>> {
// val list = YdlRetrofitUtils.getPostList(param)
// fun connectFinish(param: ConnectFinishCommand): Observable<BaseAPIResponse<Any>> {
//// val list = YdlRetrofitUtils.getPostList(param)
// var str = Gson().toJson(param)
// val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str) as RequestBody
// return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).connectFinish(body)
// }
/**
* 通话警告与异常回调
*
* @param param
* @return
*/
fun connectException(param: ConnectExceptionCommand): Observable<BaseAPIResponse<Any>> {
var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str) as RequestBody
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).connectFinish(body)
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).connectException(body)
}
/**
......
......@@ -21,16 +21,23 @@ interface AudioNetAPi {
/**
* 通话开始回调
*/
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA,"Content-Type:application/json")
@POST("auth/listen-order/callback/agora/start")
fun connectStart(@Body body:RequestBody): Observable<BaseAPIResponse<Any>>
// @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA,"Content-Type:application/json")
// @POST("auth/listen-order/callback/agora/start")
// fun connectStart(@Body body:RequestBody): Observable<BaseAPIResponse<Any>>
/**
* 通话结束回调
*/
// @Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA,"Content-Type:application/json")
// @POST("auth/listen-order/callback/agora/finish")
// fun connectFinish(@Body body:RequestBody): Observable<BaseAPIResponse<Any>>
/**
* 通话警告与错误回调
*/
@Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA,"Content-Type:application/json")
@POST("auth/listen-order/callback/agora/finish")
fun connectFinish(@Body body:RequestBody): Observable<BaseAPIResponse<Any>>
@POST("auth/listen-order/callback/agora")
fun connectException(@Body body:RequestBody): Observable<BaseAPIResponse<Any>>
/**
......
package com.ydl.audioim.http.command
import com.ydl.ydlcommon.data.http.BaseCommand
/**
连接异常请求bean
*/
data class ConnectExceptionCommand(
var noticeId: String, // 秒级
var productId: String, // 2
var eventType: String, // 99
var payload: PayLoad
) : BaseCommand()
data class PayLoad(
var channelName: String, // 房间id
var ts: String, // 秒级
var uid: String,
var platform: String,
var reason: String,
var message: String
)
\ No newline at end of file
......@@ -3,10 +3,7 @@ package com.ydl.audioim.model
import com.ydl.audioim.bean.ConnectBean
import com.ydl.audioim.contract.IAudioHomeActivityContract
import com.ydl.audioim.http.AudioApiRequestUtil
import com.ydl.audioim.http.command.ConnectCommand
import com.ydl.audioim.http.command.NoticePushCommand
import com.ydl.audioim.http.command.ConnectFinishCommand
import com.ydl.audioim.http.command.ConnectStartCommand
import com.ydl.audioim.http.command.*
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import io.reactivex.Observable
......@@ -19,12 +16,16 @@ import io.reactivex.Observable
* @date 2018/10/30
*/
class AudioHomeModelImpl : IAudioHomeActivityContract.Model {
override fun connectStart(param: ConnectStartCommand): Observable<BaseAPIResponse<Any>> {
return AudioApiRequestUtil.connectStart(param)
}
// override fun connectStart(param: ConnectStartCommand): Observable<BaseAPIResponse<Any>> {
// return AudioApiRequestUtil.connectStart(param)
// }
//
// override fun connectFinish(param: ConnectFinishCommand): Observable<BaseAPIResponse<Any>> {
// return AudioApiRequestUtil.connectFinish(param)
// }
override fun connectFinish(param: ConnectFinishCommand): Observable<BaseAPIResponse<Any>> {
return AudioApiRequestUtil.connectFinish(param)
override fun connectException(param: ConnectExceptionCommand): Observable<BaseAPIResponse<Any>> {
return AudioApiRequestUtil.connectException(param)
}
override fun noticeServerPush(param: NoticePushCommand): Observable<BaseResponse<Any>> {
......
......@@ -3,10 +3,7 @@ package com.ydl.audioim.presenter
import com.ydl.audioim.BuildConfig
import com.ydl.ydl_av.chat.config.YDLChatParam
import com.ydl.audioim.contract.IAudioHomeActivityContract
import com.ydl.audioim.http.command.ConnectCommand
import com.ydl.audioim.http.command.ConnectFinishCommand
import com.ydl.audioim.http.command.ConnectStartCommand
import com.ydl.audioim.http.command.NoticePushCommand
import com.ydl.audioim.http.command.*
import com.ydl.audioim.model.AudioHomeModelImpl
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.router.YdlCommonRouterManager
......@@ -23,48 +20,62 @@ import io.reactivex.schedulers.Schedulers
* @date 2018/10/30
*/
class AudioHomePresenterImpl : BasePresenter<IAudioHomeActivityContract.View, IAudioHomeActivityContract.Model>(), IAudioHomeActivityContract.Presenter {
override fun connectStart(param: ConnectStartCommand) {
mModel.connectStart(param)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe {
// override fun connectStart(param: ConnectStartCommand) {
// mModel.connectStart(param)
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .doOnSubscribe {
//
// }
// .doAfterTerminate {
//// view.dismissProgressView()
// }
// .subscribe({
//// if (isSwitchAxb) {
//// //切换axb:跳到拨号界面
//// view.dialPhone()
//// }
// }, { e ->
// LogUtil.e(e.message)
// })
// }
}
.doAfterTerminate {
// view.dismissProgressView()
}
.subscribe({
// if (isSwitchAxb) {
// //切换axb:跳到拨号界面
// view.dialPhone()
// }
}, { e ->
LogUtil.e(e.message)
})
}
// override fun connectFinish(param: ConnectFinishCommand) {
// mModel.connectFinish(param)
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .doOnSubscribe {
// //通知服务端专家已经接通时,此时用户已在界面通话中,不需要弹进度条
// mView.showProgressView()
// }
// .doAfterTerminate {
// mView.dismissProgressView()
// }
// .subscribe({
//// if (isSwitchAxb) {
//// //切换axb:跳到拨号界面
//// view.dialPhone()
//// }
// //挂断逻辑:不管接口调用成功与否,都关闭界面
// mView.finishActivity()
// }, { e ->
// LogUtil.e(e.message)
// //挂断逻辑:不管接口调用成功与否,都关闭界面
// mView.finishActivity()
// })
// }
override fun connectFinish(param: ConnectFinishCommand) {
mModel.connectFinish(param)
override fun connectException(param: ConnectExceptionCommand) {
mModel.connectException(param)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe {
//通知服务端专家已经接通时,此时用户已在界面通话中,不需要弹进度条
mView.showProgressView()
}
.doAfterTerminate {
mView.dismissProgressView()
}
.subscribe({
// if (isSwitchAxb) {
// //切换axb:跳到拨号界面
// view.dialPhone()
// }
//挂断逻辑:不管接口调用成功与否,都关闭界面
mView.finishActivity()
}, { e ->
LogUtil.e(e.message)
//挂断逻辑:不管接口调用成功与否,都关闭界面
mView.finishActivity()
})
}
......
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