czt
2026-01-05 aad1f2dd7b10ec03d78d703bc2c31b9e679a82b6
fzzy-igdss-web/src/main/resources/static/security/video-list-dept.js
@@ -7,7 +7,7 @@
var playCamera = null;
var playList = {};
var playTag = 1;  //默认内网播放
var playTag = "1";  //默认内网播放
var playUrl1 = null;
var videoId1 = null;
@@ -47,14 +47,32 @@
let mediaStream9;
$(function () {
    layui.use(['layer', 'table'], function () {
    layui.use(['layer', 'form', 'table'], function () {
        layer = layui.layer;
        table = layui.table;
        form = layui.form;
        // 监听播放方式
        form.on('select(select_play)', function (obj) {
            return renderPlayType();
        });
    });
    //初始化渲染播放列表
    renderList();
});
/**
 * 切换播放方式
 */
function renderPlayType() {
    playTag = $("#playLan").val();
    //内网播放,重置各个播放窗口
    reloadView(1);
    reloadView(4);
    reloadView(9);
}
/**
 * 渲染监控列表
@@ -95,16 +113,21 @@
 * @param index
 */
function getMedia(index) {
    if(windowsNum == null){
    if (windowsNum == null) {
        windowsNum = 1;
    }
    playCamera = null;
    var camera = listCamera[index];
    playList[windowsNum] = camera;
    var playType = camera.playType;
    if (playTag === "1") {
        //内网播放,赋值WebRtc播放方式
        playType = "WEB_RTC";
    }
    var data = {
        id: camera.id,
        playType: camera.playType
        playType: playType
    };
    $.ajax({
        type: 'POST',
@@ -223,16 +246,22 @@
 * 判断内网播放还是外网播放
 */
function startPlay() {
    startPlay1();
    if (playTag === "1") {
        //内网播放
        startPlay1();
    }
    if (playTag === "2") {
        //外网播放
        startPlay2();
    }
}
/**
 * 外网播放
 */
function startPlay1() {
function startPlay2() {
    if(windowsNum > splitWin){
    if (windowsNum > splitWin) {
        windowsNum = 1;
    }
    if (!playCamera) {
@@ -240,28 +269,10 @@
    }
    if (playCamera.playUrl) {
        var html = '<div class="mask" onclick="selectWin(' + splitWin + ',' + windowsNum + ')"></div>';
        html += '<iframe src="' + playCamera.playUrl + '" width="99%" height="99%" frameborder="0" allowfullscreen></iframe>';
        $("#f" + splitWin + "_d" + windowsNum).html(html);
        var divId = "#f" + splitWin + "_d" + windowsNum;
        var html = '<video class="video" id="video' + splitWin + '_' + windowsNum+'" style="width:100%;height: 100%"  controls>';
        $(divId).html(html);
        if (flvjs.isSupported()) {
            var videoElement = document.getElementById("video" + splitWin + '_' + windowsNum);
            var flvPlayer = flvjs.createPlayer({
                type: 'flv',
                isLive: true,
                cors: true,
                url: playCamera.playUrl
            });
            flvPlayer.attachMediaElement(videoElement);
            flvPlayer.load();
            flvPlayer.play();
        }
        // var html = '<video class="video" id="video'+splitWin + "_" + windowsNum+'" autoplay playsinline="true" webkit-playsinline="true" crossorigin="anonymous"';
        // html += 'crossorigin="anonymous" src="blob:'+playCamera.playUrl+'" style="display: none;"></video>';
        // html += '<canvas width="100%" height="100%" style="height: 100%">';
        // $("#f" + splitWin + "_d" + windowsNum).html(html);
        curCamera = playList[windowsNum];
    } else {
        $("#f" + splitWin + "_d" + windowsNum).html("未获取到摄像头(" + playCamera.cameraName + ")播放信息!!");
@@ -271,9 +282,9 @@
/**
 * 内网播放
 */
function startPlay2() {
function startPlay1() {
    if(windowsNum > splitWin){
    if (windowsNum > splitWin) {
        windowsNum = 1;
    }
    if (!playCamera) {
@@ -287,49 +298,49 @@
            playUrl1 = playCamera.playUrl;
            videoId1 = playCamera.cameraId;
            webRtcToPlay1();
        }else if (windowsNum === 2) {
        } else if (windowsNum === 2) {
            playUrl2 = null;
            mediaStream2 = null;
            playUrl2 = playCamera.playUrl;
            videoId2 = playCamera.cameraId;
            webRtcToPlay2();
        }else if (windowsNum === 3) {
        } else if (windowsNum === 3) {
            playUrl3 = null;
            mediaStream3 = null;
            playUrl3 = playCamera.playUrl;
            videoId3 = playCamera.cameraId;
            webRtcToPlay3();
        }else if (windowsNum === 4) {
        } else if (windowsNum === 4) {
            playUrl4 = null;
            mediaStream4 = null;
            playUrl4 = playCamera.playUrl;
            videoId4 = playCamera.cameraId;
            webRtcToPlay4();
        }else if (windowsNum === 5) {
        } else if (windowsNum === 5) {
            playUrl5 = null;
            mediaStream5 = null;
            playUrl5 = playCamera.playUrl;
            videoId5 = playCamera.cameraId;
            webRtcToPlay5();
        }else if (windowsNum === 6) {
        } else if (windowsNum === 6) {
            playUrl6 = null;
            mediaStream6 = null;
            playUrl6 = playCamera.playUrl;
            videoId6 = playCamera.cameraId;
            webRtcToPlay6();
        }else if (windowsNum === 7) {
        } else if (windowsNum === 7) {
            playUrl7 = null;
            mediaStream7 = null;
            playUrl7 = playCamera.playUrl;
            videoId7 = playCamera.cameraId;
            webRtcToPlay7();
        }else if (windowsNum === 8) {
        } else if (windowsNum === 8) {
            playUrl8 = null;
            mediaStream8 = null;
            playUrl8 = playCamera.playUrl;
            videoId8 = playCamera.cameraId;
            webRtcToPlay8();
        }else if (windowsNum === 9) {
        } else if (windowsNum === 9) {
            playUr9 = null;
            mediaStream9 = null;
            playUrl9 = playCamera.playUrl;
@@ -598,6 +609,7 @@
}
/*============= 视频播放 ----- 结束 ===============*/
/*============= webRtc视频播放5 ----- 开始 ===============*/
/**
 * 开始播放
@@ -661,6 +673,7 @@
}
/*============= 视频播放 ----- 结束 ===============*/
/*============= webRtc视频播放4 ----- 开始 ===============*/
/**
 * 开始播放