Created
March 6, 2019 17:14
-
-
Save exclusiveTanim/1a424db4eb0a25f77d086da38a6289be to your computer and use it in GitHub Desktop.
Front camera code for testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var window = Ti.UI.createWindow({ | |
backgroundColor : '#000' | |
}); | |
// create button, register the modified click callback, add button to window | |
function addButton(title, clickCallback) { | |
var button = Ti.UI.createButton({ | |
title : title, | |
width : '300', | |
height : '50' | |
}); | |
button.addEventListener('click', function() { | |
Ti.Media.showCamera({ | |
mediaType : Ti.Media.MEDIA_TYPE_PHOTO | |
}); | |
clickCallback(); | |
Ti.Media.vibrate(); | |
}); | |
window.add(button); | |
} | |
// camera with front specified after switching to back | |
// checks if switch function actually works, opposed to it being the default | |
addButton('Front Camera Test 2', function() { | |
Ti.Media.switchCamera(Ti.Media.CAMERA_BACK); | |
Ti.Media.switchCamera(Ti.Media.CAMERA_FRONT); | |
}); | |
window.open(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<key>NSCameraUsageDescription</key> | |
<string>Can we use your camera?</string> | |
<key>NSPhotoLibraryUsageDescription</key> | |
<string>Can we save to your library?</string> | |
<key>NSPhotoLibraryAddUsageDescription</key> | |
<string>Can we save to your library file?</string> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment