/**
 * 预览流窗口跟随方法
 * 新增参数nums用于判断当前是否需要保持画面比例1是跟随流2是跟随窗口
 */
function preWindowfollowing(settings, nums, ch, w, h) {
    var ua = navigator.userAgent.toLocaleLowerCase();
    var pt = GetAbsoluteLocationEx($("#axdiv")[0]);
    if (pt) {
        var adjustPos = true;
        if (ua.match(/firefox/) != null || URL_Request("isp2p") == "p6s" || URL_Request("isp2p") == "p2p") { //火狐特殊处理
            adjustPos = false
        } else {
            adjustPos = true
        }
        var obj = {};
        obj.Fountion = "live";
        obj.LiveCtrl = {};
        obj.LiveCtrl.MoveDock = {};
        if (nums == 1) {
            obj.LiveCtrl.AspectRatio = {};
            obj.LiveCtrl.AspectRatio.ratio = true; //是否将预览画面纵横比修改为跟随流分辨率。true 表示跟随流分辨率，false 表示跟随窗
            obj.LiveCtrl.type = 6; //画面纵横比
        } else if (nums == 2) {
            obj.LiveCtrl.AspectRatio = {};
            obj.LiveCtrl.AspectRatio.ratio = false;
            obj.LiveCtrl.type = 6;
        } else {
            obj.LiveCtrl.type = 10; //窗口移动
        }
        obj.LiveCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
        if (config.isSupportMultiChannel) {
            obj.LiveCtrl.channel = ch;
        } else {
            obj.LiveCtrl.channel = 0;
        }
        if (pt) {
            obj.LiveCtrl.MoveDock.x = parseInt(pt.Left, 10);
            obj.LiveCtrl.MoveDock.y = parseInt(pt.Top, 10);
        }
        // obj.LiveCtrl.MoveDock.x = parseInt(pt.Left, 10);
        // obj.LiveCtrl.MoveDock.y = parseInt(pt.Top, 10);
        //排除
        if (settings) {
            // obj.LiveCtrl.MoveDock.w = parseInt(558, 10);
            // obj.LiveCtrl.MoveDock.h = parseInt(418, 10);
            if (w && h) {
                obj.LiveCtrl.MoveDock.w = parseInt(w, 10);
                obj.LiveCtrl.MoveDock.h = parseInt(h, 10);
            } else {
                obj.LiveCtrl.MoveDock.w = parseInt(558, 10);
                obj.LiveCtrl.MoveDock.h = parseInt(418, 10);
            }

        } else {
            if (pt) {
                obj.LiveCtrl.MoveDock.w = parseInt(pt.Width, 10);
                obj.LiveCtrl.MoveDock.h = parseInt(pt.Height, 10);
            }
            // obj.LiveCtrl.MoveDock.w = parseInt(pt.Width, 10);
            // obj.LiveCtrl.MoveDock.h = parseInt(pt.Height, 10);
        }
        // if (obj.LiveCtrl.MoveDock.w <= 0||obj.LiveCtrl.MoveDock.h <= 0) {
        //     return;
        // }
        obj.LiveCtrl.MoveDock.adjustPos = adjustPos;
        obj.LiveCtrl.settings = settings;
        if (self.playervideo) {
            self.playervideo.live(obj);
        } else {
            self.playervideo = new Playervideo();
            self.playervideo.live(obj);
        }

    }
}


function preWindowfollowingNVR(channel, nums) {
    var ua = navigator.userAgent.toLocaleLowerCase();
    var pt = GetAbsoluteLocationEx($("#axdiv")[0]);
    var adjustPos = true;
    if (ua.match(/firefox/) != null || URL_Request("isp2p") == "p6s" || URL_Request("isp2p") == "p2p") { //火狐特殊处理
        adjustPos = false
    } else {
        adjustPos = true
    }
    var obj = {};
    obj.Fountion = "live";
    obj.LiveCtrl = {};
    obj.LiveCtrl.MoveDock = {};
    //if (nums == 1) {
    obj.LiveCtrl.AspectRatio = {};
    obj.LiveCtrl.AspectRatio.ratio = false;
    obj.LiveCtrl.type = 6;
    // } else if (nums == 2) {
    //     obj.LiveCtrl.AspectRatio = {};
    //     obj.LiveCtrl.AspectRatio.ratio = false;
    //     obj.LiveCtrl.type = 6;
    // } else {
    //     obj.LiveCtrl.type = 10;
    // }
    obj.LiveCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    obj.LiveCtrl.channel = channel;
    obj.LiveCtrl.MoveDock.x = parseInt(pt.Left, 10);
    obj.LiveCtrl.MoveDock.y = parseInt(pt.Top, 10);
    obj.LiveCtrl.MoveDock.w = parseInt(pt.Width, 10);
    obj.LiveCtrl.MoveDock.h = parseInt(pt.Height, 10);
    if (obj.LiveCtrl.MoveDock.w <= 0) {
        return;
    }
    obj.LiveCtrl.MoveDock.adjustPos = adjustPos;
    obj.LiveCtrl.settings = false;
    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}

/**
 * nvr分屏的方法
 */
function nvrSplitScreen(num, channel) {
    var obj = {};
    obj.Fountion = "live";
    obj.LiveCtrl = {};
    obj.LiveCtrl.type = 11;
    obj.LiveCtrl.Split = {};
    obj.LiveCtrl.Split.Count = num;

    obj.LiveCtrl.channel = 0;
    //obj.PlaybackCtrl.Preview.browser = getBrowsername();

    obj.LiveCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}


/**
 * 原始比例和自动以的方法
 */
function nvrOriginalScale(channel, Bool) {
    var obj = {};
    obj.Fountion = "live";
    obj.LiveCtrl = {};
    obj.LiveCtrl.type = 6;
    obj.LiveCtrl.AspectRatio = {};
    obj.LiveCtrl.AspectRatio.ratio = Bool;
    obj.LiveCtrl.channel = channel;
    //obj.PlaybackCtrl.Preview.browser = getBrowsername();

    obj.LiveCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}


