GlobalConfig.js 10.1 KB
/*
* 全局数据管理
* */
import Loger from 'Loger';
import ApeConsts from "apes/ApeConsts";

let loger = Loger.getLoger('GlobalConfig');

class GlobalConfig {
    constructor () {

    }
    _currentStatus=null;


    static setDebugData (_deBugData){
        this.isDebug=true;
        this.deBugData=_deBugData;
    }
    static getCurrentStatus(){
        if(this._currentStatus==null){
            this._currentStatus=this.statusCode_0;
        }
        return this._currentStatus;
    }
    static setCurrentStatus(_data){
        this._currentStatus=_data;
    }
    static getClassDetail(){
        return  this.classDetail;
    }
    static setClassDetail(_data){
        this.classDetail=_data;
        this.className=_data.meetingName||"";
        this.classBeginTime=_data.beginTime||"";
        this.classEndTime=_data.endTime||"";
        //
        //"cycle": 0,
        //    "repeatmonthweekweek": 0,
        //    "status": 1,
        //    "repeatmonthday": 0,
        //    "repeatmode": 0,
        //    "beginTime": "2017-02-03 09:00:00",
        //    "frequency": 1,
        //    "endmode": 0,
        //    "meetingContent": "",
        //    "endTime": "2017-03-31 11:00:00",
        //    "repeatweek": "",
        //    "category": "",
        //    "finalenddate": "",
        //    "repeatday": 0,
        //    "meetingName": "mcu1",
        //    "errorCode": 0,
        //    "monthType": 0,
        //    "repeatmonthweekday": 0,
        //    "endcount": 1
    }

    static getClassInfo (){
        if(this.isDebug){

            //这几个属性是sass验证完成之后返回的,启动MCU的时候需要
            this .deBugData.MCUServerIP=this.MCUServerIP;
            this .deBugData.MCUServerPort=this.MCUServerPort;
            this .deBugData.maxVideoChannels=this.maxVideoChannels;
            this .deBugData.maxAudioChannels=this.maxAudioChannels;
            this .deBugData.maxMediaChannels=this.maxMediaChannels;

            return this .deBugData;
        }else {
            return{
                "siteId": this.siteId,
                "classId": this.classId,
                "className": this.className,
                "h5Module": this.h5Module,
                "nodeId": this.nodeId,
                "topNodeID":this.topNodeID,
                "userRole": this.userRole,
                "role": this.role,
                "isHost": this.isHost,
                "userId": this.userId,
                "userName": this.userName,
                "password": this.password,
                "userType": this.userType,
                "passwordRequired": this.passwordRequired,
                "md5": this.md5,
                "msType": this.msType,
                "portal": this.portal,
                "mcuDelay":this.mcuDelay,
                "MCUServerIP": this.MCUServerIP,
                "MCUServerPort":this.MCUServerPort,
                "maxVideoChannels": this.maxVideoChannels,
                "maxAudioChannels": this.maxAudioChannels,
                "maxMediaChannels": this.maxMediaChannels
            }
        }
    }

    //当前的课堂状态的信息
    static get classStatusInfo(){
        return {
            "classStatusInfo":{
                "nodeId":this.nodeId,//mcu中的唯一ID
                "userId":this.userId,//
                "userName":this.userName,

                "siteId":this.siteId,//站点号

                "classId":this.classId,
                "className":this.className,
                "classType":this.classType,//课堂类型
                "classStatus":this.classStatus,//课堂的状态
                "classStartTime":this.classStartTime,//课堂点击开始时间
                "classStopTime":this.classStopTime,//最后一次停止的时间(点暂停或结束),每次发送数据都获取当前时间戳
                "classTimestamp":this.recordTimestamp,//相对于点开始课堂的时间戳

                "classBeginTime":this.classBeginTime,//课堂创建的时间
                "classEndTime":this.classEndTime,//课堂结束的时间

                "recordStatus":this.recordStatus,//当前录制状态
                "recordTimestamp":this.recordTimestamp,//相对于开始录制的时间戳
                "recordStreamName":this.recordStreamName,//录制的文件名
                "recordDownloadUrl":this.recordDownloadUrl,//下载地址

                "systemTimestamp":this.systemTimestamp//当前的系统时间戳
            }
        }
    }

    // 判断自己是否主持人角色
     static  get isHost(){
        if(this.userRole ==ApeConsts.host){
            return true;
        }
        return false;
    }

    // 判断自己是否助教角色
     static  get isAssistant()
    {
        if(this.userRole ==ApeConsts.assistant){
            return true;
        }
        return false;
    }

    // 判断自己是否主讲人角色
     static  get isPresenter()
    {
        if(this.userRole ==ApeConsts.presenter){
            return true;
        }
        return false;
    }

    // 判断自己是否普通角色
     static  get isNormal()
    {
        if(this.userRole ==ApeConsts.normal) {
            return true;
        }
        return false;
    }

    // 判断自己是否是隐身用户
     static get isInvisible(){
        if(this.userRole == ApeConsts.invisible){
            return true;
        }
        return false;
    }

