1
lxl
2022-09-16 2d9ddf8269640309f22053d3c92a38fd77e84358
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!doctype html>
<html>
 
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
    <meta http-equiv="Expires" content="0" />
</head>
<style>
    .plugin {
        width: 600px;
        height: 400px;
    }
</style>
 
<body>
    <div>
        <div id="divPlugin" class="plugin"></div>
    </div>
</body>
<script src="../jquery-2.0.3.js"></script>
<script src="../codebase/webVideoCtrl.js"></script>
<script>
 
    $(function () {
        // 检查插件是否已经安装过
        var iRet = WebVideoCtrl.I_CheckPluginInstall();
        if (-1 == iRet) {
            alert("您还未安装过插件,双击开发包目录里的WebComponentsKit.exe安装!");
            return;
        }
 
        var oPlugin = {
            iWidth: 600,             // plugin width
            iHeight: 400             // plugin height
        };
 
        var oLiveView = {
            iProtocol: 1,            // protocol 1:http, 2:https
            szIP: "172.10.18.59",    // protocol ip
            szPort: "80",            // protocol port
            szUsername: "admin",     // device username
            szPassword: "12345678q", // device password
            iStreamType: 1,          // stream 1:main stream  2:sub-stream  3:third stream  4:transcode stream
            iChannelID: 1,           // channel no
            bZeroChannel: false      // zero channel
        };
 
        // 初始化插件参数及插入插件
        WebVideoCtrl.I_InitPlugin(oPlugin.iWidth, oPlugin.iHeight, {
            bWndFull: true,//是否支持单窗口双击全屏,默认支持 true:支持 false:不支持
            iWndowType: 1,
            cbInitPluginComplete: function () {
                WebVideoCtrl.I_InsertOBJECTPlugin("divPlugin");
 
                // 检查插件是否最新
                if (-1 == WebVideoCtrl.I_CheckPluginVersion()) {
                    alert("检测到新的插件版本,双击开发包目录里的WebComponentsKit.exe升级!");
                    return;
                }
 
                // 登录设备
                WebVideoCtrl.I_Login(oLiveView.szIP, oLiveView.iProtocol, oLiveView.szPort, oLiveView.szUsername, oLiveView.szPassword, {
                    success: function (xmlDoc) {
                        // 开始预览
                        var szDeviceIdentify = oLiveView.szIP + "_" + oLiveView.szPort;
                        setTimeout(function () {
                            WebVideoCtrl.I_StartRealPlay(szDeviceIdentify, {
                                iStreamType: oLiveView.iStreamType,
                                iChannelID: oLiveView.iChannelID,
                                bZeroChannel: oLiveView.bZeroChannel
                            });
                        }, 1000);
                    }
                });
            }
        });
 
        // 关闭浏览器
        $(window).unload(function () {
            WebVideoCtrl.I_Stop();
        });
    });
 
</script>
 
</html>