DJI-Mobile-SDK-Tutorials / iOS-FPVDemo

A demo to introduce how to implement the FPV view, take photo and record video using DJI Mobile SDK.
MIT License
37 stars 24 forks source link

DJI Mavic 2 Pro Feed not working after swapping from DJI Go #14

Open Anhtastic opened 5 years ago

Anhtastic commented 5 years ago

Hi,

I'm trying to run DJI SDK on my own app and it appears there's an edge case bug that I'm curious if you guys might be able to help me. It involves the DJI Mavic 2 not showing video feed in my app after swapping to DJI Go App.

Here are the steps to reproduce:

  1. Open my own app. At this pt, the video feed is working as expected.
  2. Open DJI Go App and have it open the video feed.
  3. Close DJI Go App.
  4. Close my app again and reopen it. At this pt, video feed does not work until I disconnect my app from remote controller and reconnect again.

I try DJIVideoPreviewer.instance()?.reset() but that did not work either. Curious if you guys can instruct me to the right place to change, that'd be greatly appreciated!

ynaka01-max commented 4 years ago

Did you solve the problem?

Anhtastic commented 4 years ago

Did you solve the problem?

Yes, after playing with a bunch of stuff, I managed to figure it out. It's not document anywhere on DJI.

You need to look into the app example code from DJI and see that they have these two files: VideoPreviewAdapter.swift and DecodeImageCalibrateLogic.swift. You will need to use these files to do something along these lines to your class:

var adapter: VideoPreviewerAdapter? let camera = DJISDKManager.product()?.camera if camera?.displayName == DJICameraDisplayNameMavic2ZoomCamera || camera?.displayName == DJICameraDisplayNameMavic2ProCamera { self.adapter = VideoPreviewerAdapter.init() self.adapter?.setupFrameControlHandler() }

There might be other stuff that I did in our codebase that I forgot, this ticket is kind of old :). However, this should be a good starting point for you. Hopefully that helps you :)