Asked by:
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
-
Hi,
Please refer to the follow thread: http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/27c31acf-9e65-4ffe-a19f-15a48287757c/ .
Roy
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- Marked as answer by Song Tian Friday, March 29, 2013 8:57 AM
- Unmarked as answer by Blade_Genesis Friday, April 5, 2013 8:04 PM
Monday, March 25, 2013 8:28 AM -
------WebKitFormBoundaryLM1eaXml90e3bAnEContent-Disposition:
form-data; name="uploadedfile"; filename="cameraCapture (9).m4a"Content-Type: audio/x-m4a blob:F4B7502F-07EA-4F83-9D1C-E6C8039008EF
Went through the entire process of converting the recorded audio into a blob then storing the blob in indexDB and retrieving it as Object URL and posting the objURL to the web server.
As helpful as this technique is, it still didnt solve the problem.
The problem still persists. It won't post the actual bytes to the web server, which is what i need it to do.
- Edited by Blade_Genesis Friday, April 5, 2013 8:11 PM
Friday, April 5, 2013 8:04 PM -
Can anyone please help?Wednesday, April 24, 2013 3:41 AM