Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23848] Ti.Media add focus methods and properties

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid, iOS
Labelsandroid, camera, continuous, focus, ios, media, mode
ReporterRicardo Pereira
AssigneeVijay Singh
Created2016-08-31T14:09:44.000+0000
Updated2020-02-14T11:15:26.000+0000

Description

The focus is set by default to the AUTO, there is no way to change it, in my case I need to use the continuous focus mode. android: FOCUS_MODE_CONTINUOUS_PICTURE & FOCUS_MODE_CONTINUOUS_VIDEO iOS AVCaptureFocusMode ContinuousAutoFocus or AVCaptureFocusModeContinuousAutoFocus

Comments

  1. Sharif AbuDarda 2016-08-31

    Hello, Thanks for creating the ticket. Our engineers will look into it. We will let you know if and when we will make avialble of this features. Thanks.
  2. Hans Knöchel 2016-08-31

    Sounds interesting. can you propose an API for this interface? It is for the showCamera arguments, right? Maybe something like:
       Ti.Media.showCamera({
           focusMode: Ti.Media.FOCUS_MODE_AUTO // default, other constants available
       });
       
    EDIT: iOS has
       AVCaptureFocusModeLocked
       AVCaptureFocusModeAutoFocus
       AVCaptureFocusModeContinuousAutoFocus
       
    Android has:
       FOCUS_MODE_AUTO
       FOCUS_MODE_CONTINUOUS_PICTURE
       FOCUS_MODE_CONTINUOUS_VIDEO
       FOCUS_MODE_EDOF
       FOCUS_MODE_FIXED
       FOCUS_MODE_INFINITY
       FOCUS_MODE_MACRO
       
    We could use the auto-ones for the default values, the continuous ones cross-platform and the others platform-specific. Makes sense?
  3. Ricardo Pereira 2016-09-01

  4. Tiago Miguel Filipe Duarte 2016-12-05

  5. Vijay Singh 2016-12-06

    PR : https://github.com/appcelerator/titanium_mobile/pull/8662 [~hansknoechel] Please review above PR and let me know your feedback. Unit test cases part I will do later. Implementation example -
       var win = Titanium.UI.createWindow({
       	backgroundColor:'white'
       });
       
       var button = Titanium.UI.createButton({
       	top: 20,
       	width:100,
       	height: 60,
       	title: 'OpenCamera'
       });
       
       button.addEventListener('click', function(e) {
       	Titanium.Media.showCamera({
       
       	success:function(event)
       	{
       		var cropRect = event.cropRect;
       		if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO)
       		{
       			var imageView = Ti.UI.createImageView({
       				width:200,
       				height:200,
       				image:event.media
       			});
       			win.add(imageView);
       		}
       	},
       	cancel:function()
       	{
       	},
       	error:function(error)
       	{
       	},
       	focusMode:Ti.Media.FOCUS_MODE_FIXED,
       	showControls:true,
       	saveToPhotoGallery:true,
       	allowEditing:true,
       });
       });
       win.add(button);
       win.open();
       
  6. Vijay Singh 2016-12-14

    In above PR I was trying to get the AVCaptureDevice and changing the property . But after changing, it get reset to its default one. So this will not work. Actually the mentioned property is available in AVFoundation framework in iOS . We are currently using UIImagePickerController to open camera i.e available in UIKit framework. If we want to integrate the mentioned property , we have to use AVCaptureSession. There we can use AVCaptureDevice and manage the properties . [~cng] [~hansknoechel] We have to discuss on same because it is major change. https://www.objc.io/issues/21-camera-and-photos/camera-capture-on-ios/
  7. Ricardo Pereira 2016-12-14

  8. Vijay Singh 2016-12-15

    Same with torch mode ( TIMOB-23856 ). I don't think it is possible to use these properties right now until the mentioned changes happen. Or is it possible with Hyperloop ? [~hansknoechel] Can you confirm please.
  9. Hans Knöchel 2016-12-19

    That is correct. Unfortunately, iOS only exposed the focus- and torch-modes for the AVCaptureDevice, not the UIImagePickerController. TIMOB-23947 tracks progress of that improvement.
  10. Vijay Singh 2017-05-11

    In iOS for this ticket including TIMOB-23947 and TIMOB-23856 , we are creating a camera module as mentioned in wiki https://wiki.appcelerator.org/display/pe/Custom+Camera+Support+in+iOS .

JSON Source