李勇

1.增加一个切换视频录制状态的接口;2.对课堂录制的启动逻辑做现在处理,加入课堂之后已经开启录制之后不再继续发生

... ... @@ -63,7 +63,7 @@ export default class MessageEntrance extends Emiter {
super();
this.lastClassActiveTime=0;//最后一次课堂激活的时间戳
//sdk 信息
GlobalConfig.sdkVersion = "v2.27.11.20171109";
GlobalConfig.sdkVersion = "v2.28.1.20171110";
loger.warn("sdkVersion:" + GlobalConfig.sdkVersion);
console.log("sdkVersion:" + GlobalConfig.sdkVersion);
//设置
... ... @@ -304,7 +304,7 @@ export default class MessageEntrance extends Emiter {
this.setInvisibleMediaView = this._setInvisibleMediaView.bind(this);//设置监课身份的视图
this.setAppConfig = this._setAppConfig.bind(this);
this.recordControl = this._mediaRecordControl.bind(this);
this.recordControl = this._changeMediaRecordStatus.bind(this);//切换控制音视频的录制状态
this.changeRtcVideoConfig = this._changeRtcVideoConfig.bind(this);//设置webRtc视频视图的缩放
... ... @@ -2421,7 +2421,7 @@ export default class MessageEntrance extends Emiter {
//上传文档
_sendDocumentUpload(_param) {
if (!_mcu.connected) {
loger.warn(GlobalConfig.getCurrentStatus());
console.warn("连接已经断开->上传文档");
return;
}
if (_doc_ape) {
... ... @@ -2548,8 +2548,15 @@ export default class MessageEntrance extends Emiter {
//如果当前课堂内只有自己或者离开上次课堂的时间大于8分钟,需要停止服务端的视频录制,设备不是H5
if(GlobalConfig.rosterNumber<=1&&interval>=(6*60)&&GlobalConfig.deviceType!=3){
loger.log("调用服务端音视频停止录制->interval:"+interval);
this._mediaRecordControl({"status": WebRtcApe.RECORD_STATUS_2});
setTimeout(()=>{
//延迟3秒,检测一下当前是否有人在开着视频,如果有开启的就不能再停止了
loger.log("当前开启音视频的人数->"+GlobalConfig.getPublishUser());
if(GlobalConfig.getPublishUser()<1){
loger.log("调用服务端音视频停止录制->interval:"+interval);
this._mediaRecordControl({"status": WebRtcApe.RECORD_STATUS_2});
}
},3000);
}
//如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传
... ... @@ -3352,7 +3359,7 @@ export default class MessageEntrance extends Emiter {
break;
case WebRtcApe.RECORD_STATUS_2:
//停止录制
//_webRtc.stopRecordingMedia();
loger.warn("调用停止音视频录制->");
_webRtc.changePublishStatusAndServerRecord(WebRtcApe.RECORD_STATUS_2);
break;
default :
... ... @@ -3361,6 +3368,14 @@ export default class MessageEntrance extends Emiter {
}
}
/*
* 切换音视频的录制状态 1开启 2停止
* */
_changeMediaRecordStatus(_param){
if(_webRtc){
_webRtc.changeMediaRecordStatus(_param);
}
}
//webRtc-----------------end --------------------------------
//判断是否能推流,当前课堂推流人数是有限制的
_hasFreePublishChannel() {
... ...
... ... @@ -10,6 +10,7 @@ class GlobalConfig {
constructor() {
}
_currentStatus = null;
static getCurrentStatus() {
... ... @@ -18,15 +19,19 @@ class GlobalConfig {
}
return this._currentStatus;
}
static setCurrentStatus(_data) {
this._currentStatus = _data;
}
static getClassDetail() {
return this.classDetail;
}
static setClassDetail(_data) {
this.classDetail = _data;
}
static getClassInfo() {
let classInfo = {};
classInfo.siteId = this.siteId;
... ... @@ -61,8 +66,8 @@ class GlobalConfig {
classInfo.appId = this.appId;
classInfo.appCertificate = this.appCertificate;
classInfo.appRecordingKey = this.appRecordingKey;
classInfo.channelId =this.channelId ;
classInfo.channelKey =this.channelKey ;
classInfo.channelId = this.channelId;
classInfo.channelKey = this.channelKey;
classInfo.userUid = this.userUid;
return classInfo;
... ... @@ -70,41 +75,42 @@ class GlobalConfig {
//获取当前的课堂状态的信息
static get classStatusInfo() {
let classStatusInfo = {};
classStatusInfo.siteId = this.siteId; //站点号
classStatusInfo.classId = this.classId;
classStatusInfo.className = this.className;
classStatusInfo.classType = this.classType; //课堂类型
classStatusInfo.classStatus = this.classStatus; //课堂的状态
classStatusInfo.classStartTime = this.classStartTime; //课堂点击开始时间
classStatusInfo.classStopTime = this.classStopTime; //最后一次停止的时间(点暂停或结束),每次发送数据都获取当前时间戳
classStatusInfo.classTimestamp = this.classTimestamp; //相对于点开始课堂的时间戳
classStatusInfo.recordPlaybackMaxTime = this.recordPlaybackMaxTime; //相对于点开始课堂的时间戳
classStatusInfo.classBeginTime = this.classBeginTime; //课堂创建的时间,这个是Sass返回的
classStatusInfo.classEndTime = this.classEndTime; //课堂结束的时间,这个是Sass返回的
classStatusInfo.isEnableDraw = this.isEnableDraw; //当前是否开启绘制权限
classStatusInfo.recordStatus = this.recordStatus; //当前录制状态
classStatusInfo.silence = this.silence; //当前课堂禁言状态
classStatusInfo.silenceUsers = this.silenceUsers; //当前课堂禁言状态
classStatusInfo.selfSilence = this.selfSilence; //当前自由禁言状态
classStatusInfo.recordTimestamp = this.recordTimestamp; //相对于首次开始录制的时间戳
classStatusInfo.recordFileName = this.recordFileName; //录制的文件名
classStatusInfo.recordDownloadUrl = this.recordDownloadUrl; //下载地址
classStatusInfo.serverTimestamp = this.serverTimestamp; //当前的系统时间戳
classStatusInfo.activeDocId = this.activeDocId; //当前激活的文档ID
classStatusInfo.activeDocCurPage = this.activeDocCurPage; //当前激活的文档的当前页
classStatusInfo.currentSceneTableId = this.currentSceneTableId; //文档区域的模块显示
classStatusInfo.serverAndLoacTimeDistanc = this.serverAndLoacTimeDistanc;
classStatusInfo.videoScale=this.videoScale;
return classStatusInfo;
}
//设置当前的课堂状态的信息
let classStatusInfo = {};
classStatusInfo.siteId = this.siteId; //站点号
classStatusInfo.classId = this.classId;
classStatusInfo.className = this.className;
classStatusInfo.classType = this.classType; //课堂类型
classStatusInfo.classStatus = this.classStatus; //课堂的状态
classStatusInfo.classStartTime = this.classStartTime; //课堂点击开始时间
classStatusInfo.classStopTime = this.classStopTime; //最后一次停止的时间(点暂停或结束),每次发送数据都获取当前时间戳
classStatusInfo.classTimestamp = this.classTimestamp; //相对于点开始课堂的时间戳
classStatusInfo.recordPlaybackMaxTime = this.recordPlaybackMaxTime; //相对于点开始课堂的时间戳
classStatusInfo.classBeginTime = this.classBeginTime; //课堂创建的时间,这个是Sass返回的
classStatusInfo.classEndTime = this.classEndTime; //课堂结束的时间,这个是Sass返回的
classStatusInfo.isEnableDraw = this.isEnableDraw; //当前是否开启绘制权限
classStatusInfo.recordStatus = this.recordStatus; //当前录制状态
classStatusInfo.silence = this.silence; //当前课堂禁言状态
classStatusInfo.silenceUsers = this.silenceUsers; //当前课堂禁言状态
classStatusInfo.selfSilence = this.selfSilence; //当前自由禁言状态
classStatusInfo.recordTimestamp = this.recordTimestamp; //相对于首次开始录制的时间戳
classStatusInfo.recordFileName = this.recordFileName; //录制的文件名
classStatusInfo.recordDownloadUrl = this.recordDownloadUrl; //下载地址
classStatusInfo.serverTimestamp = this.serverTimestamp; //当前的系统时间戳
classStatusInfo.activeDocId = this.activeDocId; //当前激活的文档ID
classStatusInfo.activeDocCurPage = this.activeDocCurPage; //当前激活的文档的当前页
classStatusInfo.currentSceneTableId = this.currentSceneTableId; //文档区域的模块显示
classStatusInfo.serverAndLoacTimeDistanc = this.serverAndLoacTimeDistanc;
classStatusInfo.videoScale = this.videoScale;
return classStatusInfo;
}
//设置当前的课堂状态的信息
static setClassStatusInfo(_data) {
//loger.log("setClassStatusInfo");
if (_data == null) {
... ... @@ -142,56 +148,77 @@ class GlobalConfig {
//this.recordStatus = data.recordStatus || this.recordStatus; //当前录制状态
this.recordStatus = data.recordStatus ||false; //当前录制状态
this.recordTimestamp =Math.max(parseInt(data.recordTimestamp), this.recordTimestamp); //录制时间取最大值
this.recordStatus = data.recordStatus || false; //当前录制状态
this.recordTimestamp = Math.max(parseInt(data.recordTimestamp), this.recordTimestamp); //录制时间取最大值
this.recordFileName = data.recordFileName || this.recordFileName; //录制的文件名
this.recordDownloadUrl = data.recordDownloadUrl || this.recordDownloadUrl; //下载地址
this.currentSceneTableId = data.currentSceneTableId || 0; //文档区域的模块显示
this.isEnableDraw=data.isEnableDraw||false;//是否开启所有人的绘制权限
this.videoScale=parseInt(data.videoScale)||1;
this.isEnableDraw = data.isEnableDraw || false;//是否开启所有人的绘制权限
this.videoScale = parseInt(data.videoScale) || 1;
// 全局禁言状态
this.silence = data.silence || false;
this.silenceUsers =data.silenceUsers || {};
if((typeof this.silenceUsers =='string')&& this.silenceUsers .constructor==String){
this.silenceUsers={};
this.silenceUsers = data.silenceUsers || {};
if ((typeof this.silenceUsers == 'string') && this.silenceUsers.constructor == String) {
this.silenceUsers = {};
}
}
/*
* 根据nodeId获取用户的身份
* */
static getUserRoleFromeNodeId(_nodeId){
let user=this.rosters[_nodeId];
if(user){
* 根据nodeId获取用户的身份
* */
static getUserRoleFromeNodeId(_nodeId) {
let user = this.rosters[_nodeId];
if (user) {
return user.userRole;
}else {
} else {
return "normal"
}
}
/*
* 根据nodeId获取用户的信息
* */
static getUserInfoFromeNodeId(_nodeId){
static getUserInfoFromeNodeId(_nodeId) {
return this.rosters[_nodeId];
}
//获取推流权限,需要检查当前是否可以继续推流
static getPublishPermission(){
if(!this.rosters){
static getPublishPermission() {
if (!this.rosters) {
return true;
}
let openCounter=0;
for (let i in this.rosters){
let item=this.rosters[i];
if(item&&item.userRole!=ApeConsts.invisible&&(item.openCamera>0||item.openMicrophones>0)){
let openCounter = 0;
for (let i in this.rosters) {
let item = this.rosters[i];
if (item && item.userRole != ApeConsts.invisible && (item.openCamera > 0 || item.openMicrophones > 0)) {
openCounter++;
//统计当前已经开启摄像头和麦克风的人数,如果当前开启的人数大于等于最大允许的数量就不允许其他人再打开
if(openCounter>=GlobalConfig.maxMediaChannels){
if (openCounter >= GlobalConfig.maxMediaChannels) {
return false;
}
}
}
return true;
}
/*
* 获取当前推流的人数
* */
static getPublishUser() {
if (!this.rosters) {
return 0;
}
let openCounter = 0;
for (let i in this.rosters) {
let item = this.rosters[i];
if (item && item.userRole != ApeConsts.invisible && (item.openCamera > 0 || item.openMicrophones > 0)) {
openCounter++;
}
}
return openCounter;
}
// 判断自己是否主持人角色
static get isHost() {
if (this.userRole == ApeConsts.host) {
... ... @@ -234,30 +261,34 @@ class GlobalConfig {
//是否是老师或主讲人
static get isTeachOrAssistant() {
if (this.userRole == ApeConsts.host||
this.userRole==ApeConsts.assistant||
this.userRole==ApeConsts.presenter) {
if (this.userRole == ApeConsts.host ||
this.userRole == ApeConsts.assistant ||
this.userRole == ApeConsts.presenter) {
return true;
}
return false;
}
static get serverTimestamp() {
return EngineUtils.creatTimestamp();
}
//储存已经提前上传的文档列表
return EngineUtils.creatTimestamp();
}
//储存已经提前上传的文档列表
static setDocListPrepare(_data) {
if (_data == null) return;
this.docListPrepare = _data;
}
static getDocListPrepare() {
return this.docListPrepare;
}
//储存已经提前上传的媒体共享文件列表
return this.docListPrepare;
}
//储存已经提前上传的媒体共享文件列表
static setMediaShareList(_data) {
if (_data == null) return;
this.sharedMediaList = _data;
}
static getMediaShareList() {
return this.sharedMediaList;
}
... ... @@ -267,6 +298,7 @@ class GlobalConfig {
if (_data == null) return;
this.sharedMusicList = _data;
}
static getMusicShareList() {
return this.sharedMusicList;
}
... ... @@ -276,6 +308,7 @@ class GlobalConfig {
if (_data == null) return;
this.recordList = _data;
}
static getRecordList() {
return this.recordList;
}
... ... @@ -285,14 +318,17 @@ class GlobalConfig {
if (_data == null) return;
this.docList = _data;
}
static getDocList() {
return this.docList;
}
//ms列表
return this.docList;
}
//ms列表
static setMsList(_data) {
if (_data == null) return;
this.msList = _data;
}
static getMsList() {
return this.msList;
}
... ... @@ -302,6 +338,7 @@ class GlobalConfig {
if (_data == null) return;
this.rtmpPullList = _data;
}
static getRtmpPullList() {
return this.rtmpPullList;
}
... ... @@ -311,6 +348,7 @@ class GlobalConfig {
if (_data == null) return;
this.hlsPullList = _data;
}
static getHlsPullList() {
return this.hlsPullList;
}
... ... @@ -320,6 +358,7 @@ class GlobalConfig {
if (_data == null) return;
this.rsList = _data;
}
static getRsList() {
return this.rsList;
}
... ... @@ -329,6 +368,7 @@ class GlobalConfig {
if (_data == null) return;
this.mcuList = _data;
}
static getMcuList() {
return this.mcuList;
}
... ... @@ -338,20 +378,22 @@ class GlobalConfig {
if (_data == null) return;
this.musicList = _data;
}
static getMusicList() {
return this.musicList;
}
//已经上传的声音列表
return this.musicList;
}
//已经上传的声音列表
static setMusicListPrepare(_data) {
if (_data == null) return;
this.musicListPrepare = _data;
}
static getMusicListPrepare() {
return this.musicListPrepare;
}
//CDN加速的 拉流地址 rtmp 和hls(m3u8)
static setVideoCDNAddr(_data) {
if (_data == null) return;
... ... @@ -364,33 +406,34 @@ class GlobalConfig {
}
//把IP中的端口换成指定端口
static replacePort(_ipport,_curPort,_newPort){
loger.warn("替换端口->",_ipport,_curPort,_newPort);
if(!_ipport||!_curPort){
static replacePort(_ipport, _curPort, _newPort) {
loger.warn("替换端口->", _ipport, _curPort, _newPort);
if (!_ipport || !_curPort) {
//数据不正确,直接返回原数据
return _ipport;
}
try {
//判断要替换的端口是否在最后的位置,否则是不能替换的,比如替换":80"端口,如果地址是"xxx.xxx.xxx:8080" 不判断的话就会出错
let lastIndex=_ipport.lastIndexOf(_curPort);
if((_ipport.length-_curPort.length)==lastIndex){
let ipportNew=_ipport.replace(_curPort,_newPort);
let lastIndex = _ipport.lastIndexOf(_curPort);
if ((_ipport.length - _curPort.length) == lastIndex) {
let ipportNew = _ipport.replace(_curPort, _newPort);
return ipportNew
}
return _ipport;
}catch (err){
} catch (err) {
return _ipport;
}
}
//通过IP查找IP对象
static getIpItem(ip,ipList){
if(!ip||!ipList) {
static getIpItem(ip, ipList) {
if (!ip || !ipList) {
return null;
}
for(let i=0;i<ipList.length;i++){
let item=ipList[i];
if(item&&item.ip==ip){
for (let i = 0; i < ipList.length; i++) {
let item = ipList[i];
if (item && item.ip == ip) {
return item;
}
}
... ... @@ -398,11 +441,11 @@ class GlobalConfig {
}
}
GlobalConfig.statusCode_0 = { "code": 0, message: "SDK 未初始化" };
GlobalConfig.statusCode_1 = { "code": 1, message: "未加入课堂" };
GlobalConfig.statusCode_2 = { "code": 2, message: "已经加入课堂" };
GlobalConfig.statusCode_3 = { "code": 3, message: "已经离开课堂" };
GlobalConfig.statusCode_4 = { "code": 4, message: "未知状态" };
GlobalConfig.statusCode_0 = {"code": 0, message: "SDK 未初始化"};
GlobalConfig.statusCode_1 = {"code": 1, message: "未加入课堂"};
GlobalConfig.statusCode_2 = {"code": 2, message: "已经加入课堂"};
GlobalConfig.statusCode_3 = {"code": 3, message: "已经离开课堂"};
GlobalConfig.statusCode_4 = {"code": 4, message: "未知状态"};
GlobalConfig.screenWidth = 1024;
GlobalConfig.screenHeight = 768;
... ... @@ -412,7 +455,7 @@ GlobalConfig.msType = 1; //逶ョ蜑榊崋螳夂畑霑吩クェ
GlobalConfig.messageDelay = false; //是否启用消息延迟
GlobalConfig.mcuDelay = 0; //默认的延迟时间(单位-秒)
GlobalConfig.classExit=false;//是否关闭课堂,如果关闭之后不再连接MCU
GlobalConfig.classExit = false;//是否关闭课堂,如果关闭之后不再连接MCU
GlobalConfig.docDelay = 1600; //文档模块加入成功之后延迟发送送成功的消息给主模块(sdk内部使用)
GlobalConfig.portal = ""; //Sass IP
... ... @@ -464,7 +507,6 @@ GlobalConfig.hlsPullListFinal = []; //譛扈磯画叫逧ЗLS諡画オ∝慍蝮髮粋
GlobalConfig.rsPullListFinal = []; //最终选择的录制回放HLS拉流地址集合
//连接MCU的IP+端口
GlobalConfig.MCUServerIP = "";
GlobalConfig.MCUServerPort = '';
... ... @@ -499,7 +541,7 @@ GlobalConfig.maxMediaChannels = 0; //譛螟ァ髻ウ隗「題キッ謨ー御サ・髻ウ隗「題キッ謨ー
GlobalConfig.hasCamera = false; //摄像头是否可用
GlobalConfig.hasMicrophone = false; //麦克风是否可用
GlobalConfig.returnCitySN=null;//获取的ip数据 {"cip":"60.253.214.122","cid":"110000","cname":"北京市"}
GlobalConfig.returnCitySN = null;//获取的ip数据 {"cip":"60.253.214.122","cid":"110000","cname":"北京市"}
GlobalConfig.deviceType = 0; //设备类型 0:电脑 1:ios 2:安卓
GlobalConfig.userIp = ""; //用户当前IP
GlobalConfig.userId = 0;
... ... @@ -508,7 +550,7 @@ GlobalConfig.handUpTime = 0;
GlobalConfig.level = 0;
GlobalConfig.openCamera = 0;
GlobalConfig.openMicrophones = 0;
GlobalConfig.selfDisEnableDrawTime=1;//记录是否禁用画笔,0为启用画笔,大于0时被禁用的时间戳
GlobalConfig.selfDisEnableDrawTime = 1;//记录是否禁用画笔,0为启用画笔,大于0时被禁用的时间戳
//视频质量相关设置
GlobalConfig.fps = 15; //帧频
... ... @@ -526,7 +568,7 @@ GlobalConfig.autoGain = false; //閾ェ蜉ィ隹鰍鮗ヲ蜈矩」朱浹驥
GlobalConfig.speakerVolume = 80; //扬声器音量(0-80)
GlobalConfig.micCode = 0; //麦克风模式
GlobalConfig.optionJsonData="";//音视频模块推流时的可选参数,这个由外部传入
GlobalConfig.optionJsonData = "";//音视频模块推流时的可选参数,这个由外部传入
GlobalConfig.audioRecords = [];
GlobalConfig.videoRecords = [];
GlobalConfig.status = 0
... ... @@ -570,7 +612,7 @@ GlobalConfig.updateRecordTimeDelay = 5; //(遘)悟酔豁・荳谺。隸セ蝣ょス募宛迥カ諤
GlobalConfig.updateClassInfoDelay = 10; //(秒),同步一次课堂状态的并保存到Sass
GlobalConfig.msDynamicChooseIpDelay = 60 * 3; //(秒)MS动态选点的间隔
//GlobalConfig.serverTimestamp=0;//当前的系统时间戳 用get set 获取
GlobalConfig.whiteboardId=2359297;//白板文档的ID
GlobalConfig.whiteboardId = 2359297;//白板文档的ID
GlobalConfig.activeDocId = 0; //当前激活的文档ID
GlobalConfig.activeDocCurPage = 1; //当前激活的文档的当前页
... ... @@ -583,9 +625,8 @@ GlobalConfig.classAllParam = {}; //Sass逶エ謗・霑泌屓逧園譛芽ッセ蝣ゆソ。諱ッ(譛蜈ィ)
GlobalConfig.classDetail = {}; //Sass直接返回的当前课堂基本信息
GlobalConfig.isRecordPlayBack = false; //是否是录制回放,默认是否
GlobalConfig.allowRecordMaxTime = 48*60*60; //(秒)允许录制的最长时间
GlobalConfig.allowRecordMaxTime = 48 * 60 * 60; //(秒)允许录制的最长时间
GlobalConfig.siteId_letv = 'shchuanbao'; //乐视,MS不需要动态选点的站点
GlobalConfig.ssTunnelAppURL = ''; //屏幕共享插件的地址
... ... @@ -593,36 +634,36 @@ GlobalConfig.serverTime = 0; //譛榊苅蝎ィ蠖灘燕譌カ髣エ謌ウ
GlobalConfig.serverAndLoacTimeDistanc = 0; //本地时间和服务器时间错的差值;
GlobalConfig.logUrl = ""; //日志上报地址;
GlobalConfig.rosterNumber=0;//当前总人数
GlobalConfig.rosters={};//当前课堂内的人员数据
GlobalConfig.rosterNumber = 0;//当前总人数
GlobalConfig.rosters = {};//当前课堂内的人员数据
GlobalConfig.isMobile = false; //是否是移动端
GlobalConfig.language="";//浏览器语言
GlobalConfig.platform="pc";//平台 IOS/ANDROID/PC
GlobalConfig.explorer="未知";//浏览器
GlobalConfig.explorerVersion="未知";//浏览器版本
GlobalConfig.os="未知";//系统
GlobalConfig.language = "";//浏览器语言
GlobalConfig.platform = "pc";//平台 IOS/ANDROID/PC
GlobalConfig.explorer = "未知";//浏览器
GlobalConfig.explorerVersion = "未知";//浏览器版本
GlobalConfig.os = "未知";//系统
GlobalConfig.locationProtocol="http://";//https;或http:
GlobalConfig.websocketProtocol="ws://";//wss或ws
GlobalConfig.isHttps=false;//是否是https
GlobalConfig.locationProtocol = "http://";//https;或http:
GlobalConfig.websocketProtocol = "ws://";//wss或ws
GlobalConfig.isHttps = false;//是否是https
GlobalConfig.openFlash=false;//使用flash通话模式。默认为false,使用的是webRtc
GlobalConfig.openFlash = false;//使用flash通话模式。默认为false,使用的是webRtc
//webRtc
GlobalConfig.appId = '';
GlobalConfig.appCertificate = "";
GlobalConfig.appRecordingKey = "";
GlobalConfig.channelId = "";
GlobalConfig.channelKey ="";
GlobalConfig.channelKey = "";
GlobalConfig.userUid = 0;
GlobalConfig.recordInterfaces="";//控制开启录制和录制状态改变的接口
GlobalConfig.getRecordInfoInterfaces="";//获取媒体录制信息数据的接口
GlobalConfig.stopRecordingInterfaces="";//停止录制的接口
GlobalConfig.getTxRecordInfoInterfaces="";//获取媒体录制信息数据的接口(tx)
GlobalConfig.getRecordFileURLAgoInterfaces="";//获取媒体录制信息数据的接口(ago)
GlobalConfig.getChannelToken="";//获取token的地址
GlobalConfig.recordFileSever="";//录制文件路径和文件地址(ago)
GlobalConfig.videoScale=1;//视频的缩放倍数,默认1倍无缩放
GlobalConfig.recordInterfaces = "";//控制开启录制和录制状态改变的接口
GlobalConfig.getRecordInfoInterfaces = "";//获取媒体录制信息数据的接口
GlobalConfig.stopRecordingInterfaces = "";//停止录制的接口
GlobalConfig.getTxRecordInfoInterfaces = "";//获取媒体录制信息数据的接口(tx)
GlobalConfig.getRecordFileURLAgoInterfaces = "";//获取媒体录制信息数据的接口(ago)
GlobalConfig.getChannelToken = "";//获取token的地址
GlobalConfig.recordFileSever = "";//录制文件路径和文件地址(ago)
GlobalConfig.videoScale = 1;//视频的缩放倍数,默认1倍无缩放
export default GlobalConfig;
... ...
... ... @@ -245,7 +245,7 @@ class ConferApe extends Ape {
optional string filename = 4; // 录像文件名称,filename中增加目录部分
}*/
if(this.recordStatus==conferRecordSendPdu.record){
if(this.recordStatus==true){
//已经有录制文件,不再发送
return;
}
... ... @@ -533,7 +533,6 @@ class ConferApe extends Ape {
});
} else {
loger.warn("踢人失败-参数无效")
console.log(_param);
}
}
... ...
... ... @@ -862,15 +862,18 @@ class WebRtcApe extends Emiter {
});
}
//调用媒体服务停止录制
stopRecordingMedia() {
//192.168.31.8:3000/recordInfo/stopRecording/
if (!GlobalConfig.stopRecordingInterfaces) {
loger.log("调用服务器端开启录制->失败->接口地址无效");
/*
* 切换音视频的录制状态
* */
changeMediaRecordStatus(_params) {
if (!GlobalConfig.recordInterfaces||!_params) {
loger.warn("切换音视频的录制状态->失败->接口地址无效",_params);
return;
}
let url = GlobalConfig.locationProtocol + GlobalConfig.stopRecordingInterfaces;
let data = this.packMediaInfoData(WebRtcApe.RECORD_STATUS_2);
loger.warn("切换音视频的录制状态->"+_params);
let url = GlobalConfig.locationProtocol + GlobalConfig.recordInterfaces;
let curTimestamp = new Date().getTime();
let data = `appId=${GlobalConfig.appId}&channel=${GlobalConfig.channelId}&channelKey=${GlobalConfig.appCertificate}&uid=${GlobalConfig.userUid}&status=${_params.status}&userId=${GlobalConfig.userId}&userName=${GlobalConfig.userName}&userRole=${GlobalConfig.userRole}&timestamp=${curTimestamp}&recordTimestamp=${GlobalConfig.recordTimestamp}`;
fetch(encodeURI(url), {
method: 'POST',
headers: {
... ... @@ -883,19 +886,19 @@ class WebRtcApe extends Emiter {
if (ret.ok) {
return ret.json();
} else {
loger.error(`调用服务器端开启录制-网络异常.状态码:${ret.status}`);
loger.error(`切换音视频的录制状态-网络异常.状态码:${ret.status}`);
throw '';
}
})
.then(ret => {
if (ret) {
loger.log('调用服务器端开启录制完成', ret);
loger.log('切换音视频的录制状态->完成', ret);
} else {
loger.warn('调用服务器端开启录制 失败.', ret);
loger.warn('切换音视频的录制状态 失败.', ret);
}
})
.catch(err => {
loger.error(`调用服务器端开启录制.状态码:${err}`);
loger.error(`切换音视频的录制状态.状态码:${err}`);
});
}
}
... ...