A
A
Abc Edc2014-11-26 22:33:09
phonegap
Abc Edc, 2014-11-26 22:33:09

In PHONEGAP, in order to transfer the recorded mp3, do I need to save it?

Or you can get by with temporary storage. and how best and where to save
, I take them from the github according to the standard without changing anything

function recordAudio() {
                var src = "myrecording.mp3";
                var mediaRec = new Media(src,
                    // success callback
                    function () {
                        alert("recordAudio():Audio Success");
                    },

                    // error callback
                    function (err) {
                        alert("recordAudio():Audio Error: " + err.code);
                    }
                );

                // Record audio
                mediaRec.startRecord();
                

                // Stop recording after 10 seconds
                setTimeout(function () {
                    mediaRec.stopRecord();
                    mediaRec.play();
                }, 10000);
                
            }

how should the function of sending to the server then look like for me
(in my view it is like this)
function up() {// !! Assumes variable fileURI contains a valid URI to a text
    // file on the device

    var fileURI = "помогите люди добрые с путем";
    var options = new FileUploadOptions();
    options.fileKey = "file";
    options.fileName=fileURI.substr(fileURI.lastIndexOf('/')+1);
    options.mimeType = "audio/mp3";

    var params = new Object();
    params.value1 = "test";
    params.value2 = "param";

    options.params = params;

    var ft = new FileTransfer();
    ft.upload(fileURI, "http://myserver/upload.php", win, fail, options);
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question