Save Camera Livestream to variable (without TextureView)
513 3 2023-2-12
Uploading and Loding Picture ...(0/1)
o(^-^)o
Andreas-Menzel
lvl.2

Germany
Offline

SDK: DJI Mobile SDK
Drone: DJI Phantom 4 Pro V2.0
Phone OS: Android 13
Development Software: Android Studio

I want to create an application that detects ArUco markers in the drones camera livestream.

I followed the FPVDemo; it worked. Now I want to restructure my code so it is consistent with the rest of the app:

I have created a DJIManager.java class that controls the drone through the Mobile SDK. It has functions like takeoff() or land() that communicate with the MSDK and manage error handling, etc. I would like to have the camera stuff in this class, too. This way the app can receive the livestream form any activity without having duplicate code.

In the FPVDemo the camera image seems to be directly sent to the TextureView. As I want to implement the camera stuff inside my own class (outside any activity), I don't have a TextureView, so I have to save the livestream (current frame) to a variable.
How can I do that? In the demo I can only see how that's done with the TextureView.

Thanks!

2023-2-12
Use props
Mats Bohlinsson
Second Officer
Flight distance : 1838077 ft
  • >>>
Sweden
Offline

Fastest and easist way is to keep the TextureView as it is, and save a jpg from the textureview.
2023-2-12
Use props
Andreas-Menzel
lvl.2

Germany
Offline

Mats Bohlinsson Posted at 2-12 07:50
Fastest and easist way is to keep the TextureView as it is, and save a jpg from the textureview.

But what if I want to change the activity? The livestream should be captured non-stop. When I use a TextureView, I have to implement the logic in the currently running activity, right? So I would have to implement it in every activity(?)
2023-2-12
Use props
Mats Bohlinsson
Second Officer
Flight distance : 1838077 ft
  • >>>
Sweden
Offline

Andreas-Menzel Posted at 2-12 07:56
But what if I want to change the activity? The livestream should be captured non-stop. When I use a TextureView, I have to implement the logic in the currently running activity, right? So I would have to implement it in every activity(?)

I never done it like that. I'm usually using overlays. I do most in python and overlayed webviews.

So you mean you don't want to show a live fpv view all the time? Sounds scary :-)

Of course, you can go the 264 encoding way, but keep in mind that the stream has to be patched, I think dji has some example for this. For patching they uses som undocumented stuff in the sdk and it differs from drone type. Never understood why they do it this way,

I think this is the example:
https://github.com/DJI-Mobile-SD ... treamdecodingsample
But this was slower on my system.

2023-2-12
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules