无法访问网络摄像头

Unable to access the WebCam

(function ($) {

    var webcam = {

    "extern": null, // external select token to support jQuery dialogs
    "append": true, // append object instead of overwriting

    "width": 320,
    "height": 240,

    "mode": "callback", // callback | save | stream

    "swffile": "../Webcam_Plugin/jscam_canvas_only.swf",
    "quality": 85,

    "debug":    function () {},
    "onCapture":    function () {},
    "onTick":   function () {},
    "onSave":   function () {},
    "onLoad":   function () {}
    };

    window["webcam"] = webcam;

    $["fn"]["webcam"] = function(options) {

    if (typeof options === "object") {
        for (var ndx in webcam) {
        if (options[ndx] !== undefined) {
            webcam[ndx] = options[ndx];
        }
        }
    }

    var source = '<object id="XwebcamXobjectX" type="application/x-shockwave-flash" data="'+webcam["swffile"]+'" width="'+webcam["width"]+'" height="'+webcam["height"]+'"><param name="movie" value="'+webcam["swffile"]+'" /><param name="FlashVars" value="mode='+webcam["mode"]+'&amp;quality='+webcam["quality"]+'" /><param name="allowScriptAccess" value="always" /></object>';

    if (null !== webcam["extern"]) {
        $(webcam["extern"])[webcam["append"] ? "append" : "html"](source);
    } else {
        this[webcam["append"] ? "append" : "html"](source);
    }

    var run = 3;
    (_register = function() {
        var cam = document.getElementById('XwebcamXobjectX');

        if (cam && cam["capture"] !== undefined) {

        /* Simple callback methods are not allowed :-/ */
        webcam["capture"] = function(x) {
            try {
            return cam["capture"](x);
            } catch(e) {}
        }
        webcam["save"] = function(x) {
            try {
            return cam["save"](x);
            } catch(e) {}
        }
        webcam["setCamera"] = function(x) {
            try {
            return cam["setCamera"](x);
            } catch(e) {}
        }
        webcam["getCameraList"] = function() {
            try {
            return cam["getCameraList"]();
            } catch(e) {}
        }
        webcam["pauseCamera"] = function() {
            try {
            return cam["pauseCamera"]();
            } catch(e) {}
        }       
        webcam["resumeCamera"] = function() {
            try {
            return cam["resumeCamera"]();
            } catch(e) {}
        }
        webcam["onLoad"]();
        } else if (0 == run) {
        webcam["debug"]("error", "Flash movie not yet registered!");
        } else {
        /* Flash interface not ready yet */
        run--;
        window.setTimeout(_register, 1000 * (4 - run));
        }
    })();
    }

})(jQuery);

以上是我用来访问系统网络摄像头的功能。当我在本地主机上使用它时它工作正常但是当它被放在服务器上然后通过 Intranet 访问时就会出现问题。 我找不到修复它的原因。请帮助我。

前两张图片是我在本地主机上使用我的代码时的图片。它工作正常,因为我能够访问网络摄像头。

问题陈述: 最后一张图片是我尝试通过服务器执行相同操作的图片。图像打开的网络摄像头已完全消失。只出现白色屏幕,即使我通过网络摄像头拍摄照片,白色图像也只保存在服务器上,而不是正确的原始图像。

出于安全原因,您必须通过 Https 为网站提供服务才能访问相机。

var webcam = {

    "extern": null, // external select token to support jQuery dialogs
    "append": true, // append object instead of overwriting

    "width": 320,
    "height": 240,

    "mode": "callback", // callback | save | stream

    "swffile": "../Webcam_Plugin/jscam_canvas_only.swf",
    "quality": 85,

    "debug":    function () {},
    "onCapture":    function () {},
    "onTick":   function () {},
    "onSave":   function () {},
    "onLoad":   function () {}
    };

    window["webcam"] = webcam;

    $["fn"]["webcam"] = function(options) {

    if (typeof options === "object") {
        for (var ndx in webcam) {
        if (options[ndx] !== undefined) {
            webcam[ndx] = options[ndx];
        }
        }
    }

    var source = '<object id="XwebcamXobjectX" type="application/x-shockwave-flash" data="'+webcam["swffile"]+'" width="'+webcam["width"]+'" height="'+webcam["height"]+'"><param name="movie" value="'+webcam["swffile"]+'" /><param name="FlashVars" value="mode='+webcam["mode"]+'&amp;quality='+webcam["quality"]+'" /><param name="allowScriptAccess" value="always" /></object>';

    if (null !== webcam["extern"]) {
        $(webcam["extern"])[webcam["append"] ? "append" : "html"](source);
    } else {
        this[webcam["append"] ? "append" : "html"](source);
    }

    var run = 3;
    (_register = function() {
        var cam = document.getElementById('XwebcamXobjectX');

        if (cam && cam["capture"] !== undefined) {

        /* Simple callback methods are not allowed :-/ */
        webcam["capture"] = function(x) {
            try {
            return cam["capture"](x);
            } catch(e) {}
        }
        webcam["save"] = function(x) {
            try {
            return cam["save"](x);
            } catch(e) {}
        }
        webcam["setCamera"] = function(x) {
            try {
            return cam["setCamera"](x);
            } catch(e) {}
        }
        webcam["getCameraList"] = function() {
            try {
            return cam["getCameraList"]();
            } catch(e) {}
        }
        webcam["pauseCamera"] = function() {
            try {
            return cam["pauseCamera"]();
            } catch(e) {}
        }       
        webcam["resumeCamera"] = function() {
            try {
            return cam["resumeCamera"]();
            } catch(e) {}
        }
        webcam["onLoad"]();
        } else if (30 == run) {
        webcam["debug"]("error", "Flash movie not yet registered!");
        } else {
        /* Flash interface not ready yet */
        run--;
        window.setTimeout(_register, 1000 * (4 - run));
        }
    })();
    }

})(jQuery);