Skip to content
Android sample to obtain video from a DJI drone and transport that via WebRTC to a consumer
C C++ Java Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
gradle/wrapper 0.1.0 - add missing gradle properties Jun 3, 2019
jni
libs
.gitattributes 0.1.0 - initial Jun 3, 2019
.gitignore
README.md
build.gradle
gradle.properties 0.1.0 - initial Jun 3, 2019
settings.gradle 0.1.0 - initial Jun 3, 2019

README.md

Android Video Stream Decoding Sample

Introduction

This project is derived from the original DJI sample project Android-VideoStreamDecodingSample. It utilizes the Mobile DJI Drone SDK for Android and the Accuware DJI Streamer Lib in order to enable WebRTC video streaming from the drone's camera via an Android device to another WebRTC client, preferably but not exclusively the Accuware Dragonfly Java app.

For details regarding the DJI sample app please refer to the original Android-VideoStreamDecodingSample.

Prerequisites

You need to have:

  • a DJI drone with a Remote Control and an Android device running at least Android 7.
  • a DJI developer account.
  • a registered DJI SDK API key, you can use the original package name for registration (com.dji.videostreamdecodingsample). You need to configure this key in AndroidManifest.xml.
  • a credential consisiting of a user Id and a license key for being able to use the Accuware DJI Streamer Lib which brings WebRTC connectivity to the DJI drone . You can either contact our technical support for details or checkout the self-provisioning service at Accuware WebRTC Signalling Server.
  • a bit of Android developer skills and a recent version of Android Studio plus the Android SDK installed on your machine.
  • an Internet access.

What does this sample project do?

The sample demonstrates how to enable your Android device to be ready for incoming WebRTC calls from another party in order to forward the video from the connected drone in real-timeto a consumer. The other party can either use our Accuware WebRTC Signalling Server or the Accuware Dragonfly Java app via a GStreamer plugin. The easiest way for a first instant success it to use the Accuware WebRTC Signalling Server.

Whereas the ConnectionActivity.java class is widely the unchanged original, the MainActivity.java has been completely refactored. It now contains GLSurfaceView for displaying the decoded video and a Start button to enable WebRTC functionality.

On Start the app immediately begins to obtain H.264 from the drone's camera and displays the decoded YUV signal in the GLSurfaceView. In parallel it contacts a WebRTC signalling server, using the credential tuple (userId, licenseKey), which has been obtained earlier as described above. If the login process is successful, the app is ready for incoming calls, which can be issued by either the Accuware WebRTC Signalling Server or the Accuware Dragonfly Java app.

You can hangup and call again from remote, but once you hit Stop, the library respectively the Android app will not respond to calls anymore, until the next Start happens.

In case the colors displayed look weird, play a bit with the StreamerConfig.setYuvFormat() function. DJI has several variants of YUV 4:2:0 on the market. If the app reports an error regarding the Width/Height, you can manipulate the displayable width and height up to 2000 * 2000 using the StreamerConfig.setYuvWidth() and StreamerConfig.setYuvHeight() functions.

For details for the API provided by the Accuware DJI Streamer Lib please refer to the Accuware DJI Streamer Lib.

What are you supposed to do?

  • Clone this repository and open it in Android Studio.
  • Don't update the gradle version for this project if you are asked. Since - according to the DJI developer support - the original project cannot be compiled and run with targetSdkVersion > 27 and buildToolsVersion > 27.x.x it makes no sense to upgrade.
  • Provide your DJI SDK key in AndroidManifest.xml. The place is marked.
  • Provide your DJI Streamer Lib credential tuple in MainActivity.java. The place is marked.
  • Compile and install the app on your Android device, which is connected to the Remote Control of the drone via USB. It goes without saying, that all connected devices should be powered up. You cannot run this app on an emulator.
  • Once the app is installed, you will be asked whenever you plug the RC via USB, which application you would like to run. Choose this, but not as a permanent choice.
  • Follow the little tutorial above regarding the Start/Stop functionality.

Note

Since this app deals with some large files it might be necessary to checkout the statement regarding git lfs from the original sample Android-VideoStreamDecodingSample. We haven't found a real reason for this requirement, since the largest file is about 50 MB "only", but you never know.

Status

This application as well as the Accuware DJI Streamer Lib is beta and has been successfully tested on a DJI Mavic Pro and a DJI Spark.

You can’t perform that action at this time.