This commit is contained in:
2023-12-07 14:23:26 +08:00
parent 228943fc02
commit 0760d28d36
13 changed files with 213 additions and 49 deletions

View File

@@ -371,6 +371,11 @@ function SrsRtcPlayerAsync() {
await self.pc.setLocalDescription(offer);
var session = await new Promise(function (resolve, reject) {
// @see https://github.com/rtcdn/rtcdn-draft
conf.apiUrl = conf.apiUrl.replace('172.16.3.17', '172.16.3.18');
conf.streamUrl = conf.streamUrl.replace('172.16.3.17', '172.16.3.18');
var data = {
api: conf.apiUrl, tid: conf.tid, streamurl: conf.streamUrl,
clientip: null, sdp: offer.sdp

View File

@@ -92,7 +92,7 @@ export default {
isForce: "0",
hasVideo: "1",
callSessionId: "",
callStatus: "watting",//房间状态
callStatus: "0",//房间状态 1 未开始等待 2已开始 3已关闭
callRoomInfoRequetTimes:0,//房间拉取次数
};
},
@@ -141,8 +141,8 @@ export default {
message: `${this.inviteName}邀请你加入${this.videoTitle}聊天`,
})
.then(() => {
this.callBegin();
this.init();
this.callStatus=1
// on confirm
})
.catch(() => {
@@ -160,6 +160,7 @@ export default {
this.callSessionId = uuidv4();
this.sendInvite();
this.init();
this.callStatus=1
} catch (e) {
console.log(e)
}
@@ -435,6 +436,19 @@ export default {
},
}).then(res => {
if (res.status == 200) {
if(this.isPublish==1){
if(res.data.data.length==2){
this.callStatus=2
this.callBegin();
}
}else {
if(res.data.data.length==1){
this.callStatus=2
this.callBegin();
}
}
this.generateVideoRoomStream(res.data.data)
}else {
this.generateVideoRoomStream([])
@@ -459,12 +473,13 @@ export default {
})
},
callBegin() {
let passiveId=this.roomId==this.uid?this.tuid:this.tuid
let roomInfo = {
id:uuidv4(),
inviteId: this.roomId,//后面改成发起人的手机号或者id
roomId: this.roomId,
passiveId: this.uid,
passiveId: passiveId,
isForce: this.isForce,
type: this.hasVideo == 1 ? "video" : "voice",
}
@@ -533,12 +548,80 @@ export default {
},
generateVideoRoomStream(videoList) {
this.callRoomInfoRequetTimes=this.callRoomInfoRequetTimes+1;
if(this.callRoomInfoRequetTimes>5){
if(videoList.length==0){
//如果电话一直未拨通
if(this.callStatus==1){
if(this.callRoomInfoRequetTimes>12){
if(videoList.length==0){
// 拉取5次房间列表之后如果房间里面视频流的数量为0则关掉房间
this.videoDownAction()
}
Notify({
message: '通讯异常,即将挂断',
duration: 2,
type: 'primary'
});
setTimeout(()=>{
this.videoDownAction()
},1500)
}
if(videoList.length==1){
// 拉取5次房间列表之后如果房间里面视频流的数量为1,并且是自己的流,则关闭房间
if(videoList[0].publishId==this.uid){
Notify({
message: '通讯异常,即将挂断',
duration: 2,
type: 'primary'
});
setTimeout(()=>{
this.videoDownAction()
},1500)
}
//如果房间里面只有一路流,并且是查岗模式,则表示正常
if(this.isPublish==0){
this.callRoomInfoRequetTimes=0;
}
}
if(videoList.length==2){
this.callRoomInfoRequetTimes=0;
}
}
}
//如果电话打通过一次
if(this.callStatus==2){
if(this.callRoomInfoRequetTimes>2){
if(videoList.length==0){
// 拉取5次房间列表之后如果房间里面视频流的数量为0则关掉房间
Notify({
message: '通讯异常,即将挂断',
duration: 2,
type: 'primary'
});
setTimeout(()=>{
this.videoDownAction()
},1500)
}
if(videoList.length==1){
// 拉取5次房间列表之后如果房间里面视频流的数量为1,并且是自己的流,则关闭房间
if(videoList[0].publishId==this.uid){
Notify({
message: '通讯异常,即将挂断',
duration: 2,
type: 'primary'
});
setTimeout(()=>{
this.videoDownAction()
},1500)
}
//如果房间里面只有一路流,并且是查岗模式,则表示正常
if(this.isPublish==0){
this.callRoomInfoRequetTimes=0;
}
}
if(videoList.length==2){
this.callRoomInfoRequetTimes=0;
}
}
}
let hasUpdate = false;
if (this.oldVideoStreamList == null) {