Commit 9d376840 authored by Alex朱枝文's avatar Alex朱枝文

小窗没登录不让展示,增加直播间避免提前加入直播间,总是获取新的token channel uid状态,增加加入失败日志

parent 4e291b8b
......@@ -26,6 +26,7 @@ enum YHModuleNameValue: String {
case networkDataType = "networkDataType" // 网络数据
case h5InteractionType = "h5InteractionType" // 与H5交互相关
case clickType = "clickType" // 用户点点击事件
case logTypeError = "logTypeError" // log失败状态
}
class YHAliYunLogManager {
......
......@@ -77,6 +77,10 @@ class YHHomePageViewController: YHBaseViewController {
super.viewWillAppear(animated)
isTopMostAndVisible = true
YHPlayerManager.shared.handlePageChanged(isRecommendPage: true)
// 没登录不让展示小窗
guard YHLoginManager.shared.isLogin() else {
return
}
guard YHPlayerManager.shared.isConfigFloating != false else {
return
}
......
......@@ -251,7 +251,7 @@ extension YHHomeBannerView: FSPagerViewDataSource, FSPagerViewDelegate {
// YHPlayerManager.shared.leaveChannel(for: player)
// player.clearPlayerView()
// }
let playbackInfo = YHPlayerManager.PlaybackInfo(id: model.live_id, url: nil, title: nil, roomId: nil, token: model.token, channelId: model.rtmp_channel, uid: model.user_id != 0 ? UInt(model.user_id) : nil, isLive: true, scene: .fullscreen)
let playbackInfo = YHPlayerManager.PlaybackInfo(id: model.live_id, url: nil, title: nil, roomId: nil, token: nil, channelId: nil, uid: nil, isLive: true, scene: .fullscreen)
YHPlayerManager.shared.enterLive(from: cell?.bannerImagV, playbackInfo: playbackInfo)
printLog("跳转直播")
case 101://录播
......@@ -276,7 +276,7 @@ extension YHHomeBannerView: FSPagerViewDataSource, FSPagerViewDelegate {
// player.clearPlayerView()
// }
let cell: YHHomeBannerCollectionViewCell? = pagerView.cellForItem(at: index) as? YHHomeBannerCollectionViewCell
let playbackInfo = YHPlayerManager.PlaybackInfo(id: model.live_id, url: model.live_pull_url, title: nil, roomId: nil, token: model.token, channelId: model.rtmp_channel, uid: UInt(model.user_id), isLive: true, scene: .fullscreen)
let playbackInfo = YHPlayerManager.PlaybackInfo(id: model.live_id, url: nil, title: nil, roomId: nil, token: nil, channelId: nil, uid: nil, isLive: true, scene: .fullscreen)
YHPlayerManager.shared.enterLive(from: cell?.bannerImagV, playbackInfo: playbackInfo)
case 0://0 不需要跳转
printLog("0 不需要跳转")
......
......@@ -251,6 +251,28 @@ class YHPlayerManager: NSObject {
}
if result == 0 {
player.setJoinInfo(token: token, channelId: channelId, uid: uid)
} else {
//-2: #AgoraErrorCodeInvalidArgument
//-3: #AgoraErrorCodeNotReady
//-5: #AgoraErrorCodeRefused
var errorMsg = "加入失败"
switch result {
case -2:
errorMsg = "AgoraErrorCodeInvalidArgument"
case -3:
errorMsg = "AgoraErrorCodeNotReady"
case -5:
errorMsg = "AgoraErrorCodeRefused"
default:
break
}
let dic: [AnyHashable : Any] = [
"type": "joinLiveChannelError",
"channelId" : channelId,
"uid" : uid,
"errorMsg": errorMsg
]
YHAliYunLogManager.shared.addModuleName(.logTypeError, remark: dic)
}
} else {
mainChannelDelegate?.channelId = channelId
......@@ -266,6 +288,28 @@ class YHPlayerManager: NSObject {
joinSuccess: nil)
if result == 0 {
player.setJoinInfo(token: token, channelId: channelId, uid: uid)
} else {
//-2: #AgoraErrorCodeInvalidArgument
//-3: #AgoraErrorCodeNotReady
//-5: #AgoraErrorCodeRefused
var errorMsg = "加入失败"
switch result {
case -2:
errorMsg = "AgoraErrorCodeInvalidArgument"
case -3:
errorMsg = "AgoraErrorCodeNotReady"
case -5:
errorMsg = "AgoraErrorCodeRefused"
default:
break
}
let dic: [AnyHashable : Any] = [
"type": "joinLiveChannelError",
"channelId" : channelId,
"uid" : uid,
"errorMsg": errorMsg
]
YHAliYunLogManager.shared.addModuleName(.logTypeError, remark: dic)
}
}
}
......@@ -420,6 +464,7 @@ class YHPlayerManager: NSObject {
}
}
/*
// 加入频道
if let token = playbackInfo.token,
let channelId = playbackInfo.channelId, let uid = playbackInfo.uid, !token.isEmpty, !channelId.isEmpty {
......@@ -434,6 +479,8 @@ class YHPlayerManager: NSObject {
joinChannel(for: player, token: token, channelId: channelId, uid: uid, view: playerVC.playerView)
}
}
*/
leaveChannel(for: player)
if let lastNav = lastNav, lastLiveVC != nil {
lastNav.viewControllers.removeAll()
......
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