Commit e936bc8a by MissYasiky

修改 js 登录方法:直播登录、回放登录

parent 926e9fd3
......@@ -132,8 +132,33 @@ export default class PolyvLogin extends Component {
}
if(this.checkInputIlleage()){
PolyvCloudClassModule.login(findNodeHandle(this), loginInfo.userId,
if(this.state.tabIndex == 0){ // 直播登录
PolyvCloudClassModule.liveLogin(findNodeHandle(this), loginInfo.userId,
loginInfo.channelId, loginInfo.appId, loginInfo.appScrect)
.then(ret => {
if (ret.code != 0) {
var str = "登录失败 errCode=" + ret.code + " errMsg=" + ret.message;
console.log(str);
alert(str);
} else {
console.log("登录成功");
}
})
} else { // 回放登录
PolyvCloudClassModule.playbackLogin(findNodeHandle(this), loginInfo.userId,
loginInfo.channelId, loginInfo.vid, loginInfo.appId, loginInfo.appScrect)
.then(ret => {
if (ret.code != 0) {
var str = "登录失败 errCode=" + ret.code + " errMsg=" + ret.message;
console.log(str);
alert(str);
} else {
console.log("登录成功");
}
})
}
}
}}>登录</Text>
</View>
......
......@@ -21,10 +21,22 @@ export const PolyvCloudClassModule = {
}
},
async login(handler, userId, channelId,vid,appId,appSecrect){
async liveLogin(handler, userId, channelId, appId, appSecrect){
console.log(`login_${userId}_${channelId}`)
try {
await PolyvRNCloudClassLoginModule.login(handler, userId, channelId,vid,appId,appSecrect)
await PolyvRNCloudClassLoginModule.liveLogin(handler, userId, channelId, appId, appSecrect)
return { "code":0 }
} catch (e) {
var code = e.code;
var message = e.message;
return { code, message }
}
},
async playbackLogin(handler, userId, channelId, vid, appId, appSecrect){
console.log(`login_${userId}_${channelId}`)
try {
await PolyvRNCloudClassLoginModule.playbackLogin(handler, userId, channelId, vid, appId, appSecrect)
return { "code":0 }
} catch (e) {
var code = e.code;
......
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 sign in to comment