简体   繁体   中英

Issue with ScriptCam in MVC4

Im trying to use ScriptCam https://www.scriptcam.com/demo_5.cfm for my MVC4 project. I have downloaded the files required and followed the instructions on the site. However when i go to run the application i get an issue in the google debugger (shown below)-

  GET http://localhost:9171/QR/webcamlogo.png 404 (Not Found)
qr:145 Uncaught TypeError: undefined is not a function
qr:194 GET http://localhost:9171/QR/webcamlogo.png 404 (Not Found)
swfobject.js:4 GET http://localhost:9171/QR/scriptcam.swf 404 (Not Found)

Now i've tried to figure out how to change the path location of the SWF.file but my javascript experience is only a week old. below is my view file...the rest of the javascript files can be got from the link i provided above.

qr.cshtml

  @{
    ViewBag.Title = "Webcam";
}
        <script language="JavaScript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script language="JavaScript" src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
        <script language="JavaScript" src="~/Webcam/scriptcam.js"></script>
        <script>
            $(document).ready(function () {
                $("#webcam").scriptcam({
                    onError: onError,
                    cornerRadius: 0,
                    onWebcamReady: onWebcamReady
                });
            });

            function onError(errorId, errorMsg) {
                alert(errorMsg);
            }
            function changeCamera() {
                $.scriptcam.changeCamera($('#cameraNames').val());
            }
            function onWebcamReady(cameraNames, camera, microphoneNames, microphone, volume) {
                $.each(cameraNames, function (index, text) {
                    $('#cameraNames').append($('<option></option>').val(index).html(text))
                });
                $('#cameraNames').val(camera);
            }
        </script> 


        <div style="width:330px;float:left;">
            <object type="application/x-shockwave-flash" data="scriptcam.swf" width="320" height="240" id="webcam" style="visibility: visible;"><param name="menu" value="false"><param name="wmode" value="direct"><param name="allowScriptAccess" value="always"><param name="allowFullScreen" value="true"><param name="flashvars" value="width=320&amp;height=240&amp;chatWindow=chatWindow&amp;path=&amp;zoom=1&amp;zoomChat=1&amp;rotate=0&amp;skewX=0&amp;skewY=0&amp;flip=0&amp;noFlashFound=%3Cp%3EYou%20need%20%3Ca%20href%3D%22http%3A%2F%2Fwww.adobe.com%2Fgo%2Fgetflashplayer%22%3EAdobe%20Flash%20Player%2011.7%3C%2Fa%3E%20to%20use%20this%20software.%3Cbr%2F%3EPlease%20click%20on%20the%20link%20to%20download%20the%20installer.%3C%2Fp%3E&amp;onError=function%20onError(errorId%2CerrorMsg)%20%7B%0A%09%09%09%09alert(errorMsg)%3B%0A%09%09%09%7D&amp;cornerRadius=0&amp;onWebcamReady=function%20onWebcamReady(cameraNames%2Ccamera%2CmicrophoneNames%2Cmicrophone%2Cvolume)%20%7B%0A%09%09%09%09%24.each(cameraNames%2C%20function(index%2C%20text)%20%7B%0A%09%09%09%09%09%24('%23cameraNames').append(%20%24('%3Coption%3E%3C%2Foption%3E').val(index).html(text)%20)%0A%09%09%09%09%7D)%3B%20%0A%09%09%09%09%24('%23cameraNames').val(camera)%3B%0A%09%09%09%7D&amp;id=webcam"></object>
            <div style="margin:5px;">
                <img src="webcamlogo.png" style="vertical-align:text-top">
                <select id="cameraNames" size="1" onchange="changeCamera()" style="width:245px;font-size:10px;height:25px;">
                <option value="0">HP Truevision HD (04f2:b35f)</option></select>
            </div>
        </div>
        <div style="width:135px;float:left;">
            <p><button class="btn btn-small" id="btn1" onclick="$('#decoded').text($.scriptcam.getBarCode());">Decode image</button></p>
        </div>
        <div style="width:200px;float:left;">
            <p id="decoded"></p>
        </div>



                </div>

Resolved

Only noticing after posting this that the bottom object type was pointing in the wrong direction

Shows i've been to picky to notice the obvious ha

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM