/** * Before the playback commands are sent to the aircraft, the camera work mode should be set to * playback mode. */ @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); if (DJIModuleVerificationUtil.isCameraModuleValid()) { mCamera = DJISampleApplication.getAircraftInstance().getCamera(); mCamera.setCameraMode( DJICameraSettingsDef.CameraMode.Playback, new DJIBaseComponent.DJICompletionCallback() { @Override public void onResult(DJIError djiError) {} }); if (DJIModuleVerificationUtil.isPlaybackValid()) { mPlaybackManager = mCamera.getPlayback(); mPlaybackManager.setDJICameraPlayBackStateCallBack( new DJIPlaybackManager.DJICameraPlayBackStateCallBack() { @Override public void onResult( DJIPlaybackManager.DJICameraPlaybackState djiCameraPlaybackState) { if (djiCameraPlaybackState.playbackMode.equals( DJICameraSettingsDef.CameraPlaybackMode.SinglePhotoPlayback)) mPlaybackManager.enterMultiplePreviewMode(); if (djiCameraPlaybackState.playbackMode.equals( DJICameraSettingsDef.CameraPlaybackMode.MultipleMediaFilesDisplay)) mPlaybackManager.enterMultipleEditMode(); } }); } } }
@Override protected void getBtn1Method() { if (DJIModuleVerificationUtil.isPlaybackValid()) { mPlaybackManager = DJISampleApplication.getProductInstance().getCamera().getPlayback(); mPlaybackManager.toggleFileSelectionAtIndex(0); } }
@Override protected void getBtn3Method() { // Download Button if (DJIModuleVerificationUtil.isPlaybackValid()) { mPlaybackManager = DJISampleApplication.getProductInstance().getCamera().getPlayback(); File destDir = new File(Environment.getExternalStorageDirectory().getPath() + "/Dji_Sdk_Test/"); mPlaybackManager.downloadSelectedFiles( destDir, new DJIPlaybackManager.CameraFileDownloadCallback() { @Override public void onStart() { Message message = Message.obtain(); message.obj = "Start"; messageHandler.sendMessage(message); } @Override public void onEnd() {} @Override public void onError(Exception e) { Message message = Message.obtain(); message.obj = e.toString(); messageHandler.sendMessage(message); } @Override public void onProgressUpdate(int i) { Message message = Message.obtain(); message.obj = "Progress: " + i; messageHandler.sendMessage(message); } }); } }