Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to upload .wav or webm - Audio Recording Only #156

Open
kylemccann opened this issue Jan 22, 2018 · 0 comments
Open

Unable to upload .wav or webm - Audio Recording Only #156

kylemccann opened this issue Jan 22, 2018 · 0 comments

Comments

@kylemccann
Copy link

I have added the following code into MediaStreamRecorder.js

`function uploadToPHPServer(blob) {
var file = new File([blob], 'msr-' + (new Date).toISOString().replace(/:|./g, '-') + '.wav', {
type: 'audio/wav'
});

// create FormData
var formData = new FormData();
formData.append('audio-filename', file.name);
formData.append('adio-blob', file);

makeXMLHttpRequest('https://devweb2017.cis.strath.ac.uk/~pqb14180/MediaStreamRecorder/save.php', formData, function() {
    var downloadURL = 'https://devweb2017.cis.strath.ac.uk/~pqb14180/MediaStreamRecorder/uploads/' + file.name;
    console.log('File uploaded to this path:', downloadURL);
});

}

function makeXMLHttpRequest(url, data, callback) {
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (request.readyState == 4 && request.status == 200) {
callback();
}
};
request.open('POST', url);
request.send(data);
}`

I get this message in developer tools console:

File uploaded to this path: https://devweb2017.cis.strath.ac.uk/~pqb14180/MediaStreamRecorder/uploads/msr-2018-01-22T20-37-27-348Z.wav

However the file does not exits, any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant