Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23869] Windows: Ti.Media.takePicture usage does not include videosLibrary capability

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2016-09-14T00:41:50.000+0000
Affected Version/sRelease 6.0.0
Fix Version/sRelease 6.0.0
ComponentsWindows
Labelsqe-6.0.0
ReporterEwan Harris
AssigneeGary Mathews
Created2016-09-06T11:17:25.000+0000
Updated2016-09-16T14:12:21.000+0000

Description

Description

When using the code below and not adding the videosLibrary capability, when the picture is taken the app will crash. If the videosLibrary capability is added then it will work as expected. From testing it appears that the generation of used capabilities by the CLI does not add the videosLibrary capability.
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: '70%' });
 
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({
        whichCamera: Titanium.Media.CAMERA_FRONT, // Titanium.Media.CAMERA_REAR
        mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO],
        overlay: overlay,
        success: function (e) {
            Ti.API.info('showCamera() success');
        },
        error: function (e) {
            alert('showCamera() error: ' + JSON.stringify(e));
        }
    });
});
 
win.add(openButton);
win.add(imageView);
win.open();

Steps to reproduce

Add the code above to an existing app.js

Build for a device

Click OPEN CAMERA

Click TAKE PHOTO

Actual result

The app will crash as the videosLibrary is not included

Expected result

App should not crash, correct capabilities should be added

Comments

  1. Gary Mathews 2016-09-06

    master: https://github.com/appcelerator/titanium_mobile_windows/pull/853 6_0_X: https://github.com/appcelerator/titanium_mobile_windows/pull/854
  2. Ewan Harris 2016-09-09

    Reopening ticket: 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.v20160909001132 Code in description crashes still. Seems like is also required
  3. Gary Mathews 2016-09-12

    master: https://github.com/appcelerator/titanium_mobile_windows/pull/866 6_0_X: https://github.com/appcelerator/titanium_mobile_windows/pull/867
  4. Ewan Harris 2016-09-16

    Verified using: OS: Microsoft Windows 10 Pro 10.0.14393 Appc core: 6.0.0-42 Appc NPM: 4.2.8-6 Ti SDK: 6.0.0.v20160915125929 Appc Studio: 4.8.0.201609101003 Lumia 930 10.0 Using the code in the description the app no longer crashes. Closing ticket

JSON Source