facebook

Version 2.5 save to local storage issue

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #344119 Reply

    fbod383
    Member

    I recently upgraded to the newest version. An app that previously would store an audio file to local storage, no longer does this. Now i get an error code 1, message: object event

    Ideas?

    #344120 Reply

    Hi fbod383,

    Sorry to hear that you are having problems with Mobione. A few questions to help us get started investigating this issue:

    1) What is the previous version of Mobione that you were using when your app was working?
    2) Are you testing an app or a web app?
    3) If testing on device, please share device model and OS.
    4) Are you testing on the new Mobile Web Simulator or Test Center?
    5) A very simple example project would be helpful to investigate this quickly.

    Also, please note that the audio player api changed in 2.5 please see this doc for details

    #344131 Reply

    fbod383
    Member

    Correction, the error on the phone is “undefined” the object event is a message sent by the SIM to show that an audio recording has started.. I assume a new feature.

    The app button calls this JS

    function beginHelp()
      {
    alert("You have activated GRL Laws Rights Reminder.  If enabled, your phone voice recorder has also been activated to ensure any interaction between you and law enforcement is recorded to fully protect your rights.  Keep your phone on your person if possible.");
    //document.forms["m1_kenny"].submit();
    phoneui.gotoPage('m1-quick1', "FADE");
    if(device.platform == "iPhone")
    {
        myFileRecord = "myrecording.wav";myMime="audio/x-wav";
        
    document.addEventListener("deviceready", function onDeviceReady() {
        window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS1, function fail1(){});
    }, false);
    
    var gotFS1 = function (fileSystem) {
        fileSystem.root.getFile("myrecording.wav",
            { create: true, exclusive: false }, //create if it does not exist
            function success(entry) {
                var src = entry.toURI();
                console.log(src); //logs blank.wav's path starting with file://
            },
            function fail1() {}
        );
    #344132 Reply

    fbod383
    Member

    And also, the only thin gI notice that isnt working (it does record the audio) is it doesnt upload to server

     var myAudioFile;
      var myFileRecord = "myrecording.mp3";
      var myMime = "audio/mpeg3";
        // Wait for PhoneGap to load
        //
        //document.addEventListener("deviceready", onDeviceReady, false);
    
        // Record audio
        // 
        function recordAudio() {
         
            src = myFileRecord;
            mediaRec = new Media(src, onSuccess, onError);
        
            // Record audio
            mediaRec.startRecord();
    
            // Stop recording after 611 sec
            var recTime = 0;
            var recInterval = setInterval(function() {
                recTime = recTime + 1;
                setAudioPosition(recTime + " sec");
                if (recTime >= 1000) {
                    clearInterval(recInterval);
                    mediaRec.stopRecord();
                  
                    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
                   
                }
            }, 1000);
        }
    // Upload files to server
    function uploadFile() {
    var options = new FileUploadOptions();
    options.fileKey="file";
    options.fileName=myFileRecord;
    options.mimeType=myMime;
    options.chunkedMode = false;
    file = "file://" + myAudioFile;
                    var ft = new FileTransfer();
                    var recordingPath = myAudioFile;
                    //var name = "myrecording.mp3";
      var name = localStorage.getItem('myName') + ".mp3";
                    
                    ft.upload(fileURI,
                              "http://legaldocs.info/grl/upload.php",
                              function(result) {
                              
                              console.log('Upload success: ' + result.responseCode);
                              console.log(result.bytesSent + ' bytes sent');
                              },
                              function(error) {
                              
                           //   document.getElementById('audio_position').innerHTML = error.code;
                              },
                              { fileName: name });  
    #344133 Reply

    fbod383
    Member

    Oh yeah, Device is a Galaxy 3 with 4.1.2

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Version 2.5 save to local storage issue

You must be logged in to post in the forum log in