dji-sdk / Mobile-SDK-Android

DJI Mobile SDK for Android: http://developer.dji.com/mobile-sdk/
Other
972 stars 579 forks source link

VideoFeed No Data callbacks #437

Open milkywayriver opened 4 years ago

milkywayriver commented 4 years ago

after call addVideoDataListener, sometimes there was no data callback... and after a while, the log print an error:

E/DJICameraInspire2Abstraction: update support key failed! retry=8

but in sometimes, everything was ok. this log was not printed.

these are my code:

    fun startVideoFeed(idx:Int):Observable<VideoBuf>{
        var listener:VideoFeeder.VideoDataListener? = null
        var vf:VideoFeeder.VideoFeed? = null

        Timber.i("startVideoFeed called.idx:$idx, version:${BuildConfig.VERSION_NAME}")
        return Observable.create<VideoBuf> { e->
            val vfr = VideoFeeder.getInstance()
            var videoSource = if (idx == 0 ) UsbAccessoryService.VideoStreamSource.Camera.index else UsbAccessoryService.VideoStreamSource.Fpv.index
            var vf = if (idx == 0 ) vfr.primaryVideoFeed else vfr.secondaryVideoFeed
            listener = VideoFeeder.VideoDataListener { bytes, i ->
                e.onNext(VideoBuf(bytes, i, videoSource))
            }
            val success = vf.addVideoDataListener(listener!!)
            if (!success){
                e.onError(IllegalStateException("addVideoDataListener failed!"))
            }else{
                Timber.i("addVideoDataListener, ok waiting for callbacks.")
            }
        }.doOnDispose {
            Timber.i("startVideoFeed disposed, remove callback.")
             vf?.removeVideoDataListener(listener)
         }
    }

could you tell me what's wrong.?

milkywayriver commented 4 years ago

sdk version:

    implementation 'com.android.support:multidex:1.0.2'
    implementation 'com.squareup:otto:1.3.8'
    implementation ('com.dji:dji-sdk:4.10', {
//             Uncomment the following line if your app does not need Anti Distortion for
//             Mavic 2 Pro and Mavic 2 Zoom. It will greatly reducing the size of the APK:
        exclude module: 'library-anti-distortion'
//             Uncomment the following line if your APP does not need network RTK
        exclude module: 'library-networkrtk-helper'
    })
    compileOnly 'com.dji:dji-sdk-provided:4.10'
milkywayriver commented 4 years ago

I also try the demo,i see the same issue occasionally.

dji-dev commented 4 years ago

Public comment from Luce Luo in Zendesk ticket #27699:

Dear Customer,

Thank you for contacting DJI. To help us collect questions in detail, please fill in the form below and we will handle this ticket once we have received it. https://formcrafts.com/a/dji-developer-feedback-en

Thanks,

Luce Luo DJI Dev Team