MozillaZine

how to store recorded audio file in sdcard

Discuss building things with or for the Mozilla Platform.
ripal
New Member
 
Posts: 1
Joined: April 11th, 2015, 5:12 am

Post Posted April 11th, 2015, 5:19 am

i am trying create one app using fire fox os where i am recording audio file and then i want to store that file in to firefox mobile SDcard.i dont know how to store audio file in to specific formate called mp4 ya ogg.??if any one know can help me plzz??
here is the code for it.
app.js file has java script code

if (navigator.getUserMedia) {
console.log('getUserMedia supported.');
navigator.getUserMedia (
// constraints - only audio needed for this app
{
audio: true
},

// Success callback
function(stream) {
var mediaRecorder = new MediaRecorder(stream);

visualize(stream);

record.onclick = function() {
mediaRecorder.start();
console.log(mediaRecorder.state);
console.log("recorder started");
record.style.background = "red";
record.style.color = "black";
}

stop.onclick = function() {
mediaRecorder.stop();
console.log(mediaRecorder.state);
console.log("recorder stopped");
record.style.background = "";
record.style.color = "";
}

mediaRecorder.ondataavailable = function(e) {
console.log("data available");

var clipName = prompt('Enter a name for your sound clip');

var clipContainer = document.createElement('article');
var clipLabel = document.createElement('p');
var audio = document.createElement('audio');
var deleteButton = document.createElement('button');
var saveButton = document.createElement('button');
clipContainer.classList.add('clip');
audio.setAttribute('controls', '');
deleteButton.innerHTML = "Delete";
saveButton.innerHTML = "Save";
clipLabel.innerHTML = clipName;

clipContainer.appendChild(audio);
clipContainer.appendChild(clipLabel);
clipContainer.appendChild(deleteButton);
clipContainer.appendChild(saveButton);
soundClips.appendChild(clipContainer);

var audioURL = window.URL.createObjectURL(e.data);
audio.src = audioURL;

deleteButton.onclick = function(e) {
evtTgt = e.target;
evtTgt.parentNode.parentNode.removeChild(evtTgt.parentNode);
}

saveButton.onclick = function(e) {
evtTgt = e.target;
////record the audio file in to sdcard.

}


here after clicking on save button i will able to store the audio file in to sdcard.

Return to Mozilla Development


Who is online

Users browsing this forum: No registered users and 1 guest