Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23427] Windows: Camera controls are not showing

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-06-28T12:21:02.000+0000
Affected Version/sRelease 5.2.2
Fix Version/sRelease 6.0.0
ComponentsWindows
Labelsqe-5.4.0
Reporter Ricardo Ramirez
AssigneeKota Iguchi
Created2016-05-24T17:15:26.000+0000
Updated2016-09-05T16:48:55.000+0000

Description

Issue Description

Trying to check the camera feature in Windows Platform but the default camera controls are not shown an also front camera is opened. We are unable to capture a picture. Even tried placing the overlay didn't help. We are using titanium SDK 5.2.2.GA. Please find the attached screen shot and code.

Test Case

var win = Ti.UI.createWindow({ 
layout : 'vertical', 
backgroundColor : 'white' 
}); 

var button = Ti.UI.createButton({ 
title : 'take picture', 
color : 'black' 
}); 
button.addEventListener('click', function() { 
Ti.Media.showCamera({ 
'cancel' : function() { 
Ti.API.info('cancel'); 
}, 
'error' : function() { 
Ti.API.info('error'); 
}, 
'success' : function(e) { 
Ti.API.info('success: size=' + e.media.length); 
imageView.image = e.media; 
} 
}); 
}); 
win.add(button); 

var imageView = Ti.UI.createImageView(); 
win.add(imageView); 

// setTimeout(function() { 
// Ti.Media.hideCamera(); 
// }, 3000); 

win.open(); 

Attachments

FileDateSize
SE-SS 2.png2016-06-22T03:20:01.000+0000180399
wp_ss_20160422_0002.jpg2016-05-24T17:15:22.000+000065518
wp_ss_20160615_0001[1].png2016-06-15T20:36:58.000+00001408552

Comments

  1. Nazmus Salahin 2016-05-25

    Hello, I am able to to reproduce the issue with given code. The camera opens for Ti.Media.showCamera but camera control is not showing. Its is not possible to take picture from there or go back to app. Windows default camera app works fine on the same device. I added following capabilities which *did not* solve the issue.
           <windows>
           	<manifest>   
           		<Capabilities>
               		<Capability Name="picturesLibrary" />
               		<DeviceCapability Name="webcam" />
           		</Capabilities>
          	</manifest>   
         </windows>
       
    *Environment*: *OS :* Microsoft Windows 8.1 Enterprise N *Device info:* Microsoft Lumia 640 (Windows Phone 8.1) *Node.js Version:* 0.12.7 *npm Version:* 2.11.3 *Titanium SDKs:* 5.4.0.v20160429102159 *Java Development Kit Version:* 1.8.0_73 *Titanium CLI Version:* 5.0.5 *Appcelerator CLI Version:* 5.2.2 *Appcelerator Studio:* 4.5.0
  2. Kota Iguchi 2016-06-09

    Fixed by TIMOB-23262
       var win = Ti.UI.createWindow({ backgroundColor: 'green', layout:'vertical' }),
           openButton = Ti.UI.createButton({ title: 'OPEN CAMERA', backgroundColor: 'blue' }),
           imageView = Ti.UI.createImageView({width:Ti.UI.FILL, height: '80%'});
       
       var overlay = Ti.UI.createView({
           layout: 'vertical',
           height: '20%', width: Ti.UI.FILL,
           bottom: 0
       }),
       takeButton = Ti.UI.createButton({ title: 'TAKE A PHOTO', backgroundColor: 'red' }),
       hideButton = Ti.UI.createButton({ title: 'HIDE PREVIEW', backgroundColor: 'red' });
       
       takeButton.addEventListener('click', function () {
           Ti.Media.takePicture();
       });
       hideButton.addEventListener('click', function () {
           Ti.Media.hideCamera();
       });
       overlay.add(takeButton);
       overlay.add(hideButton);
       
       openButton.addEventListener('click', function () {
           Ti.Media.showCamera({
               mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO],
               overlay: overlay,
               success: function (e) {
                   Ti.API.info('showCamera() success');
                   imageView.image = e.media;
               },
               error: function () {
                   Ti.API.info('showCamera() error');
               }
           });
       });
       
       win.add(openButton);
       win.add(imageView);
       win.open();
       
  3. Harry Bryant 2016-06-15

  4. Kota Iguchi 2016-06-16

    ok I see. There's a Windows API to show builtin camera UI: [CameraCaptureUI](https://msdn.microsoft.com/windows/uwp/audio-video-camera/capture-photos-and-video-with-cameracaptureui), but it seems it does not work on Windows Phone 8.x. So as far as I can see default camera UI can not be archived on WP 8.1. We could use CameraCaptureUI for Windows 10 (including Mobile). [~cwilliams] Do you think we can move this feature to 6.0.x as this is new feature?
  5. Chee Kiat Ng 2016-06-16

    Yes for now.
  6. Kota Iguchi 2016-06-22

    Pushed PR for builtin camera UI for Windows 10 (Mobile). https://github.com/appcelerator/titanium_mobile_windows/pull/748 Unfortunately, this control is not supported on Windows Phone 8.1 natively. For workaround for Windows Phone 8.1, we could use Ti.Media.openPhotoGallery instead, to launch builtin camera UI. !SE-SS 2.png|thumbnail!
       Ti.Media.openPhotoGallery({
           mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO],
           success: function (e) {
               if (e.mediaType === Ti.Media.MEDIA_TYPE_PHOTO) {
                   imageView.image = e.media;
               }
           },
           cancel: function () {
           },
           error: function (err) {
               Ti.API.error(err);
           }
       });
       
  7. Chee Kiat Ng 2016-06-30

    [~kota] I need docs to be updated on 5_4_X with regards to this, what can be supported and what cannot. Can you do that for me please?
  8. Kota Iguchi 2016-06-30

    [~cng] Sure, will do.
  9. Kota Iguchi 2016-06-30

    https://wiki.appcelerator.org/display/guides2/Camera+and+Photo+Gallery+APIs#CameraandPhotoGalleryAPIs-DisplayingbuiltincameraforWindows
  10. Ewan Harris 2016-09-05

    Verified using: OS: Microsoft Windows 10 Pro 10.0.14393 Appc core: 6.0.0-38 Appc NPM: 4.2.8-6 Ti SDK: 6.0.0.v20160904203840 Lumia 930: 10.0 When using the camera and not specifying an overlay the native camera controls are used Closing ticket

JSON Source