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
master: https://github.com/appcelerator/titanium_mobile_windows/pull/853 6_0_X: https://github.com/appcelerator/titanium_mobile_windows/pull/854
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
master: https://github.com/appcelerator/titanium_mobile_windows/pull/866 6_0_X: https://github.com/appcelerator/titanium_mobile_windows/pull/867
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