function playbackChannel(param, open, dzwl, paramdata, chn, channel, streamType) {
    var pt = GetAbsoluteLocationEx($("#axdiv")[0]);
    var ua = navigator.userAgent.toLocaleLowerCase();
    var adjustPos = true;
    if (ua.match(/firefox/) != null || URL_Request("isp2p") == "p6s" || URL_Request("isp2p") == "p2p") { //火狐特殊处理
        adjustPos = false
    } else {
        adjustPos = true
    }
    var obj = {};
    obj.Fountion = "live";
    obj.LiveCtrl = {};
    obj.LiveCtrl.Preview = {};
    obj.LiveCtrl.type = 1;
    obj.LiveCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    obj.LiveCtrl.channel = channel;
    obj.LiveCtrl.settings = false;
    obj.LiveCtrl.Preview.browser = getBrowsername();
    obj.LiveCtrl.Preview.title = document.getElementsByTagName("title")[0].text;
    obj.LiveCtrl.Preview.x = parseInt(pt.Left, 10);
    obj.LiveCtrl.Preview.y = parseInt(pt.Top, 10);
    var ARR = [];
    ARR.push('CAM' + (channel + 1));
    obj.LiveCtrl.Preview.channelName = ARR;
    if (dzwl == 1 || dzwl == 6 || dzwl == 7 || dzwl == 8) {
        obj.LiveCtrl.Preview.w = parseInt(558, 10);
        obj.LiveCtrl.Preview.h = parseInt(418, 10);
    } else {
        obj.LiveCtrl.Preview.w = parseInt(pt.Width, 10);
        obj.LiveCtrl.Preview.h = parseInt(pt.Height, 10);
    }

    obj.LiveCtrl.Preview.adjustPos = adjustPos;
    obj.LiveCtrl.Preview.streamType = streamType;
    obj.LiveCtrl.Preview.open = open;
    if (param == "cerate" || config.devicelose) { //走这一步的时候必须是easyvideo模式，devicelose这个状态也是针对它的，不判断刷新之后找不到资源会无法创建
        self.playervideo.reconcreatedev(obj, "", "", "", dzwl, paramdata);
    } else {
        if (self.playervideo) {
            self.playervideo.live(obj, dzwl, paramdata);
        } else {
            self.playervideo = new Playervideo();
            self.playervideo.reconcreatedev(obj, "", "", "", dzwl, paramdata);
        }
    }
}

/**
 * 预览窗口隐藏显示
 * 1：显示通道
 2：隐藏通道
 3：显示所有
 4：隐藏所有
 5：显示配置窗
 口并隐藏实时流
 6：隐藏配置窗
 口并显示实时流
 */

function preHiddenDisplaywindow(showMode, ch) {
    var obj = {};
    obj.Fountion = "live";
    obj.LiveCtrl = {};
    obj.LiveCtrl.ShowDock = {};
    obj.LiveCtrl.type = 9;
    obj.LiveCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (config.isSupportMultiChannel) {
        obj.LiveCtrl.channel = ch;
    } else {
        obj.LiveCtrl.channel = 0;
    }
    obj.LiveCtrl.settings = false;
    obj.LiveCtrl.ShowDock.showMode = showMode;
    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        if (config.deviceInfo.DeviceName == "IPC") {
            self.playervideo.live(obj);
        } else {
            self.playervideo.reconcreatedev(obj, "", "", "", "", "");
        }
    }
}

// 看之前同事的写法这里是控制所有通道关闭或者打开
function preHiddenDisplaywindowNVR(closeAll, streamType) {
    var pt = GetAbsoluteLocationEx($("#axdiv")[0]);
    var ua = navigator.userAgent.toLocaleLowerCase();
    var adjustPos = true;
    if (ua.match(/firefox/) != null || URL_Request("isp2p") == "p6s" || URL_Request("isp2p") == "p2p") { //火狐特殊处理
        adjustPos = false
    } else {
        adjustPos = true
    }
    var obj = {};
    obj.Fountion = "live";
    obj.LiveCtrl = {};
    obj.LiveCtrl.Preview = {};
    obj.LiveCtrl.type = 1;
    obj.LiveCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    obj.LiveCtrl.Preview.browser = getBrowsername();
    obj.LiveCtrl.Preview.title = document.getElementsByTagName("title")[0].text;
    obj.LiveCtrl.Preview.x = parseInt(pt.Left, 10);
    obj.LiveCtrl.Preview.y = parseInt(pt.Top, 10);
    var ARR = [];
    for (var o = 1; o <= config.deviceInfo.VideoInputChannels; o++) {
        ARR.push('CAM' + o);
    }
    obj.LiveCtrl.Preview.channelName = ARR;
    if (closeAll) {
        obj.LiveCtrl.Preview.closeAll = closeAll;
    } else {
        obj.LiveCtrl.Preview.openAll = true;
    }
    // if (dzwl == 1 || dzwl == 6 || dzwl == 7 || dzwl == 8) {
    //     obj.LiveCtrl.Preview.w = parseInt(558, 10);
    //     obj.LiveCtrl.Preview.h = parseInt(418, 10);
    // } else {
    obj.LiveCtrl.Preview.w = parseInt(pt.Width, 10);
    obj.LiveCtrl.Preview.h = parseInt(pt.Height, 10);
    //}
    obj.LiveCtrl.Preview.adjustPos = adjustPos;
    obj.LiveCtrl.Preview.streamType = streamType;
    obj.LiveCtrl.Preview.open = true;
    // if (param == "cerate" || config.devicelose) { //走这一步的时候必须是easyvideo模式，devicelose这个状态也是针对它的，不判断刷新之后找不到资源会无法创建
    //     self.playervideo.reconcreatedev(obj, "", "", "", dzwl, paramdata);
    // } else {
    // if (self.playervideo) {
    self.playervideo.live(obj, "", "");
    // } else {
    //     self.playervideo = new Playervideo();
    //     self.playervideo.reconcreatedev(obj, "", "", "", dzwl, paramdata);
    // }
    // }
}

/**
 * 回放窗口显示隐藏
 * 3：显示所有
 4：隐藏所有
 */
