Closed jzillmann closed 5 years ago
If possible, can you attach a reduced test case?
Oh, i must confess i not yet dived into the mysteries of flutter testing... but in one or two weeks latest i guess i will have my app ready to do some reality check and compare the results of the app camera withe the results of the standard camera app! Will let you know!
Ok, i did some more testing (manuel). I'am now at Flutter 0.3.2 and plugin 0.2. I'am using a Galaxy Tab A (2016) device, SM-T280.
I took pictures:
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
Here is the comparative result:
I noticed:
What i basically want is to mimic the camera behaviour as close as possible, means:
Looking at the camera's flutter plugin code is see no controls to tweak the behaviour... Any help or insights appreciated!
I'm facing the same problem, I was thinking that a workaround for me would be to take the picture and then rotate it somehow depending on the device orientation, I can do this because I don't need to preview the image, but I imagine that since you need a preview it would be harder on your side, did you manage to find an alternative and better solution?
Not yet. I was expecting that this was something so core that the google dev's care about... For me, the picture thing was also intermediate - while i was waiting for video support - so i'm focussing more on the video behaviour now...
Btw, think there are a couple of more people facing that, see e.g. https://github.com/flutter/flutter/issues/18094
I have similar problem with camera plugin.
It happens even without rotating the phone. App is started (and locked) in portrait, photo taken in portrait. Bu the photo is saved 90 CCW.
I'm seeing this on Sony F5321(Android 8.0), but it's fine with other devices.
Any news on this matter?
Is this issue been addressed by any of the developers of flutter?
I think this is because onPause
is not called. The camera is not "rebuilt" like it happens in native apps.
Having the same issue. Is this device related? When locking the orientation to portrait up, the same code currently produces the issue on iOS iPhone SE but not on Android OnePlus 3.
The CameraPreview rotation issue can be workarounded with help of https://pub.dartlang.org/packages/native_device_orientation like this:
NativeDeviceOrientationReader(
builder: (context) {
NativeDeviceOrientation orientation = NativeDeviceOrientationReader.orientation(context);
int turns;
switch (orientation) {
case NativeDeviceOrientation.landscapeLeft: turns = -1; break;
case NativeDeviceOrientation.landscapeRight: turns = 1; break;
case NativeDeviceOrientation.portraitDown: turns = 2; break;
default: turns = 0; break;
}
return RotatedBox(
quarterTurns: turns,
child: _cameraPreviewWidget()
);
}
)
(tested on Nexus 5X API 27)
No fix yet.
I have similar problem with camera plugin.
It happens even without rotating the phone. App is started (and locked) in portrait, photo taken in portrait. Bu the photo is saved 90 CCW.
I'm seeing this on Sony F5321(Android 8.0), but it's fine with other devices.
I've the same problem. Any news on this issue?
They releases the version 0.2.6 of camera plugin yesterday that fix in Android. Any news to IPhone?
They releases the version 0.2.6 of camera plugin yesterday that fix in Android. Any news to IPhone?
Camera 0.2.6 fixed issue on Android, still not for iOS.
I've been looking into this on iOS. From what I can tell the (deprecated) callback we're registering here doesn't get any EXIF metadata or orientation from the camera, it just gets raw pixels from the capture. There's a newer callback that contains metadata, but it's iOS 11.0+ only and the camera plugin supports 10.0+. I think unfortunately the solution here for at least 10.x is going to be to poll the accelerometer and save that like the plugin is already doing on the Android side. There's another iOS API that does get device orientation on demand, but similar to the Android equivalent it doesn't return the true device orientation when the UI is locked.
There is not a single behavior that is correct in all situations.
Sometimes I want the camera to follow rotation, sometimes I don't. It should be an option in the API.
For example if I am writing a photo taking app I might want to rotate my device to take a landscape photo so I want the camera to follow the rotation (camera locked to device orientation).
Another example is I am writing a kiosk and I want the camera to always be a certain orientation no matter how the device is oriented. (camera on a swivel always pointing up).
Hi @mklim ,
This is exactly what I need now and thanks for clarifying the root cause of the issue.
In Android, I receive all Exif data for the captured photo via both Camera
plugin (0.5.3+1) and Image_Picker
plugin (0.6.0+17) but on iOS I receive full Exif data only from Image_Picker
plugin, not the Camera
plugin.
Based on what you mentioned above, I know that the reason why we still receive the orientation data is related to your fix PR which has already merged.
What I really need is the full Exif data not only the orientation. Fortunately, my app's deploy target is iOS 11+ so I'm happy to use the new callback you mentioned above.
Is there any sample code related to that in Objective-C to be able to replace it with the current approach in the Camera plugin?
Is there any roadmap for fixing the issue to have full Exit data on iOS as well?
@RussellZornes sorry about the delay. Filed a feature request for controlling the camera orientation in #39071.
@iNima I filed a feature request for it at #39070. I don't think we have any sample code for this yet, but the general idea if you're patching this yourself would be to fork what the plugin is currently doing, then replace the current limited callback with the newer one. I think it would be straightforward, but I can't say for 100% sure since I haven't dug into it in detail myself yet.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
I'm trying the camera plugin v0.1.2 with the usage code from its example: https://github.com/flutter/plugins/blob/master/packages/camera/example/lib/main.dart
Now the problem i'm having.. If i change the device orientation, the camera preview doesn't follow so the shown picture are rotated to the left/right.
I can improve on this behaviour by disabling device orientation change through setting
SystemChrome.setPreferredOrientations
Now i always see the picture in correct orientation, but things like the app menu bar don't change and also the picture looking stretched in portrait mode.So is there a way or is it planned to control camera rotation/orientation !?