Im using the Jquery webcam plugin demonstrated in this link : http://www.xarg.org/project/jquery-webcam-plugin/ im trying to integrate it with Asp.net , so far the camera is showing and oncapture method is reached , however im having a problem with saving the captured image , the typical scenario is that when the on capture() is fired the webcam.save(“page”) would send an HTTP_RAW_DATA request to that “page” and then some code saves the captured image , unfortunately ,this is not happening :/ Here is the aspx content page that has the webcam code :
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#webcam").webcam({
width: 320,
height: 240,
mode: "save",
swffile: "Scripts/jscam_canvas_only.swf",
onTick: function () { },
onSave: function () {
},
onCapture: function () {
webcam.save("WebForm1.aspx");
},
debug: function () { },
onLoad: function () {
}
});
});
</script>
<p style="width:360px;text-align:center;font-size:12px">
<a href="javascript:webcam.capture();void(0);">Take a picture instantly</a>
</p>
The WebForm1.aspx
is a content page I added to handle the request and I only added some code that is said to work in this link :
Save Image From Webrequest in C# and added
it to the code behind :
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string strFile = DateTime.Now.ToString("dd_MMM_yymmss") + ".jpg";
FileStream log = new FileStream(Server.MapPath(strFile),
FileMode.OpenOrCreate);
byte[] buffer = new byte[1024];
int c;
while ((c = Request.InputStream.Read(buffer, 0, buffer.Length)) > 0)
{
log.Write(buffer, 0, c);
}
//Write jpg filename to be picked up by regex and displayed on flash html page.
Response.Write(strFile);
log.Close();
}
}
I think the issue might be that the request isn’t reached in the WebForm1.aspx .. Hope you guys can help me solving this ...