function remoteHiddenDisplaywindow(showMode) {
    var obj = {};
    obj.Fountion = "playback";
    obj.PlaybackCtrl = {};
    obj.PlaybackCtrl.ShowDock = {};
    obj.PlaybackCtrl.type = 8;
    obj.PlaybackCtrl.uniqueId = parseInt(sessionStorage.getItem("uniqueId"), 10);
    obj.PlaybackCtrl.channel = 0;
    obj.PlaybackCtrl.ShowDock.showMode = showMode;
    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}

/**
 * 停止音频
 * @constructor
 * isNvrNums:表示此次的通道号，nvr时使用此参数
 */
function stopPreaudio(isNvrNums) {
    var obj = {};
    obj.Fountion = "live";
    obj.LiveCtrl = {};
    obj.LiveCtrl.Audio = {};
    obj.LiveCtrl.type = 2;
    obj.LiveCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (isNvrNums) {
        obj.LiveCtrl.channel = isNvrNums;
    } else {
        obj.LiveCtrl.channel = 0;
    }
    obj.LiveCtrl.Audio.mute = true;
    obj.LiveCtrl.Audio.sampleRate = 8000;

    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}

/**
 * 打开音频
 * @constructor
 * isNvrNums：表示此次的通道号，nvr时使用此参数
 */
function openaudio(isNvrNums) {
    var obj = {};
    obj.Fountion = "live";
    obj.LiveCtrl = {};
    obj.LiveCtrl.Audio = {};
    obj.LiveCtrl.type = 2;
    obj.LiveCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (isNvrNums) {
        obj.LiveCtrl.channel = isNvrNums;
    } else {
        obj.LiveCtrl.channel = 0;
    }
    obj.LiveCtrl.Audio.mute = false;
    obj.LiveCtrl.Audio.sampleRate = 8000;

    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}


/**
 * 关闭语音对讲
 * @constructor
 * isNvrNums：表示此次的通道号，nvr时使用此参数
 */
function Closeintercom(isNvrNums) {
    var obj = {};
    obj.Fountion = "live";
    obj.LiveCtrl = {};
    obj.LiveCtrl.Talk = {};
    obj.LiveCtrl.type = 3;
    obj.LiveCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (isNvrNums) {
        obj.LiveCtrl.channel = isNvrNums;
    } else {
        obj.LiveCtrl.channel = 0;
    }
    obj.LiveCtrl.Talk.open = false;
    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}

/**
 * 打开语音对讲
 * @constructor
 *  isNvrNums：表示此次的通道号，nvr时使用此参数
 * /传通道号时表示ipc对讲/不传时表示设备直接对讲
 */
function OpenIntercom(isNvrNums) {
    var obj = {};
    obj.Fountion = "live";
    obj.LiveCtrl = {};
    obj.LiveCtrl.Talk = {};
    obj.LiveCtrl.type = 3;
    obj.LiveCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (isNvrNums) {
        obj.LiveCtrl.channel = isNvrNums;
    } else {
        obj.LiveCtrl.channel = 0;
    }
    obj.LiveCtrl.Talk.open = true;
    if (config.deviceInfo.DeviceName == "IPC") {
        obj.LiveCtrl.Talk.toDevice = false;
    } else {
        if (isNvrNums) {
            obj.LiveCtrl.Talk.toDevice = false; //和ipc对讲
        } else {
            obj.LiveCtrl.Talk.toDevice = true; //和nvr本地对讲
        }
    }
    obj.LiveCtrl.Talk.sampleRate = 8000;
    obj.LiveCtrl.Talk.bitPerSample = 16;
    obj.LiveCtrl.Talk.codec = 1; //G711U
    obj.LiveCtrl.Talk.soundChannel = 0;
    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}

/**
 * 3D定位
 * @param open
 * @param isNvrNums
 */
function pos3d(open,isNvrNums){
    var obj = {};
    obj.Fountion = "live";
    obj.LiveCtrl = {};
    obj.LiveCtrl._3dPos = {};
    obj.LiveCtrl.type = 12;
    obj.LiveCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (isNvrNums) {
        obj.LiveCtrl.channel = isNvrNums;
    } else {
        obj.LiveCtrl.channel = 0;
    }
    obj.LiveCtrl._3dPos.open=open;
    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}

/**
 * 截图
 * isNvrNums:表示此次抓图的通道号，及nvr抓图时使用此参数
 */
