cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Javier (JIRA)" <>
Subject [jira] [Created] (CB-12494) Not able to reproduce recorded audios if including path such as cordova.file.dataDirectory
Date Wed, 22 Feb 2017 17:33:44 GMT
Javier created CB-12494:

             Summary: Not able to reproduce recorded audios if including path such as cordova.file.dataDirectory
                 Key: CB-12494
             Project: Apache Cordova
          Issue Type: Bug
          Components: Android, Plugin Media
    Affects Versions: 2.4.1
         Environment: cordova 6.4.0
cordova-plugin-media 2.4.1
Android 5.0
            Reporter: Javier

I record and audio file and I want later on to reproduce it.

Depending on the path that I use to record it, it will reproduce the audio fine before closing
the App, but no after re-opening it again or in the other way round: it will NOT reproduce
the audio, and if I close the App and re-open it again it will work fine.

When it fails it returns an error code 1 (MediaError.MEDIA_ERR_ABORTED).

Snippets of the code:

    function recordAudio(src, ms, successCB) {
        var mediaRec = new Media(src,
            // success callback
            function() {
                // DEBUG
                console.log('OK recording to: ' + src);
            // error callback
            function(err) {
                alert('ERROR recording spot: ' + err.message);
        // Record audio

        // Stop recording after 10 seconds
        setTimeout(function() {
        }, ms);

        var fileName = cordova.file.dataDirectory, + spotAudio + '.amr';
        // spot media with the voice previously recorded by the user
        var newRadioSpotMedia = new Media(fileName,
            // success callback
            function () {
                // New radio spot exists, and play finished
                // resume playing new radio station
                console.log('OK playing spot');
            // error callback
            function (err) {
                // New radio spot DOES NOT exists
                // err.message comes empty
                console.log('Unable to retrieve spot "' + fileName +
                            '". Error code: ' + err.code);
            // change callback
            function (status) {}

I also tried all the possible combinations, try using "audioName.amr", "cdvfile://localhost/persistent/audioName.amr"
but the issue is persistent: I'm able to reproduce the recorded audio file before closing
the App or after re-opening it again, but I'm not able to reproduce the sound before and after
closing the App.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message