    //储存已经提前上传的文档列表
    static setDocListPrepare(_data){
        if(_data==null) return;
        this.docListPrepare=_data;
    }
    static getDocListPrepare(){
        return this.docListPrepare;
    }
    //储存文档录制列表
    static setDocRecordList(_data){
        if(_data==null) return;
        this.docRecordList=_data;
    }
    static getDocRecordList(){
        return this.docRecordList;
    }

    //文档服务器列表
    static setDocList(_data){
        if(_data==null) return;
        this.docList=_data;
    }
    static getDocList(){
        return this.docList;
    }
    //ms列表
    static setMsList(_data){
        if(_data==null) return;
        this.msList=_data;
    }
    static getMsList(){
        return this.msList;
    }

    //mcu列表
    static setMcuList(_data){
        if(_data==null) return;
        this.mcuList=_data;
    }
    static getMcuList(){
        return this.mcuList;
    }

    //声音列表
    static setMusicList(_data){
        if(_data==null) return;
        this.musicList=_data;
    }
    static getMusicList(){
        return this.musicList;
    }
    //已经上传的声音列表
    static setMusicListPrepare(_data){
        if(_data==null) return;
        this.musicListPrepare=_data;
    }
    static getMusicListPrepare(){
        return this.musicListPrepare;
    }

    //rs列表
    static setRsList(_data){
        if(_data==null) return;
        this.rsList=_data;
    }
    static getRsList(){
        return this.rsList;
    }
}

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.md5="";
GlobalConfig.msType=1;
GlobalConfig.mcuDelay=3000;//默认的延迟时间
GlobalConfig.docDelay=1600;//文档模块加入成功之后延迟发送送成功的消息给主模块
GlobalConfig.portal="112.126.80.182:80";
GlobalConfig.ip="112.126.80.182";
GlobalConfig.port="80";
GlobalConfig.MCUServerIP="114.215.195.70";
GlobalConfig.doc="";
GlobalConfig.MCUServerPort=9003;
GlobalConfig.maxVideoChannels=1;
GlobalConfig.maxAudioChannels=1;
GlobalConfig.maxMediaChannels=2;
GlobalConfig.isDebug=false;
GlobalConfig.deBugData={};
GlobalConfig.deviceType=-1; //设备类型  0:电脑  1:安卓  2:ios  -1未知
GlobalConfig.userIP="";//用户当前IP

GlobalConfig.userId=0;
GlobalConfig.userName="";
GlobalConfig.nodeId=0;//随机生成
GlobalConfig.passwordRequired=false;
GlobalConfig.password="";
GlobalConfig.userType=8;
GlobalConfig.userRole=ApeConsts.normal;//用户的身份,5种类型:
GlobalConfig.role=ApeConsts.NR_NORMAL;//课堂角色身份

GlobalConfig.h5Module=0;
GlobalConfig.siteId="gust";


GlobalConfig.topNodeID=101;//现在固定值,还不知道是做什么用

GlobalConfig.className= ""; // 课程名称
GlobalConfig.classId=0;//课堂号=classId=meetingNumber  之后统一修改为classId
GlobalConfig.classType=ApeConsts.CLASS_TYPE_INTERACT;//1:互动课堂,2:直播课堂
GlobalConfig.classStatus=ApeConsts.CLASS_STATUS_WAIT;// 0;//课堂还未开始  1;//直播中  2 //课间休息  3已经停止
GlobalConfig.classStartTime="";//课堂点击开始时间
GlobalConfig.classStopTime="";//最后一次停止的时间(点暂停或结束),每次发送数据都获取当前时间戳

GlobalConfig.classBeginTime="";//课堂创建的时间
GlobalConfig.classEndTime="";//课堂结束的时间

GlobalConfig.recordStartTime= "";
GlobalConfig.recordStartTimestam = "";
GlobalConfig.recordEndTimestamp = "";
GlobalConfig.recordTimestamp= "";

GlobalConfig.recordEndTime= "";
GlobalConfig.recordPlayURL= "";
GlobalConfig.recordConfigFile = ""; // 录制脚本文件
GlobalConfig.tickValues={}; // 滚动条关键点,用于快进快退



GlobalConfig.meetingParam={};//Sass直接返回的所有会议信息(最全)
GlobalConfig.classDetail={};//Sass直接返回的当前课堂基本信息

GlobalConfig.docListPrepare=[]; // 已经提前上传的文档,进入课堂后需要自动加载
GlobalConfig.docRecordList=[];//录制服务器地址集合
GlobalConfig.docList=[];//文档服务器地址集合
GlobalConfig.mcuList=[];//录制服务器地址集合
GlobalConfig.msList=[];//ms服务器地址集合
GlobalConfig.musicList=[];//music服务器地址集合
GlobalConfig.musicListPrepare=[];//提提前上传的music集合
GlobalConfig.rsList=[];

// client type
//点对点会议版本
 GlobalConfig.CT_P2PMEETING    = 0;
/**
 * 直播教育版本和大型直播版本
 */
GlobalConfig.CT_LIVEEDUCATION  = 1;
/**
 * 录制播放器
 */
GlobalConfig.CT_RECORDPLAYER   = 2;
/**
 * 实时流版本
 */
GlobalConfig. CT_LIVESTREAMING  = 3;
GlobalConfig.clientType =0;

export  default GlobalConfig;