海康威视播放功能代码缩减版

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title></title>
</head>
<body>
<object classid="clsid:5A418331-514E-4C54-B526-6AC3C135FFD2" codebase="" standby="Waiting..."
        id="NetVideoActiveX"
        width="100%" height="95%" name="ocx" align="center">
</object>
<script type="text/javascript">
    var m_userinfo = '192.168.5.235 admin 12345 8000';      //从服务器获取当前注册用户信息
    var TOP_WINDOW = 0;
    window.onload = (function () {
        var player = document.getElementById("NetVideoActiveX");
        var parts = m_userinfo.split(' ');
        var serverIpAddress = parts[0];
        var serverPort = parseInt(parts[3]);
        var username = parts[1];
        var password = parts[2];
        var tokenId = player.Login(serverIpAddress, serverPort, username, password);
        if (tokenId == -1) {
            alert('不能连接');
            return;
        }
        var channel = 0;
        player.StartRealPlay(channel, TOP_WINDOW)

    });
</script>

</body>
</html>

相关推荐