locked
I have captured video using camera in App, facing problem to post the video to DB using restful API. I have tried to convert video in the form of stream and bytes array. RRS feed

  • Question

  • // Saving the captured video file

     CameraCaptureUI capture = new CameraCaptureUI();
                capture.VideoSettings.Format = CameraCaptureUIVideoFormat.Mp4;

                file = await capture.CaptureFileAsync(CameraCaptureUIMode.Video);

    // Reading the file interms of stream, bytearray

                        IRandomAccessStream fileStream = await file.OpenAsync(FileAccessMode.Read);
                        var reader = new DataReader(fileStream.GetInputStreamAt(0));
                        byte[] bytesArray = new byte[fileStream.Size];
                        await reader.LoadAsync((uint)fileStream.Size);
                        reader.ReadBytes(bytesArray);

               
    Tuesday, January 7, 2014 12:45 PM

Answers

  • It sounds like there is something off in the HTTP request the app is sending. The requestor and the server need to agree on the headers passed, so make sure you are sending appropriate information for your server.

    If you have a working client you can examine the request in Fiddler and compare it with the failing request.

    --Rob

    • Marked as answer by Anne Jing Wednesday, January 15, 2014 6:15 AM
    Thursday, January 9, 2014 11:18 PM
    Moderator

All replies

  • What is your question? Do you need to know how to upload a file? Are you doing so but getting errors? In what form does your service expect the data? Does it want something other than a file?

    --Rob

    Tuesday, January 7, 2014 4:54 PM
    Moderator
  • Thanks Rob for your reply,

    Yes, i want to upload a video using restful API., i have written two services, for one its expecting Stream and another one byte array. For both i am getting 400 bad request while posting data.

    Thursday, January 9, 2014 7:28 AM
  • It sounds like there is something off in the HTTP request the app is sending. The requestor and the server need to agree on the headers passed, so make sure you are sending appropriate information for your server.

    If you have a working client you can examine the request in Fiddler and compare it with the failing request.

    --Rob

    • Marked as answer by Anne Jing Wednesday, January 15, 2014 6:15 AM
    Thursday, January 9, 2014 11:18 PM
    Moderator