李勇

1.音视频模块增加streamId,和最新版的sdk兼容

... ... @@ -86,6 +86,7 @@ class AudioApe extends Ape {
}
let channelInfo={};
channelInfo.owner=GlobalConfig.nodeId;
channelInfo.status=ApeConsts.CHANNEL_STATUS_OPENING;
channelInfo.fromNodeId=GlobalConfig.nodeId;
channelInfo.channelId=_param.channelId;//freeChannel
... ... @@ -95,6 +96,10 @@ class AudioApe extends Ape {
channelInfo.toNodeId=0;
channelInfo.userId=_param.userId;
channelInfo.mediaType=ApeConsts.MEDIA_TYPE_AUDIO;
channelInfo.streamId=GlobalConfig.siteId+"_"
+ GlobalConfig.classId + "_"+_param.userId
+"_" + _param.channelId + "_" + _param.timestamp;
this.sendTableUpdateHandler(channelInfo);
return {"code": ApeConsts.RETURN_SUCCESS, "data":"推流成功!"}
}
... ... @@ -121,6 +126,7 @@ class AudioApe extends Ape {
}
let channelInfo={};
channelInfo.owner=0;
channelInfo.status=ApeConsts.CHANNEL_STATUS_RELEASED;
channelInfo.fromNodeId=0;
channelInfo.channelId=openingChannel;
... ... @@ -128,6 +134,7 @@ class AudioApe extends Ape {
channelInfo.classId=GlobalConfig.classId;
channelInfo.toNodeId=0;
channelInfo.mediaType=ApeConsts.MEDIA_TYPE_DEFAULT;
channelInfo.streamId="";
this.sendTableUpdateHandler(channelInfo);
}
... ... @@ -194,7 +201,8 @@ class AudioApe extends Ape {
let tableItemPdu = new pdu['RCRegistryTableItemPdu'];
tableItemPdu.itemIdx = _channelInfo.channelId;
tableItemPdu.owner = 0;//收到flash的是这个值,不清楚先写固定
//tableItemPdu.owner = 0;//收到flash的是这个值,不清楚先写固定
tableItemPdu.owner = _channelInfo.owner;//0收到flash的是这个值,MCU做了了用户掉线处理,30秒之后会清理owner为0
tableItemPdu.itemData = updateModelPdu.toArrayBuffer();
//insert
... ... @@ -245,7 +253,13 @@ class AudioApe extends Ape {
tableUpdateHandler(owner, itemIdx, itemData) {
// debugger;
let updateChannelInfo = this.unPackPdu(owner, itemIdx, itemData);
//****很重要********
//如果owner的值为0,代表的是这个歌频道已经被释放了(mcu服务端对于占用channel的掉线用户,就是把owner设置为0)
if(owner==0){
loger.log("释放占用的频道,channel",itemIdx);
updateChannelInfo.status=ApeConsts.CHANNEL_STATUS_RELEASED;
updateChannelInfo.streamId="";
}
this.mediaModule.mediaChannels[itemIdx] = updateChannelInfo;
this._emit(MessageTypes.AUDIO_UPDATE, updateChannelInfo);
... ... @@ -271,6 +285,7 @@ class AudioApe extends Ape {
packPduModel.timestamp =_param.timestamp||EngineUtils.creatTimestamp();
packPduModel.fromNodeId = GlobalConfig.nodeId;
packPduModel.toNodeId = 0;
packPduModel.streamId=_param.streamId;
console.log("packPdu",packPduModel);
return packPduModel;
}
... ...
... ... @@ -89,6 +89,7 @@ class VideoApe extends Ape {
}
let channelInfo={};
channelInfo.owner=GlobalConfig.nodeId;
channelInfo.status=ApeConsts.CHANNEL_STATUS_OPENING;
channelInfo.fromNodeId=GlobalConfig.nodeId;
channelInfo.channelId=_param.channelId;//freeChannel
... ... @@ -98,6 +99,10 @@ class VideoApe extends Ape {
channelInfo.toNodeId=0;
channelInfo.userId=_param.userId;
channelInfo.mediaType=ApeConsts.MEDIA_TYPE_VIDEO;
channelInfo.streamId=GlobalConfig.siteId+"_"
+ GlobalConfig.classId + "_"+_param.userId
+"_" + _param.channelId + "_" + _param.timestamp;
this.sendTableUpdateHandler(channelInfo);
return {"code": ApeConsts.RETURN_SUCCESS, "data":"推流成功!"}
}
... ... @@ -125,6 +130,7 @@ class VideoApe extends Ape {
}
let channelInfo={};
channelInfo.owner=0;
channelInfo.status=ApeConsts.CHANNEL_STATUS_RELEASED;
channelInfo.fromNodeId=0;
channelInfo.channelId=openingChannel;
... ... @@ -132,6 +138,7 @@ class VideoApe extends Ape {
channelInfo.classId=GlobalConfig.classId;
channelInfo.toNodeId=0;
channelInfo.mediaType=ApeConsts.MEDIA_TYPE_DEFAULT;
channelInfo.streamId="";
this.sendTableUpdateHandler(channelInfo);
}
... ... @@ -215,7 +222,8 @@ class VideoApe extends Ape {
let tableItemPdu = new pdu['RCRegistryTableItemPdu'];
tableItemPdu.itemIdx = _channelInfo.channelId;//tableItemPdu.itemIdx=ApeConsts.VIDEO_OBJ_TABLE_ID+2;
tableItemPdu.owner = 0;//收到flash的是这个值,不清楚先写固定
//tableItemPdu.owner = 0;//收到flash的是这个值,不清楚先写固定
tableItemPdu.owner = _channelInfo.owner;//0收到flash的是这个值,MCU做了了用户掉线处理,30秒之后会清理owner为0
tableItemPdu.itemData = updateModelPdu.toArrayBuffer();
//insert
... ... @@ -265,8 +273,17 @@ class VideoApe extends Ape {
}
tableUpdateHandler(owner, itemIdx, itemData) {
// debugger;
let videoChannelInfo = this.unPackPdu(owner, itemIdx, itemData);
//****很重要********
//如果owner的值为0,代表的是这个歌频道已经被释放了(mcu服务端对于占用channel的掉线用户,就是把owner设置为0)
if(owner==0){
loger.log("释放占用的频道,channel",itemIdx);
videoChannelInfo.status=ApeConsts.CHANNEL_STATUS_RELEASED;
videoChannelInfo.streamId="";
}
this.mediaModule.mediaChannels[itemIdx] = videoChannelInfo;
this._emit(MessageTypes.VIDEO_UPDATE, videoChannelInfo);
}
... ... @@ -291,6 +308,7 @@ class VideoApe extends Ape {
packPduModel.timestamp =_param.timestamp||EngineUtils.creatTimestamp();
packPduModel.fromNodeId = GlobalConfig.nodeId;
packPduModel.toNodeId = 0;
packPduModel.streamId=_param.streamId||"";
console.log("packPdu",packPduModel);
return packPduModel;
}
... ...
... ... @@ -776,6 +776,7 @@ message RCAudioChannelInfoPdu {
optional uint32 class_id = 7;//课堂号
optional string site_id = 8;//站点号
optional string user_id = 9;//用户的userId
optional string stream_id = 10;//流名称
}
message RCVideoChannelInfoPdu {
... ... @@ -788,6 +789,7 @@ message RCVideoChannelInfoPdu {
optional uint32 class_id = 7;//课堂号
optional string site_id = 8;//站点号
optional string user_id = 9;//用户的userId
optional string stream_id = 10;//流名称
}
message RCVideoChannelInfoRecordPdu {
... ...