Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
oleg_derevenetz
Posts: 23
Registered: ‎06-28-2012
My Device: Z10, Q10
My Carrier: Beeline
Accepted Solution

QML Camera orientation issue

Hi,

 

While using QML Camera element in my app, I faced the following issue - on Z10 device it always makes photo in landscape orientation, even if device is in portrait. As I know, QML Camera element should deal with device orientation by itself, and it even doesn't have any methods or properties to control it. All other on-screen elements (like navigation pane) have correct placement for current device orientation (as for navigation pane, it is always on the bottom of the screen). The sample code looks like this:

 

import bb.cascades 1.0
import bb.cascades.multimedia 1.0
import bb.multimedia 1.0

Page {
    id:         cameraPage
    objectName: "cameraPage"

    onCreationCompleted: {
        OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.CurrentLocked;
    }

    paneProperties: NavigationPaneProperties {
        backButton: ActionItem {
            onTriggered: {
                navigationPane.pop();
            }
        }
    }

    Container {
        background: Color.Black

        Camera {
            id: camera

            onCreationCompleted: {
                if (allCamerasAccessible) {
                    open(CameraUnit.Rear);
                }
            }

            onCameraOpened: {
                getSettings(cameraSettings);

                cameraSettings.flashMode = CameraFlashMode.Off;
                cameraSettings.focusMode = CameraFocusMode.ContinuousAuto;

                applySettings(cameraSettings);

                startViewfinder();
            }

            onTouch: {
                if (event.touchType === TouchType.Down) {
                    capturePhoto();
                }
            }

            onPhotoCaptured: {
                shutterSound.play();
            }

            attachedObjects: [
                CameraSettings {
                    id: cameraSettings
                },
                SystemSound {
                    id:    shutterSound
                    sound: SystemSound.CameraShutterEvent
                }
            ]
        }
    }
}

 

 

I looked for similar issues in Issue Navigator, and found the following issue:

 

https://www.blackberry.com/jira/browse/BBTEN-249

 

It is somewhat similar to mine, but it is marked as fixed in Dev Alpha OS 10.0.09, while this issue is observed in 10.1.0.273 on Z10.

 

What could cause this, except for firmware issue? Should I somehow change camera orientation by hand? How can I perform this for QML Camera element?

 

Thanks in advance for your help.

 

Please use plain text.
BlackBerry Development Advisor
tolang
Posts: 47
Registered: ‎04-19-2013
My Device: I love them all!
My Carrier: Carriers rock!

Re: QML Camera orientation issue

[ Edited ]

One thing you might check is the orientation the camera believes itself to be in:

 

            // Obtain the camera orientation
            DisplayDirection::Type cameraDirection = _camera->devicePreviewFrameDirection();

 

 

 

If it's not reporting the correct value, that could be something we could look at.

Please use plain text.
Contributor
oleg_derevenetz
Posts: 23
Registered: ‎06-28-2012
My Device: Z10, Q10
My Carrier: Beeline

Re: QML Camera orientation issue

Thanks tolang, I'll try to perform some debugging once I finally get my Limited Edition device. This issue was observed on customer's device, and all I have is a bugreport with screenshots. Currently all I have is Dev Alpha C, which, as I understand, doesn't support orientation changes, it's always locked in portrait mode (or is it? May be there is still some way to unlock orientation changes?). As for emulator, it doesn't support camera, so it is totally useless in my case.

 

Please use plain text.
Retired
PBernhardt
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: QML Camera orientation issue

The different flavours of Z10 (and any future devices) can handle rotation in different ways. Some will actually rotate the image for you, some will just tag the resulting jpeg with some EXIF data that indicates the desired orientation of the image. Not all image viewers support EXIF rotation.

 

Also, currently on the Z10 the image rotation is locked to the device orientation. So if the user locks the app into portrait mode, all their pictures will be tagged as if the device was held upright in portrait mode unless you do some tracking work with the gyro/accelerometer and then rotate the image yourself. You'll note this even in the built in camera app. This is currently a known limitation.

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Please use plain text.
Contributor
oleg_derevenetz
Posts: 23
Registered: ‎06-28-2012
My Device: Z10, Q10
My Carrier: Beeline

Re: QML Camera orientation issue

PBernhardt,

 

The different flavours of Z10 (and any future devices) can handle rotation in different ways. Some will actually rotate the image for you, some will just tag the resulting jpeg with some EXIF data that indicates the desired orientation of the image. Not all image viewers support EXIF rotation.

 

 Thanks, it looks like that's was the case. I received original JPEG files from customer, and it turns out that they just have EXIF Orientation tag with corresponding rotation angle. I added necessary libexif-based code to rotate resulting images by hand if necessary.

 

Please use plain text.
Contributor
bbkeeper
Posts: 41
Registered: ‎04-27-2010
My Device: Z10
My Carrier: VIettel

Re: QML Camera orientation issue

And also when user does Lock Rotation to device via Top Menu Settings, We need to do more work to detect the true Camera Orientation at the time the photo is taken. Thanks Paul.
---
More applications/games here: http://appworld.blackberry.com/webstore/vendor/14299/
louis.keeper@gmail.com
haitt@viethop.net
http://blackberryvietnam.net
http://viethop.com
Please use plain text.