Android Question dji set camera orientation not working

shb777

Active Member
Licensed User
Longtime User
I'm trying to rotate the camera to portrait mode and it's not working. The Mavic Pro has this capability.

B4X:
Sub SetOrientation
  
    Dim cc As Object
    cc= CameraInstance.CreateEventFromUI("dji.common.util.CommonCallbacks$CompletionCallback", "callback", Null)

    Labelssc.Text=" camerainstance is " & CameraInstance
    Sleep(5000)
    CameraInstance.RunMethod("SetOrientation",Array("PORTRAIT" , cc))   ' crashing program
  
    Wait For (CameraInstance) Callback_Event (MethodName As String, Args() As Object)
    If Args(0) = Null Then
        Labelssc.Text="Rotated Gimbal"
    Else
        Labelssc.Text="Failed to rotate gimbal: " & Args(0)
    End If
  
    Sleep(5000)

End Sub

It does nothing and crashes the program.
 

shb777

Active Member
Licensed User
Longtime User
You should check the logs and post the error message.
are there any logs when i'm not connected to the computer? it seems like the callback event is never being called. would that crash the program?
 
Upvote 0

shb777

Active Member
Licensed User
Longtime User
When the camera is in portrait mode, the video is shown horizontally .ie so someone standing is shown like they are laying down. I want to rotate the video on my tablet 90 degree clockwise, so the person looks like he's standing. is there any way to do this? my tablet is in portrait mode in the
remote control.
 
Upvote 0

shb777

Active Member
Licensed User
Longtime User
I realized that if I change my screen orientation to landscape, it would achieve the above objective. But when I do that, I lose the video from the drone.
 
Upvote 0

shb777

Active Member
Licensed User
Longtime User
I'm trying to get a portrait video window to fill up the entire tablet. But no matter what I do, the video size doesn't change.



B4X:
If Orientation = "LANDSCAPE" Then
  
        Orientation = "PORTRAIT"
        SetOrientation
        Sleep(5000)
        Shield.SetScreenOrientation(0)  ' landscape
      
        pnlCamera.RemoveAllViews
        Sleep(3000)
        pnlCamera.Width=300
        pnlCamera.Left=0
        pnlCamera.Height=400
        pnlCamera.Top=0
        pnlCamera.BringToFront
        Sleep(3000)
        pnlCamera.AddView(camera.CreateVideoView, 0, 0, pnlCamera.Width, pnlCamera.Height)
  
    Else


this makes the video orientation the way I want it, but doesn't change it's size
 
Upvote 0
Top