titanium-sdk
titanium-sdk copied to clipboard
fix(android): switchCamera method was missing
In the CameraX PR I've accidentally removed the normal overlay switchCamera method after adding the code for the CameraX switchCamera:
Old diff: https://github.com/tidev/titanium-sdk/pull/12395/files#diff-e4ed05264b4abd4321aa6dc1038e0d1e5151cecb0deca2057315ccfff9e8c296L1421-L1426
Test:
var win = Ti.UI.createWindow();
win.addEventListener("click", function() {
Ti.Media.requestCameraPermissions(function(e) {
if (e.success) {
var overlay = Ti.UI.createView();
var btn = Ti.UI.createButton({
bottom: 0,
title: "switch"
})
overlay.add(btn);
Ti.Media.showCamera({
overlay: overlay
});
btn.addEventListener("click", function() {
Ti.Media.switchCamera(Ti.Media.CAMERA_FRONT);
})
}
});
})
win.open();
- Start app
- click on the window
- click on "switch"
- front facing camera show appear