dji-sdk / Mobile-SDK-Android-V5

MSDK V5 Sample
Other
247 stars 126 forks source link

Take Photo not working any more - last Release #367

Open antonymarion opened 2 weeks ago

antonymarion commented 2 weeks ago

Hi Dji,

Take photo used to work and does not work any more on mini 3 Pro.

dji-dev commented 2 weeks ago

Agent comment from yating.liao in Zendesk ticket #109568:

Are you referring to the inability to take photos in version 5.9.1? I can confirm that the sample code I used for version 5.9.1 allows for taking photos without any issues. Could you please verify if the storage address matches the address for retrieving files?

°°°

antonymarion commented 2 weeks ago

Did you tried using the following code on a mini 3 Pro?


 var callback = object : CommonCallbacks.CompletionCallback {
                                    override fun onSuccess() {
                                        Log.i("PHOTO", "take photo success")
                                        ToastUtils.showToast("take photo success")
                                    }

                                    override fun onFailure(error: IDJIError) {
                                        Log.e(
                                                "PHOTO",
                                                "take photo failed: " + error.description()
                                        )
                                        ToastUtils.showToast("take photo failed")
                                    }
                                }

                                RxUtil.setValue(
                                        createKey<CameraMode>(
                                                CameraKey.KeyCameraMode
                                        ), CameraMode.PHOTO_NORMAL
                                )
                                        .andThen(RxUtil.performActionWithOutResult(createKey(CameraKey.KeyStartShootPhoto)))
                                        .subscribe({ CallbackUtils.onSuccess(callback) }) { throwable: Throwable ->
                                            CallbackUtils.onFailure(
                                                    callback, (throwable as RxError).djiError
                                            )
                                        }
dji-dev commented 1 week ago

Agent comment from yating.liao in Zendesk ticket #109568:

It is not recommended to start shooting immediately after switching camera modes. You need to make sure that the camera has actually switched to photo mode, which means you should start taking photos only after listening for the KeyCameraMode to change to PHOTO_NORMAL.

°°°

antonymarion commented 1 week ago

OK but ... andThen is waiting for the PHOTO_NORMAL camera mode to be actually set...

So why should I wait again, and if I should wait again, how much should I wait..

that is not intended, isn't it?

Apart from if you are meaning that the promise returned by set PHOTO_NORMAL is returned whereas it is not ready yet..

=> That would explained the bug

dji-dev commented 1 week ago

Agent comment from yating.liao in Zendesk ticket #109568:

This may be related to the meaning of the callback in performAction. The successful callback of performAction means that the command has been successfully sent to the executing object, without considering the execution result of the object. The reason for this design is that through the callback, you can know whether the executing object can be executed, and you can flexibly combine other listeners to determine the execution result. The performAction waits for the device to complete the execution before returning the result, which may be a blocking action.

°°°

dji-dev commented 1 week ago

Agent comment from yating.liao in Zendesk ticket #109568:

The waiting time is not very long. Are you currently looking to set a fixed time? You can try 0.5 or 1 second.

°°°

antonymarion commented 1 week ago

Nope, I will not put fixed value for timing like this because it is error prone and will surely cause regression depending on the execution context...

I want a real promise like logic where 'then' keyword is triggered after the action has been done.

dji-dev commented 1 week ago

Agent comment from yating.liao in Zendesk ticket #109568:

If you need a logic, it seems that we have already mentioned the corresponding method in our previous communication. After completing the setup, set a listener for KeyCameraMode to receive the situation where the camera has successfully switched to photo mode.

°°°

antonymarion commented 1 week ago

I think there is more issue on Mini 3 Pro..

The crash for instance on the sample app is very annoying (more important)and does not ease testing..

I will keep this ticket opened and test it again once you will have fixed the crash issue 😀

This morning it crashed continuously and was so instable. And sometimes it is not crashing...

dji-dev commented 1 week ago

Agent comment from yating.liao in Zendesk ticket #109568:

Could you provide us with crash logs if a crash occurs? This will help us quickly identify the issue you are experiencing.

°°°

antonymarion commented 1 week ago

Sure, as soon as I can, I will provide you all the infos :)

dji-dev commented 1 week ago

Agent comment from yating.liao in Zendesk ticket #109568:

Thank you for your understanding. I will wait for your reply.

°°°