iOS Ti.Media.showCamera ignores Ti.Media.cameraFlashMode when recording video
It seems that, in iOS, Ti.Media.cameraFlashMode is ignored when trying to record video (after inspecting the iOS titanium source code, it seems to not be considered at all)
To Reproduce
Ti.Media.cameraFlashMode = Ti.Media.CAMERA_FLASH_OFF; // creating camera in video mode, ignore the flash setting, using always "auto" Ti.Media.showCamera({ mediaTypes: [Ti.Media.MEDIA_TYPE_VIDEO], ... });
Expected behavior
The created camera apply the global flash setting (Ti.Media.cameraFlashMode)
Environment
Titanium SDK version: 11.1.1.GA CLI version: 6.1.1
after inspecting the iOS titanium source code, it seems to not be considered at all
It is only set when the camera (=picker) is open, see:
https://github.com/tidev/titanium-sdk/blob/8c034a6160a408399363c0ea951de9c4874d3751/iphone/Classes/MediaModule.m#L535-L552 (same in SDK v11.1.x)
// creating camera in video mode, ignore the flash setting, using always "auto"
Because the initial value is Ti.Media.CAMERA_FLASH_AUTO (= UIImagePickerControllerCameraFlashModeAuto).
To make it work, you simply have to set the flash mode after showCamera():
Ti.Media.showCamera({
mediaTypes: [Ti.Media.MEDIA_TYPE_VIDEO],
...
});
Ti.Media.cameraFlashMode = Ti.Media.CAMERA_FLASH_OFF;
It should be explained better in the docs!