locked
How to post Bytes of Audio Blob Object to a Audio Converter with Win.Js

    Question

  • Hello I'm trying to upload the bytes of a blob object of a audio file from the mic to a audio converter.

    Here is my code:

            Windows.Storage.KnownFolders.videosLibrary.getFileAsync(audio).then(function (file) {
                filename = file.name;
                return file.openAsync(Windows.Storage.FileAccessMode.readWrite);
            }).then(function completeStream(stream) {
                audioContent = MSApp.createBlobFromRandomAccessStream("audio/x-m4a", stream);
    
                finaldata = setupData(filename, audioContent);
    
                WinJS.xhr({
                    type: "post", url: "http://www.etc.com/etc.php",
                    headers: {
                        "Content-type": "multipart/form-data; boundary=----WebKitFormBoundarylekyhY13AyFRecRP\r\n",
                        "Content-Length:": bufferLength + "\r\n"
                    }, data: finaldata 
                }).done(function fulfilled(result) {
    
                    if (result.status === 200) {
                        parseResult(result.responseText);
                    }
                });

    The problem:

    The bytes of the blob will not post. Using Fiddler I can see What does post "

    ------WebKitFormBoundaryLM1eaXml90e3bAnE
    Content-Dis-data; name="uploadedfile"; filename="cameraCapture (29).m4a"
    Content-Type: audio/x-m4a

    [object Blob]

    Instead of the bytes of the audio posting. "[object Blob]" is posted. How can i post the bytes of the blob?

    This is how it should look:

    Saturday, March 23, 2013 11:01 PM

All replies