title: JQuery WebCam Result not showing in Firefox
body: <p>I am using jquery webcam plugin in a MVC4 page. The plugin is here: <a href="http://www.xarg.org/project/jquery-webcam-plugin/" rel="nofollow noreferrer">http://www.xarg.org/project/jquery-webcam-plugin/</a>.</p>
  
  <p>1.It is properly working in Chrome and IE.Image shown under "<strong>Live Camera</strong>" label is showing live camera result.Which is not displaying in firefox.</p>
  
  <p><img src="https://i.stack.imgur.com/8x0qG.png" alt="enter image description here"></p>
  
  <ol start="2">
  <li>Below image is of Firefox.Live camera result is not showing only. Captured image saved successfully in my Image folder.</li>
  </ol>
  
  <p><img src="https://i.stack.imgur.com/HktlT.png" alt="enter image description here"></p>
  
  <p>Here my code of .cshtml page</p>
  
  <pre><code>&lt;div class="modal-dialog" style="width: 560px;"&gt;
  &lt;div class="modal-content"&gt;
      &lt;div class="modal-header"&gt;
          &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true" tabindex="-1"&gt;
              &lt;img src="~/Content/images/btn_close.png" alt=""&gt;&lt;/button&gt;
          &lt;h4 class="modal-title" id="myModalLabel"&gt;Capture Image&lt;/h4&gt;
      &lt;/div&gt;
      &lt;div class="padLeftRight15"&gt;
          &lt;div id="lblSKLCreateErrorMessage" class="alert alert-danger" style="display: none"&gt;&lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="modal-body"&gt;
          &lt;form class="form-horizontal" role="form" id="Profile-CaptureImage-form"&gt;
              &lt;table border="0"&gt;
                  &lt;tr&gt;
                      &lt;td align="center"&gt;
                          &lt;u&gt;Live Camera&lt;/u&gt;
                      &lt;/td&gt;
                      &lt;td&gt;&lt;/td&gt;
                      &lt;td align="center"&gt;
                          &lt;u&gt;Captured Picture&lt;/u&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;
                          &lt;div id="webcam"&gt;
                          &lt;/div&gt;
                      &lt;/td&gt;
                      &lt;td&gt;&amp;nbsp;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;img id="imgCapture" style="visibility: hidden" width="250" height="200" /&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;
                          &lt;input type="button" id="btnCapture" value="Capture" onclick="Capture();" /&gt;
  
                      &lt;/td&gt;
                      &lt;td&gt;&lt;/td&gt;
                      &lt;td&gt;
                          &lt;input type="button" id="btnSave" value="Save Image" style="visibility: hidden" data-dismiss="modal" onclick="SaveImage();" /&gt;
  
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
              &lt;br /&gt;
  
              &lt;br /&gt;
              &lt;span id="camStatus"&gt;&lt;/span&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>
      </p>
  
  <pre><code>$(document).ready(function () {
      LoadImage();
  
  });
  function Capture() {
      webcam.capture();
      return false;
  }
  
  
  function LoadImage() {
      jQuery("#webcam").webcam({
          width: 250,
          height: 240,
          mode: "save",
          swffile: "@Url.Content("~/Scripts/Webcam_Plugin/jscam.swf")",
          debug: function (type, status) {
              $('#camStatus').append(type + ": " + status + '&lt;br /&gt;&lt;br /&gt;');
          },
          onSave: function (data) {
              $.ajax({
                  type: "POST",
                  url: "@(Url.Action("GetCapturedImage", "Registration", new { ProfileCode = Model.ProfileCode }))",
                  data: '',
                  contentType: "application/json; charset=utf-8",
                  dataType: "json",
                  success: function (r) {
                      $('#btnSave').css("visibility", "visible");
                      $('#imgCapture').css("visibility", "visible");
                      $('#imgCapture').attr("src", r + "?ts=" + Date.now());
                  },
                  failure: function (response) {
                      alert(response.d);
                  }
              });
          },
          onCapture: function () {
              webcam.save("@(Url.Action("CaptureImage", "Registration", new { ProfileCode = Model.ProfileCode }))");
          }
      });
  }
  
  function SaveImage() {
      $('#btnUploadProfilePhoto').val("");
      $('#preview').attr("src", '@(RMSApp.Common.ProjectConfiguration.ProfileImagePath + Model.ProfileCode + ".png?ts=123")' + Date.now());
      $('#hdnImagePath').val('@(Model.ProfileCode + ".png")');       
      $("#CaptureImageModel").html('');
  }
  </code></pre>
  
  <p></p>
  
  <p>Here is code of controller </p>
  
  <pre><code>    public ActionResult CaptureImage(string ProfileCode)
      {
          Profile obj = new Profile();
          obj.ProfileCode = ProfileCode;
  
          if (Request.InputStream.Length &gt; 0)
          {
              using (StreamReader reader = new StreamReader(Request.InputStream))
              {
                  string hexString = Server.UrlEncode(reader.ReadToEnd());
                  string imageName = ProfileCode.Trim();
                  //string imageName = FirstName.Trim() + "_" + (string.IsNullOrEmpty(MiddleName) ? "" : MiddleName.Trim().Substring(0, 1) + "_") + (string.IsNullOrEmpty(LastName) ? "" : LastName.Trim());
  
                  string imagePath = string.Format("~/Documents/ProfileImages/{0}.png", imageName);
                  string directoryName = Server.MapPath("~/" + ProjectConfiguration.ProfileImageFolder);
  
                  if (!Directory.Exists(directoryName))
                      Directory.CreateDirectory(directoryName);
  
                  if (!string.IsNullOrEmpty(imagePath))
                  {
                      string existingImage = Path.Combine(directoryName, imagePath);
                      if (System.IO.File.Exists(existingImage))
                          System.IO.File.Delete(existingImage);
  
                      System.IO.File.WriteAllBytes(Server.MapPath(imagePath), ConvertHexToBytes(hexString));
                  }
              }
          }
         return PartialView("CaptureImage",obj);
  
      }
  
      private static byte[] ConvertHexToBytes(string hex)
      {
          byte[] bytes = new byte[hex.Length / 2];
  
          for (int i = 0; i &lt; hex.Length; i += 2)
          {
              bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16);
          }
  
          return bytes;
      }
  
   public JsonResult GetCapturedImage(string ProfileCode)
      {
          string imagePath = string.Format(System.Configuration.ConfigurationManager.AppSettings["ProfileImages"] + ProfileCode +".png");
          return Json(imagePath);
      }
  </code></pre>