function easyCaptureImage(islive, isNvrNums) {
    var obj = {};
    obj.Fountion = "snapshot";
    obj.Capture = {};
    obj.Capture.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (isNvrNums) {
        obj.Capture.channel = isNvrNums;
        obj.Capture.format = 2;
    } else {
        obj.Capture.channel = 0;
    }
    obj.Capture.live = islive;
    obj.Capture.newMethod = true;
    if (self.playervideo) {
        self.playervideo.snapshot(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.snapshot(obj);
    }
}

/**
 * 停止录像
 * isNvrNums:表示当前的通道号
 */
function easyStopRecord(isNvrNums) {
    var obj = {};
    obj.Fountion = "record";
    obj.VideoRecord = {};
    obj.VideoRecord.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (isNvrNums) {
        obj.VideoRecord.channel = isNvrNums;
    } else {
        obj.VideoRecord.channel = 0;
    }
    obj.VideoRecord.live = true;
    obj.VideoRecord.start = false;
    obj.VideoRecord.newMethod = true;

    if (self.playervideo) {
        self.playervideo.record(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.record(obj);
    }
}

/**
 * 开始录像
 * isNvrNums:表示当前的通道号
 */
function easyStartRecord(isNvrNums) {
    var obj = {};
    obj.Fountion = "record";
    obj.VideoRecord = {};
    obj.VideoRecord.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (isNvrNums) {
        obj.VideoRecord.channel = isNvrNums;
    } else {
        obj.VideoRecord.channel = 0;
    }
    obj.VideoRecord.live = true;
    obj.VideoRecord.start = true;
    obj.VideoRecord.newMethod = true;

    if (self.playervideo) {
        self.playervideo.record(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.record(obj);
    }
}

/**
 * 全屏
 */
function easyFullScreen() {
    var obj = {};
    obj.Fountion = "live";
    obj.LiveCtrl = {};
    obj.LiveCtrl.Fullscreen = {};
    obj.LiveCtrl.type = 5;
    obj.LiveCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    obj.LiveCtrl.channel = 0;
    obj.LiveCtrl.Fullscreen.enter = true;
    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}

/**
 * 关闭所有预览视频
 *
 */
function easyldspecialvideos(settings) {
    var obj = {};
    obj.Fountion = "live";
    obj.LiveCtrl = {};
    obj.LiveCtrl.Preview = {};
    obj.LiveCtrl.type = 1;
    obj.LiveCtrl.settings = settings;
    obj.LiveCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    obj.LiveCtrl.channel = 0;
    obj.LiveCtrl.Preview.open = false;
    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}
/**
 * 关闭所有预览视频NVR
 *
 * nrm代表关闭哪一个通道
 */
function NVReasyldspecialvideos(settings, nrm) {
    var obj = {};
    obj.Fountion = "live";
    obj.LiveCtrl = {};
    obj.LiveCtrl.Preview = {};
    obj.LiveCtrl.type = 1;
    obj.LiveCtrl.settings = settings;
    obj.LiveCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (nrm != "") {
        obj.LiveCtrl.channel = nrm;
    }
    obj.LiveCtrl.Preview.open = false;
    if (nrm == "") { //表示关闭所有预览
        obj.LiveCtrl.Preview.closeAll = true;
    }
    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}
/**
 * 切换到其他码流
 * newStream 1，从其他码流切换到主码流，newStream，2从其他码流切换到辅码流1，3从其他码流切换到辅码流2
 */
function othertomain(newStream, isNvrNums) {
    var obj = {};
    obj.Fountion = "live";
    obj.LiveCtrl = {};
    obj.LiveCtrl.SwitchStream = {};
    obj.LiveCtrl.type = 7;
    obj.LiveCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (isNvrNums) {
        obj.LiveCtrl.channel = isNvrNums;
    } else {
        obj.LiveCtrl.channel = 0;
    }
    obj.LiveCtrl.SwitchStream.channelName = ['CAM' + (isNvrNums - 0 + 1)]
    obj.LiveCtrl.SwitchStream.newStream = newStream;
    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}

/**
 * 关闭easyvido
 */
function closeeasyvideo() {
    if (self.playervideo) {
        self.playervideo.close(true);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.close(true);
    }
}

/**
 * 关闭
 */
function closeWebPlayer() {
    if (self.player) {
        if (sessionStorage.getItem("stream") == "miancodestream") {
            self.player.stop("main");
        } else if (sessionStorage.getItem("stream") == "codestream1") {
            self.player.stop("sub1");
        } else {
            self.player.stop("sub2");
        }
    }
}

/**
 * 回放页面的窗口跟随
 */
function remoteWindowfollowing() {
    var pt = GetAbsoluteLocationEx($("#axdiv")[0]);
    var ua = navigator.userAgent.toLocaleLowerCase();
    var adjustPos = true;
    if (ua.match(/firefox/) != null || URL_Request("isp2p") == "p6s" || URL_Request("isp2p") == "p2p") { //火狐特殊处理
        adjustPos = false
    } else {
        adjustPos = true
    }
    var obj = {};
    obj.Fountion = "playback";
    obj.PlaybackCtrl = {};
    obj.PlaybackCtrl.MoveDock = {};
    obj.PlaybackCtrl.channel = 0;
    obj.PlaybackCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    obj.PlaybackCtrl.type = 9;
    obj.PlaybackCtrl.MoveDock.x = pt.Left;
    if (pt.Top < 160 && navigator.userAgent.indexOf("Firefox") !== -1) {
        obj.PlaybackCtrl.MoveDock.y = pt.Top * 2 + 43;
    } else {
        obj.PlaybackCtrl.MoveDock.y = pt.Top;
    }
    obj.PlaybackCtrl.MoveDock.w = pt.Width;
    obj.PlaybackCtrl.MoveDock.h = pt.Height;
    obj.PlaybackCtrl.MoveDock.adjustPos = adjustPos;
    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}

/**
 * 回放开始播放
 * isNvrNums:此参数只有nvr使用，表示当前通道号
 */
function remoteplay(m_szStartTimeSet, param, isNvrNums) {
    var pt = GetAbsoluteLocationEx($("#axdiv")[0]);
    var ua = navigator.userAgent.toLocaleLowerCase();
    var adjustPos = true;
    if (ua.match(/firefox/) != null || URL_Request("isp2p") == "p6s" || URL_Request("isp2p") == "p2p") { //火狐特殊处理
        adjustPos = false
    } else {
        adjustPos = true
    }
    var obj = {};
    obj.Fountion = "playback";
    obj.PlaybackCtrl = {};
    obj.PlaybackCtrl.Preview = {};
    obj.PlaybackCtrl.type = 1;
    obj.PlaybackCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (isNvrNums) {
        obj.PlaybackCtrl.channel = isNvrNums - 1;
    } else {
        obj.PlaybackCtrl.channel = 0;
    }
    obj.PlaybackCtrl.Preview.browser = getBrowsername();
    obj.PlaybackCtrl.Preview.title = document.getElementsByTagName("title")[0].text;
    obj.PlaybackCtrl.Preview.remote = true;
    obj.PlaybackCtrl.Preview.x = pt.Left;
    if (pt.Top < 160 && navigator.userAgent.indexOf("Firefox") !== -1) {
        obj.PlaybackCtrl.Preview.y = pt.Top * 2 + 43;
    } else {
        obj.PlaybackCtrl.Preview.y = pt.Top;
    }
    obj.PlaybackCtrl.Preview.w = pt.Width;
    obj.PlaybackCtrl.Preview.h = pt.Height;
    obj.PlaybackCtrl.Preview.adjustPos = adjustPos;
    obj.PlaybackCtrl.Preview.streamType = 1;
    obj.PlaybackCtrl.Preview.play = 1;
    obj.PlaybackCtrl.Preview.hideLive = true;
    obj.PlaybackCtrl.Preview.recordType = -1;
    obj.PlaybackCtrl.Preview.playPos = m_szStartTimeSet;
    if (config.devicelose) {
        self.playervideo.reconcreatedev(obj, param);
    } else {
        if (self.playervideo) {
            self.playervideo.live(obj);
        } else {
            self.playervideo = new Playervideo();
            if (config.deviceInfo.DeviceName == "IPC") {
                self.playervideo.live(obj);
            } else {
                self.playervideo.reconcreatedev(obj, param);
            }
        }
    }
}

/**
 * 暂停播放
 * isNvrNums:此参数只有nvr使用，表示当前通道号
 */
function remotepause(isNvrNums) {
    var obj = {};
    obj.Fountion = "playback";
    obj.PlaybackCtrl = {};
    obj.PlaybackCtrl.Preview = {};
    obj.PlaybackCtrl.type = 1;
    obj.PlaybackCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (isNvrNums) {
        obj.PlaybackCtrl.channel = isNvrNums - 1;
    } else {
        obj.PlaybackCtrl.channel = 0;
    }
    obj.PlaybackCtrl.Preview.play = 2;
    obj.PlaybackCtrl.Preview.remote = true;

    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}

/**
 * 快进
 * isNvrNums：此参数表示当前通道号，仅nvr使用
 */
function fastForward(isNvrNums) {
    var obj = {};
    obj.Fountion = "playback";
    obj.PlaybackCtrl = {};
    obj.PlaybackCtrl.Speed = {};
    obj.PlaybackCtrl.Preview = {};
    obj.PlaybackCtrl.type = 2;
    obj.PlaybackCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (isNvrNums) {
        obj.PlaybackCtrl.channel = isNvrNums - 1;
    } else {
        obj.PlaybackCtrl.channel = 0;
    }
    obj.PlaybackCtrl.Speed.fast = true;
    obj.PlaybackCtrl.Preview.remote = true;

    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}

/**
 * 慢进
 * isNvrNums：此参数表示当前通道号，仅nvr使用
 */
function remoteslowadvance(isNvrNums) {
    var obj = {};
    obj.Fountion = "playback";
    obj.PlaybackCtrl = {};
    obj.PlaybackCtrl.Speed = {};
    obj.PlaybackCtrl.Preview = {};
    obj.PlaybackCtrl.type = 2;
    obj.PlaybackCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (isNvrNums) {
        obj.PlaybackCtrl.channel = isNvrNums - 1;
    } else {
        obj.PlaybackCtrl.channel = 0;
    }
    obj.PlaybackCtrl.Speed.fast = false;
    obj.PlaybackCtrl.Preview.remote = true;

    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}
/**
 * 查询当前回放播放进度
 * isNvrNums：此参数表示当前通道号，仅nvr使用
 */
function serchVideoCounts(isNvrNums) {
    var obj = {};
    obj.Fountion = "playback";
    obj.PlaybackCtrl = {};
    obj.PlaybackCtrl.Preview = {};
    obj.PlaybackCtrl.type = 5;
    obj.PlaybackCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    obj.PlaybackCtrl.channel = isNvrNums - 1;
    obj.PlaybackCtrl.Preview.remote = true;
    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}
/**
 * 单帧
 * isNvrNums：此参数表示当前通道号，仅nvr使用
 */
function remotesingleframe(isNvrNums) {
    var obj = {};
    obj.Fountion = "playback";
    obj.PlaybackCtrl = {};
    obj.PlaybackCtrl.Preview = {};
    obj.PlaybackCtrl.type = 1;
    obj.PlaybackCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (isNvrNums) {
        obj.PlaybackCtrl.channel = isNvrNums - 1;
    } else {
        obj.PlaybackCtrl.channel = 0;
    }
    obj.PlaybackCtrl.Preview.play = 4;
    obj.PlaybackCtrl.Preview.remote = true;

    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}

/**
 * 回放关闭声音
 * isNvrNums：此参数表示当前通道号，仅nvr使用
 */
function remotecloseround(isNvrNums) {
    var obj = {};
    obj.Fountion = "playback";
    obj.PlaybackCtrl = {};
    obj.PlaybackCtrl.Audio = {};
    if (isNvrNums) {
        obj.PlaybackCtrl.channel = isNvrNums - 1;
    } else {
        obj.PlaybackCtrl.channel = 0;
    }
    obj.PlaybackCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    obj.PlaybackCtrl.type = 3;
    obj.PlaybackCtrl.Audio.mute = true;

    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}

/**
 * 回放打开声音
 * isNvrNums：此参数表示当前通道号，仅nvr使用
 */
function remoteopenround(isNvrNums) {
    var obj = {};
    obj.Fountion = "playback";
    obj.PlaybackCtrl = {};
    obj.PlaybackCtrl.Audio = {};
    if (isNvrNums) {
        obj.PlaybackCtrl.channel = isNvrNums - 1;
    } else {
        obj.PlaybackCtrl.channel = 0;
    }
    obj.PlaybackCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    obj.PlaybackCtrl.type = 3;
    obj.PlaybackCtrl.Audio.mute = false;

    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}

/**
 * 回放下载录像
 * isNvrNums：此参数表示当前通道号，仅nvr使用
 */
function rmotedownloadvideo(operate, isNvrNums) {
    var obj = {};
    obj.Fountion = "download";
    obj.DownloadParam = {};
    obj.DownloadParam.operate = operate;
    obj.DownloadParam.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (operate == 3) {
        obj.DownloadParam.Interrupt = {};
        obj.DownloadParam.Interrupt.taskId = parseInt(sessionStorage.getItem('taskId'), 10);
    } else {
        obj.DownloadParam.Playback = {};
        if (isNvrNums || isNvrNums == 0) {
            obj.DownloadParam.Playback.channel = isNvrNums;
            obj.DownloadParam.Playback.mainStream = true;
        } else {
            obj.DownloadParam.Playback.channel = 0;
        }
        obj.DownloadParam.Playback.startTime = $('#stratTime').val();
        obj.DownloadParam.Playback.endTime = $('#endTime').val();
        obj.DownloadParam.Playback.recordType = -1;
        obj.DownloadParam.Playback.streamType = 1;
    }
    // obj.DownloadParam.Playback.path = "D:/20220729.mp4";
    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}
/**
 * 回放定位跳转
 * isNvrNums：此参数表示当前通道号，仅nvr使用
 */
function gotimepos(newPos, isNvrNums) {
    var obj = {};
    obj.Fountion = "playback";
    obj.PlaybackCtrl = {};
    obj.PlaybackCtrl.Position = {};
    if (isNvrNums) {
        obj.PlaybackCtrl.channel = isNvrNums - 1;
    } else {
        obj.PlaybackCtrl.channel = 0;
    }
    obj.PlaybackCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    obj.PlaybackCtrl.type = 4;
    obj.PlaybackCtrl.Position.newPos = newPos;

    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}

/**
 * 回放停止播放
 * isNvrNums：此参数表示当前通道号，仅nvr使用
 */
function remotestopplay(isNvrNums) {
    var obj = {};
    obj.Fountion = "playback";
    obj.PlaybackCtrl = {};
    obj.PlaybackCtrl.Preview = {};
    obj.PlaybackCtrl.type = 1;
    obj.PlaybackCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (isNvrNums) {
        obj.PlaybackCtrl.channel = isNvrNums - 1;
    } else {
        obj.PlaybackCtrl.channel = 0;
    }
    obj.PlaybackCtrl.Preview.play = 3;
    obj.PlaybackCtrl.Preview.remote = true;

    if (self.playervideo) {
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(obj);
    }
}
// 解决刷新后无流问题
function refershPlayer(d, k, p, q) {
    var ua = navigator.userAgent.toLocaleLowerCase();
    if (ua.match(/firefox/) != null) { //火狐特殊处理
        InitBrowseFrameInfo(JSON.parse(localStorage.getItem('mousePos')));
    }
    var pt = GetAbsoluteLocationEx($("#axdiv")[0]);
    var ua = navigator.userAgent.toLocaleLowerCase();
    var adjustPos = true;
    if (ua.match(/firefox/) != null || URL_Request("isp2p") == "p6s" || URL_Request("isp2p") == "p2p") { //火狐特殊处理
        adjustPos = false
    } else {
        adjustPos = true
    }
    var obj = {};
    obj.Fountion = "live";
    obj.LiveCtrl = {};
    obj.LiveCtrl.Preview = {};
    obj.LiveCtrl.type = 1;
    obj.LiveCtrl.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    obj.LiveCtrl.channel = 0;
    obj.LiveCtrl.settings = true;
    obj.LiveCtrl.Preview.browser = getBrowsername();
    obj.LiveCtrl.Preview.title = document.getElementsByTagName("title")[0].text;
    obj.LiveCtrl.Preview.x = parseInt(pt.Left, 10);
    if (navigator.userAgent.indexOf("Firefox") !== -1 && window.location.hash == "#nvr/pages/image/osd.html" && pt.Top < 250) {
        obj.LiveCtrl.Preview.y = parseInt(pt.Top * 2 - 30, 10);
    } else {
        obj.LiveCtrl.Preview.y = parseInt(pt.Top, 10);
    }
    obj.LiveCtrl.Preview.w = parseInt(pt.Width, 10);
    obj.LiveCtrl.Preview.h = parseInt(pt.Height, 10);
    obj.LiveCtrl.Preview.adjustPos = adjustPos;
    obj.LiveCtrl.Preview.streamType = 2;
    if (config.deviceInfo.DeviceName != "IPC") {
        if (config.deviceInfo.VideoInputChannels == 1) {
            obj.LiveCtrl.Preview.layout = 1;
        } else if (config.deviceInfo.VideoInputChannels == 4) {
            obj.LiveCtrl.Preview.layout = 2;
        } else if (config.deviceInfo.VideoInputChannels == 8 || config.deviceInfo.VideoInputChannels == 9) {
            obj.LiveCtrl.Preview.layout = 3;
        } else if (config.deviceInfo.VideoInputChannels >= 10) {
            obj.LiveCtrl.Preview.layout = 4;
        }
    }
    obj.LiveCtrl.Preview.open = true;
    if (self.playervideo && config.refreshplayvideo === true) { //这里加这个条件的原因是调试发现有可能，刷新之后playervideo还存在所以加了这个条件判断
        self.playervideo.live(obj);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.reconcreatedev(obj, d, k, p, q);
    }


}
// osd配置到插件mode: 1.初始化 8.隐藏日期 7.显示日期 6.隐藏文本 5.显示文本
function osdinit(t, wl, wt, we, wo, mode, osdCount, isShowOsd) {
    var objs = {}
    objs.Fountion = "settings";
    objs.settings = {}
    objs.settings.type = 1;
    objs.settings.operate = 1;
    objs.settings.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    objs.settings.OSD = {};
    objs.settings.OSD.type = mode;
    objs.settings.OSD.count = osdCount;
    objs.settings.OSD.text = t;
    if (isShowOsd != undefined) {
        objs.settings.OSD.index = isShowOsd; //0隐藏osd1 隐藏osd2;
    }
    objs.settings.OSD.text_x = wl;
    objs.settings.OSD.text_y = wt;
    objs.settings.OSD.datetime_x = parseInt(we); // 704 * 560
    objs.settings.OSD.datetime_y = parseInt(wo); // 575 * 420
    objs.settings.OSD.datetime_format = 1;
    if (self.playervideo) {
        self.playervideo.live(objs);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(objs);
    }

}
// osd插件到配置
function osdputV() {
    var objs = {}
    objs.Fountion = "settings";
    objs.settings = {};
    objs.settings.type = 1;
    objs.settings.operate = 2;
    objs.settings.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    objs.settings.OSD = {};
    objs.settings.OSD.type = 1;
    objs.settings.OSD.count = 1;
    objs.settings.OSD.text = [];
    objs.settings.OSD.index = 0;
    objs.settings.OSD.text_x = [];
    objs.settings.OSD.text_y = [];
    objs.settings.OSD.datetime_x = 0;
    objs.settings.OSD.datetime_y = 0;
    objs.settings.OSD.datetime_format = 1;
    if (self.playervideo) {
        self.playervideo.live(objs);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(objs);
    }
}
// 获取osd点阵信息
function osdgetDianzline(t, k, boll) {
    if (k == '6') {
        var ke = 6
        var ge = 12
    } else if (k == '7') {
        var ke = 7
        var ge = 14
    } else if (k == '8') {
        var ke = 8
        var ge = 16
    } else if (k == '10') {
        var ke = 10
        var ge = 20
    } else {
        var ke = 12
        var ge = 24
    }
    var objs = {}
    objs.Fountion = "settings";
    objs.settings = {}
    objs.settings.type = 1;
    objs.settings.operate = 1;
    objs.settings.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    objs.settings.OSD = {};
    objs.settings.OSD.type = 11;
    objs.settings.OSD.count = 1;
    objs.settings.OSD.text = [t];
    objs.settings.OSD.index = 0;
    objs.settings.OSD.text_x = [];
    objs.settings.OSD.text_y = [];
    objs.settings.OSD.datetime_x = 0;
    objs.settings.OSD.datetime_y = 0;
    objs.settings.OSD.datetime_format = 1;
    objs.settings.OSD.fontName = 'SimSun-ExtB';
    objs.settings.OSD.bold = false;
    objs.settings.OSD.italic = false;
    objs.settings.OSD.strikeOut = false;
    objs.settings.OSD.underline = false;
    objs.settings.OSD.fontWidth = ke
    objs.settings.OSD.fontHeight = ge
    if (self.playervideo) {
        self.playervideo.live(objs, '', '', '', boll);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(objs, '', '', '', boll);
    }
}
// 多边形布防配置下发
function PolygonConfig(t, p, xA, yA, ptype, lokid) {
    var objs = {}
    objs.Fountion = "settings";
    objs.settings = {}
    objs.settings.type = t;
    objs.settings.operate = 1;
    if (lokid) {
        objs.settings.blockId = lokid;
    }
    objs.settings.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    objs.settings.polygon = {};
    if (ptype) {
        objs.settings.polygon.type = ptype;
    } else {
        objs.settings.polygon.type = 1;
    }
    objs.settings.polygon.edge = p - 0;
    objs.settings.polygon.x = JSON.parse(JSON.stringify(xA));
    objs.settings.polygon.y = JSON.parse(JSON.stringify(yA));
    if (self.playervideo) {
        self.playervideo.live(objs);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(objs);
    }
}
// 多边形布防配置获取
function PolygonConfigBlack(t, p, lokid, typeNum) {
    console.log(p, '个数');
    var objs = {}
    objs.Fountion = "settings";
    objs.settings = {}
    objs.settings.type = t;
    objs.settings.operate = 2;
    if (lokid) {
        objs.settings.blockId = lokid;
    }
    objs.settings.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    objs.settings.polygon = {};
    console.log(typeNum, 'typeNum');
    if (typeNum) {
        console.log(typeNum, 'typeNum');
        objs.settings.polygon.type = typeNum;
    } else {
        objs.settings.polygon.type = 1;
    }
    objs.settings.polygon.edge = p - 0;
    objs.settings.polygon.x = [];
    objs.settings.polygon.y = [];
    if (self.playervideo) {
        self.playervideo.live(objs);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(objs);
    }
}
// 多边形布防预定义配置
function PolygonConfigFautil(y, t, p, lokid, q) {
    var objs = {}
    objs.Fountion = "settings";
    objs.settings = {}
    objs.settings.type = y;
    objs.settings.operate = 1;
    if (lokid) {
        objs.settings.blockId = 1;
    }
    objs.settings.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    objs.settings.polygon = {};
    if (lokid && q == true) {
        objs.settings.polygon.type = 5;
    } else {
        objs.settings.polygon.type = t;
    }
    objs.settings.polygon.edge = p - 0;
    objs.settings.polygon.x = [];
    objs.settings.polygon.y = [];
    if (self.playervideo) {
        self.playervideo.live(objs);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(objs);
    }
}
// 越界侦测设置配置到插件t(清除4 绘制2 切换方向3 初始化1)
function intrusionFoundationConfig(t, f, a, b) {
    var objs = {};
    objs.Fountion = "settings";
    objs.settings = {};
    objs.settings.type = 5;
    objs.settings.operate = 1;
    objs.settings.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    objs.settings.intrusion = {};
    objs.settings.intrusion.type = t;
    objs.settings.intrusion.orientation = f;
    if (a) {
        objs.settings.intrusion.x = JSON.parse(JSON.stringify(a));
        objs.settings.intrusion.y = JSON.parse(JSON.stringify(b));
    } else {
        objs.settings.intrusion.x = [];
        objs.settings.intrusion.y = [];

    }
    if (self.playervideo) {
        self.playervideo.live(objs);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(objs);
    }
}
// 越界侦测设置坐标配置到插件
function intrusionPlonyConfig(f, AX, AY) {
    var objs = {};
    objs.Fountion = "settings";
    objs.settings = {};
    objs.settings.type = 5;
    objs.settings.operate = 1;
    objs.settings.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    objs.settings.intrusion = {};
    objs.settings.intrusion.type = 2;
    objs.settings.intrusion.orientation = f;
    objs.settings.intrusion.x = JSON.parse(JSON.stringify(AX));
    objs.settings.intrusion.y = JSON.parse(JSON.stringify(AY));
    if (self.playervideo) {
        self.playervideo.live(objs);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(objs);
    }
}
// 越界侦测从插件获取坐标
function intrusiongetPlonyConfig(f) {
    var objs = {};
    objs.Fountion = "settings";
    objs.settings = {};
    objs.settings.type = 5;
    objs.settings.operate = 2;
    objs.settings.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    objs.settings.intrusion = {};
    objs.settings.intrusion.type = 1;
    objs.settings.intrusion.orientation = f - 0;
    objs.settings.intrusion.x = [];
    objs.settings.intrusion.y = [];
    if (self.playervideo) {
        self.playervideo.live(objs);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(objs);
    }
}

// 客流统计配置到插件t(2清除 3绘制)
function pensongerFlow(t, LY, LX, RX, RY) {
    var objs = {}
    objs.Fountion = "settings";
    objs.settings = {}
    objs.settings.type = 7;
    objs.settings.operate = 1;
    objs.settings.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    objs.settings.passenger = {};
    objs.settings.passenger.type = t;
    objs.settings.passenger.orientation = 2;
    objs.settings.passenger.edge = 4;
    objs.settings.passenger.x = [];
    objs.settings.passenger.y = [];
    objs.settings.passenger.boundary = {}
    objs.settings.passenger.boundary.top = LY - 0
    objs.settings.passenger.boundary.left = LX - 0
    objs.settings.passenger.boundary.right = RX - 0
    objs.settings.passenger.boundary.bottom = RY - 0
    if (self.playervideo) {
        self.playervideo.live(objs);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(objs);
    }
}
// 客流统计配置坐标到插件
function pensongerFlowPlony(x, y, LY, LX, RX, RY) {
    var objs = {}
    objs.Fountion = "settings";
    objs.settings = {}
    objs.settings.type = 7;
    objs.settings.operate = 1;
    objs.settings.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    objs.settings.passenger = {};
    objs.settings.passenger.type = 1;
    objs.settings.passenger.orientation = 2;
    objs.settings.passenger.edge = 4;
    objs.settings.passenger.x = JSON.parse(JSON.stringify(x));
    objs.settings.passenger.y = JSON.parse(JSON.stringify(y));
    objs.settings.passenger.boundary = {}
    objs.settings.passenger.boundary.top = LY - 0
    objs.settings.passenger.boundary.left = LX - 0
    objs.settings.passenger.boundary.right = RX - 0
    objs.settings.passenger.boundary.bottom = RY - 0
    if (self.playervideo) {
        self.playervideo.live(objs);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(objs);
    }
}
// 客流统计获取坐标
function pensongergetFlowPlony(LY, LX, RX, RY) {
    var objs = {}
    objs.Fountion = "settings";
    objs.settings = {}
    objs.settings.type = 7;
    objs.settings.operate = 2;
    objs.settings.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    objs.settings.passenger = {};
    objs.settings.passenger.type = 1;
    objs.settings.passenger.orientation = 2;
    objs.settings.passenger.edge = 4;
    objs.settings.passenger.x = [];
    objs.settings.passenger.y = [];
    objs.settings.passenger.boundary = {}
    objs.settings.passenger.boundary.top = LY - 0
    objs.settings.passenger.boundary.left = LX - 0
    objs.settings.passenger.boundary.right = RX - 0
    objs.settings.passenger.boundary.bottom = RY - 0
    if (self.playervideo) {
        self.playervideo.live(objs);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(objs);
    }
}
// 隐私遮盖删除和清空 设置和获取
function pracyFuntins(type, operate, count, left, top, right, bottom) {
    var objs = {}
    objs.Fountion = "settings";
    objs.settings = {}
    objs.settings.type = 3;
    objs.settings.operate = operate;
    objs.settings.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    objs.settings.privacyCover = {};
    objs.settings.privacyCover.type = type;
    objs.settings.privacyCover.fillColor = "ffff00";
    objs.settings.privacyCover.count = count;
    if (left) {
        objs.settings.privacyCover.left = JSON.parse(JSON.stringify(left));
        objs.settings.privacyCover.top = JSON.parse(JSON.stringify(top));
        objs.settings.privacyCover.right = JSON.parse(JSON.stringify(right));
        objs.settings.privacyCover.bottom = JSON.parse(JSON.stringify(bottom));
    } else {
        objs.settings.privacyCover.left = [];
        objs.settings.privacyCover.top = [];
        objs.settings.privacyCover.right = [];
        objs.settings.privacyCover.bottom = [];
    }
    if (self.playervideo) {
        self.playervideo.live(objs);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(objs);
    }

}
// 隐藏所有配置
function clearallP() {
    var objs = {}
    objs.Fountion = "settings";
    objs.settings = {}
    objs.settings.operate = 3;
    objs.settings.uniqueId = parseInt(sessionStorage.getItem('uniqueId'), 10);
    if (self.playervideo) {
        self.playervideo.live(objs);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.live(objs);
    }
}

/**
 * 文字转语音
 * @param text 文本内容
 * @param vioceType 要转换成的语音格式，，试听是MP3，上传是g711u
 * @param property  声音类型，，男声音，女声音
 */
function textToVioce(text,vioceType,property,transcode,uniqueId,assistCommand){
    var objs = {};
    objs.Fountion = "globalCtrl";
    objs.global = {};
    objs.global.type = 1;
    objs.global.tts = {};
    objs.global.tts.transcode=transcode
    objs.global.tts.total=config.maxTotal;
    objs.global.tts.transParam = {};
    objs.global.tts.transParam.text = text;
    objs.global.tts.transParam.config = {};
    objs.global.tts.transParam.config.audio_format = vioceType;
    objs.global.tts.transParam.config.sample_rate=config.Sample;
    objs.global.tts.transParam.config.property = property;
    objs.global.tts.transParam.config.speed=0;
    objs.global.tts.transParam.config.pitch=0;
    objs.global.tts.transParam.config.volume=100;
    objs.global.tts.transParam = JSON.stringify(objs.global.tts.transParam);
    if (self.playervideo) {
        self.playervideo.global(objs,uniqueId,assistCommand);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.global(objs,uniqueId,assistCommand);
    }
}

function wavToG711U(base64Data,uniqueId,assistCommand){
    config.voiceFileResultType=3;
    var objs = {}; //转换为需要的格式
    objs.Fountion = "globalCtrl";
    objs.global = {};
    objs.global.type = 4;
    objs.global.format={};
    objs.global.format.inputBase64=true;
    objs.global.format.base64Data=base64Data;
    objs.global.format.ulaw=true;
    objs.global.format.total=config.maxTotal;
    if (self.playervideo) {
        self.playervideo.global(objs,uniqueId,assistCommand);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.global(objs,uniqueId,assistCommand);
    }
}

/**
 * 获取wave缓存信息
 */
function getwaveInfo(){
    var objs = {};
    objs.Fountion = "globalCtrl";
    objs.global = {};
    objs.global.type = 5;
    if (self.playervideo) {
        self.playervideo.global(objs);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.global(objs);
    }
}
/**
 * 销毁wave文件信息
 */
function destoryWaveInfo(){
    var objs = {};
    objs.Fountion = "globalCtrl";
    objs.global = {};
    objs.global.type = 6;
    if (self.playervideo) {
        self.playervideo.global(objs);
    } else {
        self.playervideo = new Playervideo();
        self.playervideo.global(objs);
    }
}
