facebook

CaptureAudio on iOS 7

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

    MrBean
    Member

    Hi
    I am developing an app that captures audio, video and images.
    Capture video and Images works just fine.
    However, I am not able to get captureAudio to work. Is it supported by your implementation?

    I do a simple call by

    var options = { duration: 10 };
    navigator.device.capture.captureAudio(captureSuccess, captureError, options);

    The screen then goes black and after 10 s, CaptureError is called with code 3.
    It is somewhat interacting with the audio, since if I do a background playback of an internet radio, the sound is stopped when doing this.
    The phonegap documentation states ” iOS Quirks, iOS does not have a default audio recording application, so a simple user interface is provided.”

    Do you have any suggestion here to get it working?

    I am using MobiOne 2.5, Cordova 2.9 and iOS 7.03 on IPhone 5

    Btw, I think MobiOne is an execellent tool, I developed pretty advanced imaging applications without the need of xcode.

    Thanks,

    #344322 Reply

    fbod383
    Member

    you have to use a separate custom js for iOS

     var myAudioFile;
      var myFileRecord = "myrecording.wav";
      var myMime = "audio/x-wav";
        // Wait for PhoneGap to load
        //
        //document.addEventListener("deviceready", onDeviceReady, false);
    
        // Record audio
        // 
        function recordAudio() {
         
            src = recordingPath;
            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 >= 600) {
                    clearInterval(recInterval);
                    mediaRec.stopRecord();
                  
                    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
                   
                }
            }, 1000);
        }
    #344355 Reply

    MrBean
    Member

    @fbod383 wrote:

    you have to use a separate custom js for iOS

     var myAudioFile;
      var myFileRecord = "myrecording.wav";
      var myMime = "audio/x-wav";
        // Wait for PhoneGap to load
        //
        //document.addEventListener("deviceready", onDeviceReady, false);
    
        // Record audio
        // 
        function recordAudio() {
         
            src = recordingPath;
            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 >= 600) {
                    clearInterval(recInterval);
                    mediaRec.stopRecord();
                  
                    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
                   
                }
            }, 1000);
        }

    Thanks, I will try that interface instead.
    My snippet above was placed in a custom.js, and calls to captureImage and CaptureVideo works, not audio.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: CaptureAudio on iOS 7

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