You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Richard B Knoll (JIRA)" <ji...@apache.org> on 2015/10/10 03:06:05 UTC

[jira] [Commented] (CB-6484) navigator.camera.getPicture FILE_URI 20 second delay on second call

    [ https://issues.apache.org/jira/browse/CB-6484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14951461#comment-14951461 ] 

Richard B Knoll commented on CB-6484:
-------------------------------------

I've been trying to reproduce this on an iPod touch running iOS 8.4 with cordova-camera-plugin 1.2.0 and failing. My process is as follows:

1. Pressing a button that calls {{getPicture()}} using the camera options you gave above
2. Hitting cancel in the native camera app
3. Immediately hitting the take picture button again when the Webview app reappears

Does that sound correct? Are you doing anything special in your {{app.onFail}} method that I might need to replicate?

> navigator.camera.getPicture FILE_URI 20 second delay on second call
> -------------------------------------------------------------------
>
>                 Key: CB-6484
>                 URL: https://issues.apache.org/jira/browse/CB-6484
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Camera
>    Affects Versions: 3.4.0
>         Environment: iOS 7.1 (iPhone 5 and iPhone 5s)
>            Reporter: Kent Spadzinski
>             Fix For: 3.4.0
>
>
> First time the camera is used it works fine.  However, if the user cancels or tries to take another picture the camera screen is black.  At this point it can take between 10-15 seconds before the camera preview appears and another picture can be taken.  Have tried all version of the camera plugin starting at 0.2.5 (up to 0.2.9).   Here is the code and device logs:
> Here is the function... there are no errors logged in console when called:
> {code}
> app.takePhoto = function() {
>         navigator.camera.getPicture(app.capturePhoto, app.onFail, { 
>             quality : 20, 
>             destinationType : 1, 
>             sourceType : 1,
>             encodingType: Camera.EncodingType.JPEG,
>             targetWidth: 1024
>         });
>     }
> var retries = 0;
>     app.capturePhoto = function(fileURI )   {
>         var win = function (r) {
>             app.clearCache();
>             retries = 0;
>             $("#progressview").hide();
>             app.showAlert("Your photo was successfully uploaded", "Photo Upload");
>             var listview = $("#lsPhotos").data("kendoMobileListView");
>             listview.setDataSource(app.photoDataSource);
>             app.photoDataSource.read();
>         }
>         var fail = function (error) {
>             if (retries == 0) {
>                 retries ++
>                 setTimeout(function() {
>                     app.capturePhoto(fileURI)
>                 }, 1000)
>             } else {
>                 retries = 0;
>                 app.clearCache();
>                 $("#progressview").hide();
>                 app.showAlert("The photo could not be uploaded to the server.  Please try again", "Photo Upload");
>             }
>         }
>         $("#progressview").show();
>         var fileUrl = "xxxxxxxxxxxx";
>         var options = new FileUploadOptions();
>         var prev_perc;
>         options.fileKey = "file";
>         options.fileName = mediaFiles[i].fullPath; // fileURI.substr(fileURI.lastIndexOf('/') + 1);
>         options.mimeType = "image/jpeg";
>         options.params = {}; // if we need to send parameters to the server request
>         var ft = new FileTransfer();
>         ft.onprogress = function(progressEvent) {
>             if (progressEvent.lengthComputable) {
>                 var perc = Math.floor(progressEvent.loaded / progressEvent.total * 100);
>                 if(perc > prev_perc)    {
>                     $("#progressview").text(options.fileName + ": " + perc + "% Uploaded");
>                 }
>                 prev_perc = perc;
>             } 
>             else {
>                 $("#progressview").text("Uploading Photo");
>             }
>         };
>         ft.upload(fileURI, encodeURI(fileUrl), win, fail, options);       
>     }
> {code}
> Click "Take Photo" button:
> pr 15 11:14:13 Kentos-iPhone-5s kernel[0] <Debug>: AppleH6CamIn::setPowerStateGated: 1
> Apr 15 11:14:13 Kentos-iPhone-5s kernel[0] <Debug>: AppleH6CamIn::power_on_hardware
> Apr 15 11:14:13 Kentos-iPhone-5s kernel[0] <Debug>: AppleH6CamIn::ISP_SelectBestMIPIFrequencyIndex_gated - channel: 0, index: 2
> Click "Cancel" on the camera view:
> Apr 15 11:14:17 Kentos-iPhone-5s kernel[0] <Debug>: AppleH6CamIn::setPowerStateGated: 0
> Apr 15 11:14:17 Kentos-iPhone-5s kernel[0] <Debug>: AppleH6CamIn::power_off_hardware
> Immediately Click "Take Photo" again and the camera view appears with black screen
> Camera now shows preview and can take a picture (20 seconds elapsed):
> Apr 15 11:14:37 Kentos-iPhone-5s kernel[0] <Debug>: AppleH6CamIn::setPowerStateGated: 1
> Apr 15 11:14:37 Kentos-iPhone-5s kernel[0] <Debug>: AppleH6CamIn::power_on_hardware
> Apr 15 11:14:38 Kentos-iPhone-5s kernel[0] <Debug>: AppleH6CamIn::ISP_SelectBestMIPIFrequencyIndex_gated - channel: 0, index: 2
> This happens in iOS 7.1 on both iPhone 5S and original iPhone 5 (enterprise user base). 



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

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