[ 
https://issues.apache.org/jira/browse/CB-11867?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Colin Bau updated CB-11867:
---------------------------
    Description: 
I test many times,these are all my code,just use it directly

=====
function recordAudio() {
    if (navigator.userAgent.match(/iPad|iPhone|iPod/i)) {
        var extension = ".wav";
    }
    if (navigator.userAgent.match(/Android/i)) {
        var extension = ".amr";
    }

    var src = 'myrecording' + extension;
    var mediaRec = new Media(src, function() {
        alert("recordAudio():Audio Success");
    }, function(err) {
        alert("recordAudio():Audio Error: " + err.code);
    });
    mediaRec.startRecord();
    setTimeout(function() {
        mediaRec.stopRecord();
        alert('stop record');
    }, 3000);

    setTimeout(function() {
        mediaRec.getCurrentPosition(function(position) {
                if (position > -1) {
                    alert(position + " sec");
                }
            },
            function(e) {
                alert("Error getting pos=" + e);
            }
        );
    }, 5000);
}
=====

when in 3 seconds
Android︰it will alert "recordAudio():Audio Success"
iOS︰it will alert "recordAudio():Audio Success"

when in 5 seconds
Android︰it will alert "-0.001 sec"
iOS︰it will shut down immediately,no any alert trigger

  was:
all my code

=====
function recordAudio() {
    if (navigator.userAgent.match(/iPad|iPhone|iPod/i)) {
        var extension = ".wav";
    }
    if (navigator.userAgent.match(/Android/i)) {
        var extension = ".amr";
    }

    var src = 'myrecording' + extension;
    var mediaRec = new Media(src, function() {
        alert("recordAudio():Audio Success");
    }, function(err) {
        alert("recordAudio():Audio Error: " + err.code);
    });
    mediaRec.startRecord();
    setTimeout(function() {
        mediaRec.stopRecord();
        alert('stop record');
    }, 3000);

    setTimeout(function() {
        mediaRec.getCurrentPosition(function(position) {
                if (position > -1) {
                    alert(position + " sec");
                }
            },
            function(e) {
                alert("Error getting pos=" + e);
            }
        );
    }, 5000);
}
=====

when in 3 seconds
Android︰it will alert "recordAudio():Audio Success"
iOS︰it will alert "recordAudio():Audio Success"

when in 5 seconds
Android︰it will alert "-0.001 sec"
iOS︰it will shut down immediately,no any alert trigger


> "cordova-plugin-media" 2.4.0 will shut down immediately in iOS when use 
> "getCurrentPosition" method
> ---------------------------------------------------------------------------------------------------
>
>                 Key: CB-11867
>                 URL: https://issues.apache.org/jira/browse/CB-11867
>             Project: Apache Cordova
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Plugin Media
>    Affects Versions: 2.4.0
>         Environment: Cordova 6.3.1
> Cordova-android 5.2.2
> Cordova-iOS 4.2.1
> cordova-plugin-camera 2.4.0
> Android 6.0.1(HTC)+iOS 9.3.5 13G36(ipad mini)
>            Reporter: Colin Bau
>            Priority: Critical
>              Labels: iOS9
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> I test many times,these are all my code,just use it directly
> =====
> function recordAudio() {
>     if (navigator.userAgent.match(/iPad|iPhone|iPod/i)) {
>         var extension = ".wav";
>     }
>     if (navigator.userAgent.match(/Android/i)) {
>         var extension = ".amr";
>     }
>     var src = 'myrecording' + extension;
>     var mediaRec = new Media(src, function() {
>         alert("recordAudio():Audio Success");
>     }, function(err) {
>         alert("recordAudio():Audio Error: " + err.code);
>     });
>     mediaRec.startRecord();
>     setTimeout(function() {
>         mediaRec.stopRecord();
>         alert('stop record');
>     }, 3000);
>     setTimeout(function() {
>         mediaRec.getCurrentPosition(function(position) {
>                 if (position > -1) {
>                     alert(position + " sec");
>                 }
>             },
>             function(e) {
>                 alert("Error getting pos=" + e);
>             }
>         );
>     }, 5000);
> }
> =====
> when in 3 seconds
> Android︰it will alert "recordAudio():Audio Success"
> iOS︰it will alert "recordAudio():Audio Success"
> when in 5 seconds
> Android︰it will alert "-0.001 sec"
> iOS︰it will shut down immediately,no any alert trigger



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to