DJI-Mobile-SDK-Tutorials / Android-MediaManagerDemo

This demo is designed for you to learn how to use the MediaManager to interact with the file system on the SD card of the aircraft's camera. You can use it to preview photos, play videos, download or delete files and so on.
MIT License
25 stars 19 forks source link

Set cameraMode failed Execution of this process has timed out #8

Open Asendo316 opened 4 years ago

Asendo316 commented 4 years ago

Im trying to fetch media files from the drone using the same exact source code from this repository but been getting a timeout error on set camera mode execution.

this is my initMediaManager function

`public void initMediaManager() {

    if (AirSmatDJISDKIntegrationApplication.getProductInstance() == null) {
        refreshGallery.setRefreshing(false);
        mediaFileList.clear();
        mListAdapter.notifyDataSetChanged();
        connectDroneError.setVisibility(View.VISIBLE);
        emptyImagesList.setText("Drone Disconnected");
        DJILog.e(TAG, "Product disconnected");
        return;
    } else {
        if (null != AirSmatDJISDKIntegrationApplication.getCameraInstance() && AirSmatDJISDKIntegrationApplication.getCameraInstance().isMediaDownloadModeSupported()) {
            mMediaManager = AirSmatDJISDKIntegrationApplication.getCameraInstance().getMediaManager();
            if (null != mMediaManager) {
                mMediaManager.addUpdateFileListStateListener(this.updateFileListStateListener);
                mMediaManager.addMediaUpdatedVideoPlaybackStateListener(this.updatedVideoPlaybackStateListener);
                AirSmatDJISDKIntegrationApplication.getCameraInstance().setMode(SettingsDefinitions.CameraMode.MEDIA_DOWNLOAD, error -> {

                    if (error == null) {

                        DJILog.e(TAG, "Set cameraMode success");

                           // connectDroneError.setVisibility(View.GONE);

                            //refreshGallery.setRefreshing(false);

                        showProgressDialog();

                        getFileList();

                    } else {

                        setResultToToast("Set cameraMode failed");
                        DJILog.e(TAG, "Set cameraMode failed "+ error);

                    }
                });
                if (mMediaManager.isVideoPlaybackSupported()) {
                    DJILog.e(TAG, "Camera support video playback!");
                } else {
                    setResultToToast("Camera does not support video playback!");
                }
                scheduler = mMediaManager.getScheduler();
            }

        } else if (null != AirSmatDJISDKIntegrationApplication.getCameraInstance()
                && !AirSmatDJISDKIntegrationApplication.getCameraInstance().isMediaDownloadModeSupported()) {
            setResultToToast("Media Download Mode not Supported");
        }
    }
    return;
}

`

What to do please ?

dji-dev commented 4 years ago

Agent comment from William Wong in Zendesk ticket #33681:

Dear Client Thank you for contacting DJI.

The code seems alright. The MEDIA_DOWNLOAD mode is not supported by X5 camera nor X5R camera while mounted on aircraft. Also please check whether the camera module is working properly. Please note that you cannot change the mode when a certain task is executing, such as taking photo(s), recording video, or downloading and saving files.

Hopefully our solution can help you. Kindly Regards, DJI Developer Support

tapioko commented 4 years ago

I have the same problem. I used the code from this repository without modifications (only changed api key and package names, of course). DJI Pilot app can get the file list.

Value of currentFileListState is RESET before calling refreshFileListOfStorageLocation.

Formatting SD card didn't help.

Drone is Mavic 2 Enterprise Dual. Android Studio is 4.0.

Here are some logs: 2020-06-05 15:08:55.818 31972-32016/my.package E/my.package.MainActivity: Set cameraMode success 2020-06-05 15:09:05.823 31972-32368/my.package E/DJIFileListLoader: 10000ms内没有数据hit 重传 seq=0, timeoutCount=1 2020-06-05 15:09:15.826 31972-32368/my.package E/DJIFileListLoader: 10000ms内没有数据hit 重传 seq=0, timeoutCount=2 2020-06-05 15:09:25.828 31972-32368/my.package E/DJIFileListLoader: DJI loader timeout