html5 - failed: Invalid UTF-8 sequence in header value, Tomcat server8 -
i using tomcat 8.0 server websocket application. when try establish connection ws = new websocket(.....); throws following error: failed: invalid utf-8 sequence in header value
anybody has come around or knows how fix ??
ps using eclipse platform , chrome 33.0+
<html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>face detection</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> </head> <body> <div> <video id="live" width="320" height="240" autoplay="autoplay" style="display: inline;"></video> <canvas width="320" id="canvas" height="240" style="display: inline;"></canvas> </div> <div> <img id="target" style="display: inline;" /> </div> <script type="text/javascript"> var video = $("#live").get()[0]; var canvas = $("#canvas"); var ctx = canvas.get()[0].getcontext('2d'); var options = { "video" : true }; var ws = new websocket("ws://localhost:8080/facedetection/livevideo"); ws.onopen = function () { console.log("openened connection websocket"); } /**ws.onmessage = function(msg) { var target = document.getelementbyid("target"); url = window.webkiturl.createobjecturl(msg.data); target.onload = function() { window.webkiturl.revokeobjecturl(url); }; target.src = url; }*/ // use chrome specific getusermedia function navigator.webkitgetusermedia(options, function(stream) { video.src = webkiturl.createobjecturl(stream); }, function(err) { console.log("unable video stream!") }) timer = setinterval( function () { ctx.drawimage(video, 0, 0, 320, 240); var data = canvas.get()[0].todataurl('image/jpeg', 1.0); newblob = datauritoblob(data); ws.send(newblob); }, 150); function datauritoblob(datauri) { var bytestring = atob(datauri.split(',')[1]); // separate out mime component var mimestring = datauri.split(',')[0].split(':')[1].split(';')[0] // write bytes of string arraybuffer var ab = new arraybuffer(bytestring.length); var ia = new uint8array(ab); (var = 0; < bytestring.length; i++) { ia[i] = bytestring.charcodeat(i); } // write arraybuffer blob, , you're done var bb = new blob([ab]); //bb.append(ab); return bb; } </script> </body> </html>
gettin error @ following line: var ws = new websocket("ws://localhost:8080/facedetection/livevideo");
Comments
Post a Comment