DJI-Mobile-SDK-Tutorials / Android-FPVDemo

This demo shows how to create a simple FPV view and how to take photo and record video using DJI Mobile SDK.
MIT License
62 stars 81 forks source link

Does this work with the N1 Video Encoder #12

Closed andymac4182 closed 7 years ago

andymac4182 commented 8 years ago

Hi,

I am unable to get this working with the N1 Video Encoder. Has anyone got that working or is that just for the Go App?

Cheers, Andrew

oliverou commented 8 years ago

Hi! Currently, the FPVDemo doesn't support N1 Video Encoder. The video data could be obtained by setting setDJIOnReceivedVideoCallback in LBAirlink of Airlink for M100 with N1 decoder. We may update the FPVDemo to support it in the future update.

andymac4182 commented 8 years ago

Thanks :) Any chance of this demo being published to the store so people can have a look at the compiled output?

oliverou commented 8 years ago

Since it's a simple demo without good UI design and friendly user interaction, we won't publish the demo application to store, you can easily download the sample code, fill in the App Key and build and run on your Android device. Then connect the application to DJI Product to view the live video. It's that easy.

andymac4182 commented 8 years ago

I haven't dealt with Android or the DJI SDK before. I believe my changes are right. Only if you have spare time can you please confirm them. If so I can submit a PR :) https://github.com/DJI-Mobile-SDK/Android-FPVDemo/compare/master...andymac4182:lightbridge?expand=1

oliverou commented 8 years ago

Hi, I suggest to modify the initPreviewer() method as shown below:

private void initPreviewer() {

        DJIBaseProduct product = FPVDemoApplication.getProductInstance();

        if (product == null || !product.isConnected()) {
            showToast(getString(R.string.disconnected));
        } else {
            if (null != mVideoSurface) {
                mVideoSurface.setSurfaceTextureListener(this);
            }
            if (!product.getModel().equals(Model.UnknownAircraft)) {
                DJICamera camera = product.getCamera();
                if (camera != null){
                    // Set the callback
                    camera.setDJICameraReceivedVideoDataCallback(mReceivedVideoDataCallBack);
                }else if(product.getModel().equals(Model.Matrice_100)){ //Add the product checking here
                    product.getAirLink().getLBAirLink().setDJIOnReceivedVideoCallback(mReceivedVideoDataCallBackLightbridge);
                }
            }
        }
    }

For others are fine. Hope this help.

andymac4182 commented 8 years ago

Ahh. We are using the N1 on an Inspire so wasn't sure if that would work. I will have a play around to see what happens.

oliverou commented 8 years ago

Yes, N1 Video Encoder is only used on M100, for more info, please check the DJI Website: https://store.dji.com/product/n1-video-encoder

dji-dev commented 7 years ago

Since this issue has been solved, I will close it then.