1 Reply Latest reply on Feb 21, 2011 2:52 AM by nirnirnir

    Capturing video from Android camera and uploading it to a remote location?

    nirnirnir

      Hello,

       

      Does anyone have an example of letting the user capture a video on android, displaying it to the user and then uploading it to a remote location?

       

      Thanks

        • 1. Re: Capturing video from Android camera and uploading it to a remote location?
          nirnirnir Level 1

          If it helps anyone, here is a solution:

           

          Uploading the file:

           

          var fileStream:FileStream = new FileStream();

          fileStream.open(file,FileMode.READ);

          var bytes:ByteArray = new ByteArray();

          fileStream.readBytes(bytes);

          fileStream.close();

          var b64:Base64Encoder = new Base64Encoder();

          b64.encodeBytes(bytes);

          uploadFileCollection(b64.toString())

           

          And the web service in ,NET will look like this:

           

          [Web Method]

          public string UploadFileCollection(string Base64Image)

                  {

                      try

                      {

                          string fileName = "FileName1.png";

                          byte[] imageBytes = Convert.FromBase64String(Base64Image);

                          MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length);

                          ms.Write(imageBytes, 0, imageBytes.Length);

                          Image image = Image.FromStream(ms, true);

                          image.Save("C:\\images\\" + fileName);

                          return "Got it";

                      }

                      catch (Exception ex1)

                      {

                          return "Problem uploading file: " + ex1.Message;

                      }

                  }