Mini 4 pro pullMediaFileListFromCamera gives fatal error.
Hello, developers.
I am using MINI 4 PRO (V01.00.0800) with RC-N2 (V01.01.0300).
When starting the main activity of my app built on msdk v5.15,
I try to set storage location to sd card using my function below.
private void setStorageLocationToSDCard(@Nullable Runnable onSuccess, @Nullable Runnable onFailure) {
MediaFileListDataSource dataSource = new MediaFileListDataSource.Builder().setLocation(CameraStorageLocation.SDCARD).build();
mediaManager.setMediaFileDataSource(dataSource);
mediaManager.enable(new CommonCallbacks.CompletionCallback() {
@Override
public void onSuccess() {
logMessageDJI("[MediaManager] enable() succeeded.");
// Check current state
mediaFileListState = mediaManager.getMediaFileListState();
logMessageDJI("Current mediaFileListState after enable: " + mediaFileListState);
// If it's IDLE, we can immediately pull
if (mediaFileListState == MediaFileListState.IDLE) {
PullMediaFileListParam param = new PullMediaFileListParam.Builder().build();
mediaManager.stopPullMediaFileListFromCamera();
Log.d("UserMainActivity", "pullMediaFileListFromCamera() CALLING");
mediaManager.pullMediaFileListFromCamera(param, new CommonCallbacks.CompletionCallback() {
@Override
public void onSuccess() {
mediaManager.disable(new CommonCallbacks.CompletionCallback() {
@Override
public void onSuccess() {
Log.d("UserMainActivity", "MediaManager disabled.");
if (onSuccess != null) onSuccess.run();
}
@Override
public void onFailure(@NonNull IDJIError error) {
Log.e("UserMainActivity", "Failed to disable MediaManager: " + error);
if (onSuccess != null) onSuccess.run();
}
});
mediaManager.removeAllMediaFileListStateListener();
}
@Override
public void onFailure(@NonNull IDJIError error) {
runOnUiThread(() -> showWarningDialog("SD카드가 없습니다!!", null));
mediaManager.disable(new CommonCallbacks.CompletionCallback() {
@Override
public void onSuccess() {
Log.d("UserMainActivity", "MediaManager disabled.");
if (onFailure != null) onFailure.run();
}
@Override
public void onFailure(@NonNull IDJIError error) {
Log.e("UserMainActivity", "MediaManager disabled.");
if (onFailure != null) onFailure.run();
}
});
mediaManager.removeAllMediaFileListStateListener();
}
});
} else {
mediaManager.disable(new CommonCallbacks.CompletionCallback() {
@Override
public void onSuccess() {
Log.d("UserMainActivity", "MediaManager disabled.");
if (onFailure != null) onFailure.run();
}
@Override
public void onFailure(@NonNull IDJIError error) {
Log.e("UserMainActivity", "Failed to disable MediaManager: " + error);
if (onFailure != null) onFailure.run();
}
});
mediaManager.removeAllMediaFileListStateListener();
}
}
@Override
public void onFailure(@NonNull IDJIError error) {
logMessageDJI("[MediaManager] enable() failed: " + error);
runOnUiThread(() -> showWarningDialog("SD카드가 인식되지 않습니다!!", null));
if (onFailure != null) onFailure.run();
}
});
}
- I set mediaManager.setMediaFileDataSource(dataSource);
- I also test that I can pull media list from sdcard or not.
- called enable() function first
- when success, I check if the media file list state is IDLE,
- if IDLE, I pull media file list from camera.
But, here whenever I start the mainActivity, I got this log,
[MediaManager] enable() succeeded.
Current mediaFileListState after enable: IDLE
meaning that the process is normal. but right after I call pullMediaFileListFromCamera,
I get this fatal error.
Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 12502 (Thread-6), pid 12409 (ue.myapp)
Cmdline: com.myapp.auca
pid: 12409, tid: 12502, name: Thread-6 >>> sq.rogue.rosettadrone <<<
#05 pc 0000000001b6bd08 /data/app/~~putZcD3Vko8HLcpttS6PAA==/com.myapp.auca-bYbjIu2fhghaMqC4NyZw3Q==/lib/arm64/libdjisdk_jni.so
#06 pc 0000000001b7b33c /data/app/~~putZcD3Vko8HLcpttS6PAA==/com.myapp.auca-bYbjIu2fhghaMqC4NyZw3Q==/lib/arm64/libdjisdk_jni.so
#07 pc 0000000001b62364 /data/app/~~putZcD3Vko8HLcpttS6PAA==/com.myapp.auca-bYbjIu2fhghaMqC4NyZw3Q==/lib/arm64/libdjisdk_jni.so
#08 pc 0000000001b6614c /data/app/~~putZcD3Vko8HLcpttS6PAA==/com.myapp.auca-bYbjIu2fhghaMqC4NyZw3Q==/lib/arm64/libdjisdk_jni.so
#09 pc 0000000001b64e54 /data/app/~~putZcD3Vko8HLcpttS6PAA==/com.myapp.auca-bYbjIu2fhghaMqC4NyZw3Q==/lib/arm64/libdjisdk_jni.so
#10 pc 00000000033a14fc /data/app/~~putZcD3Vko8HLcpttS6PAA==/com.myapp.auca-bYbjIu2fhghaMqC4NyZw3Q==/lib/arm64/libdjisdk_jni.so
#11 pc 00000000033a5bbc /data/app/~~putZcD3Vko8HLcpttS6PAA==/com.myapp.auca-bYbjIu2fhghaMqC4NyZw3Q==/lib/arm64/libdjisdk_jni.so
#12 pc 00000000011213cc /data/app/~~putZcD3Vko8HLcpttS6PAA==/com.myapp.auca-bYbjIu2fhghaMqC4NyZw3Q==/lib/arm64/libdjibase.so
#13 pc 000000000125a854 /data/app/~~putZcD3Vko8HLcpttS6PAA==/com.myapp.auca-bYbjIu2fhghaMqC4NyZw3Q==/lib/arm64/libdjibase.so
#14 pc 000000000125b110 /data/app/~~putZcD3Vko8HLcpttS6PAA==/com.myapp.auca-bYbjIu2fhghaMqC4NyZw3Q==/lib/arm64/libdjibase.so
#15 pc 0000000001125c2c /data/app/~~putZcD3Vko8HLcpttS6PAA==/com.myapp.auca-bYbjIu2fhghaMqC4NyZw3Q==/lib/arm64/libdjibase.so
Why is this problem happening?? DJI FLY just work fine though.
One more note.
I am suspicious of one aspect, which is the file system of the sdcard.
The sdcard storage folder structure of mini 4 pro should look like this.
DCIM
| -- DJI_001
| -- video.mp4
| -- DJI_002
...
But when I have the problem I described above, I only have DJI_001.
At the same time when I see DJI FLY app, settings -> camera -> storage -> folder name settings, I see DJI_002.
But, again when I record video in DJI FLY, the new video is still saved in DJI_001.
So, I cautiously think, that the system is preventing the generation of DJI_002 folder, and making the error.
- Then what is the criteria of DJI drone generating new folder in sdcard?
- Can any problem prevent from generating the folder?
- So, the problem of this issue is actually related to this situation??
Agent comment from YIGUI LIU in Zendesk ticket #161278:
Dear Developer,
When calling setMediaFileDataSource, you need to pass the MediaFileListDataSource parameter correctly, including setting setStorageLocation and setComponentIndexType. For the Mini 4 Pro, set setComponentIndexType to LEFT_OR_MAIN.
After calling enable(), you can use CameraKey.KeyIsPlayingBack to confirm whether the camera has entered playback mode.
Finally, regarding the parameters for calling pullMediaFileListFromCamera, it should be noted that the Mini 4 Pro does not support setting a filter (such as MediaFileFilter.PHOTO) to filter specific media types. It can only pull all types using ALL.
We have tested the function in the MSDK sample app (path: MSDK sample app => Testing Tools => Media Playback) and confirmed that media files can be pulled normally.
- You can run the sample app to test: https://developer.dji.com/doc/mobile-sdk-tutorial/en/quick-start/run-sample.html
- Implementation code for the relevant function: https://github.com/dji-sdk/Mobile-SDK-Android-V5/blob/dev-sdk-main/SampleCode-V5/android-sdk-v5-sample/src/main/java/dji/sampleV5/aircraft/pages/MediaFragment.kt
The file system of the SD card is determined by the aircraft firmware. The MSDK cannot affect it, nor can it obtain the corresponding storage directory or modify the naming of media files generated by the Mini 4 Pro.
Best Regards,
DJI Innovations SDK Technical Support Team
°°°
Thanks for the detailed instruction. But I think the problem is coming how the dji firmware handle the sdcard storage.
Because I have done some experiments. Everytime the problem occurs, is the moment that the number of video exceeds 33.
When deleting some videos in the sdcard, the problem is gone. and again after taking some.videos and exceeds 33 videos, the problem occurs again.
This is not happening in DJI fly. But one still.suspicious thing is that the folder name designated in the camera setting in DJI fly is "DJI_002", despite there is only "DJI_001" inside the sdcard at that time.
Agent comment from YIGUI LIU in Zendesk ticket #161278:
Dear Developer,
The error reported by the pullMediaFileListFromCamera interface is usually related to the performance of the SD card itself, or as mentioned in the previous reply, related to the parameter settings before pulling. You can test in the MSDK sample app to see if the issue can be reproduced.
Furthermore, the DJI Fly APP itself does not actually integrate MSDK, and we are not aware of its implementation method. Therefore, regarding issues with the DJI Fly APP and the aircraft firmware, you can feedback to the corresponding product support team at: [email protected]
Best Regards,
DJI Innovations SDK Technical Support Team
°°°