DJI Mobile SDK Documentation

      class MediaManager

      class MediaManager implements DJIParamAccessListener
      Package:dji.sdk.media
      Description:

      The media manager is used to interact with the file system on the SD card or the internal storage. By using the media manager, the user can get the metadata for all the multimedia files, and has access to each individual multimedia file.

      Class Members:
      method addMediaUpdatedVideoPlaybackStateListener
      void addMediaUpdatedVideoPlaybackStateListener(VideoPlaybackStateListener callback)
      Package:dji.sdk.media
      Description:

      Sets the callback object for updating the video playback state of the media manager.

      Input Parameters:
      VideoPlaybackStateListener callbackcallback object of updating the vision detection state.
      method getScheduler
      FetchMediaTaskScheduler getScheduler()
      Package:dji.sdk.media
      Description:

      Fetch media task scheduler. This can be used to queue the download of the previews, thumbnails and XML custom data from multiple media files.

      Return:
      FetchMediaTaskSchedulerAn object of FetchMediaTaskScheduler.
      method getSDCardFileListState
      @NonNull
      FileListState getSDCardFileListState()
      Package:dji.sdk.media
      Description:

      The file list state of the SD card.

      Return:
      FileListStateAn enum value of FileListState.
      method getSDCardFileListSnapshot
      @Nullable
      List<MediaFile> getSDCardFileListSnapshot()
      Package:dji.sdk.media
      Description:

      Returns a copy of the current file list on the SD card after you call refreshFileListOfStorageLocation. Returns null if getSDCardFileListState is reset.

      Return:
      List<MediaFile>An array of MediaFile objects.
      method getInternalStorageFileListState
      @NonNull
      FileListState getInternalStorageFileListState()
      Package:dji.sdk.media
      Description:

      The file list state of the internal storage.

      Return:
      FileListStateAn enum value of FileListState.
      method getInternalStorageFileListSnapshot
      @Nullable
      List<MediaFile> getInternalStorageFileListSnapshot()
      Package:dji.sdk.media
      Description:

      Returns a copy of the current file list on the internal storage after you call refreshFileListOfStorageLocation. Returns nil if getInternalStorageFileListState is reset or unknown.

      Return:
      List<MediaFile>An array of MediaFile objects.
      method refreshFileListOfStorageLocation
      void refreshFileListOfStorageLocation(SettingsDefinitions.StorageLocation storageLocation,
      CompletionCallback callback)
      Package:dji.sdk.media
      Description:

      Refreshes the file list of the storage. If the current state is RESET, the media manager will try to fetch the complete file list. If the current state is INCOMPLETE, the media manager will only fetch the missing list of files. If the file list is refreshed successfully, the corresponding file list state (either getSDCardFileListState or getInternalStorageFileListState) will become UP_TO_DATE.

      Input Parameters:
      SettingsDefinitions.StorageLocation storageLocationThe storage location of the file list to refresh.
      CompletionCallback callbackCompletion callback to receive the result.
      method deleteFiles
      void deleteFiles(@NonNull final List<MediaFile> files,
      final CompletionCallbackWithTwoParam<List<MediaFile>, DJICameraError> callback)
      Package:dji.sdk.media
      Description:

      Delete media files from storages. If the operation is started successfully, FileListState will become DELETING. If there is error or "failedFiles" is not empty, FileListState will become RESET.

      Input Parameters:
      @NonNull final List<MediaFile> filesA list of MediaFile objects.
      final CompletionCallbackWithTwoParam<List<MediaFile>, DJICameraError> callbackA completion callback of CompletionCallbackWithTwoParam<List<MediaFile>.
      Download
      method
      method exitMediaDownloading
      void exitMediaDownloading()
      Package:dji.sdk.media
      Description:

      This will entirely stop the downloading process and of course clean the downloading thread pool. The camera will exit the MEDIA_DOWNLOAD mode and enter the SHOOT_PHOTO mode.

      Precondition:
      The camera enters the MediaDownload mode.


      Post Condition:
      After this function invoked, the camera mode will shift to TAKEPHOTO mode.

      method addUpdateFileListStateListener
      void addUpdateFileListStateListener(@NonNull FileListStateListener listener)
      Package:dji.sdk.media
      Description:

      Start listen to the update of file list state.

      Input Parameters:
      @NonNull FileListStateListener listenerA FileListStateListener interface.
      method addUpdateStorageLocationListener
      void addUpdateStorageLocationListener(@NonNull SettingsDefinitions.StorageLocation storageLocation,
      @NonNull FileListStateListener listener)
      Package:dji.sdk.media
      Description:

      Start listen to the update of file list state.

      Input Parameters:
      @NonNull SettingsDefinitions.StorageLocation storageLocationThe storage location of the file list.
      @NonNull FileListStateListener listenerA FileListStateListener interface.
      Remove listener
      method
      method removeFileListStateCallback
      void removeFileListStateCallback(@NonNull FileListStateListener listener)
      Package:dji.sdk.media
      Description:

      Stop listen to the update of file list state.

      Input Parameters:
      @NonNull FileListStateListener listenerA FileListStateListener interface.
      Video Playback
      method
      method isVideoPlaybackSupported
      boolean isVideoPlaybackSupported()
      Package:dji.sdk.media
      Description:

      Checks if the media manager supports video playback or not. @return true if the media manager supports video playback.

      Return:
      booleantrue if the media manager supports video playback.
      method playVideoMediaFile
      void playVideoMediaFile(@NonNull MediaFile videoMediaFile, @Nullable final CompletionCallback callback)
      Package:dji.sdk.media
      Description:

      Start video playback through MediaManager. When the media manager is playing a video, playback state received from onUpdate. Video playback through MediaManager is fixed at 720p.

      Input Parameters:
      @NonNull MediaFile videoMediaFileThe video to play.
      @Nullable final CompletionCallback callbackThe execution callback with the returned execution result.
      method
      method resume
      void resume(@Nullable final CompletionCallback callback)
      Package:dji.sdk.media
      Description:

      The media manager resumes the paused video.

      Input Parameters:
      @Nullable final CompletionCallback callbackThe execution callback with the returned execution result.
      method
      method pause
      void pause(@Nullable final CompletionCallback callback)
      Package:dji.sdk.media
      Description:

      The media manager pauses the playing video.

      Input Parameters:
      @Nullable final CompletionCallback callbackThe execution callback with the returned execution result.
      method
      method stop
      void stop(@Nullable final CompletionCallback callback)
      Package:dji.sdk.media
      Description:

      The media manager stops the playing video.

      Input Parameters:
      @Nullable final CompletionCallback callbackThe execution callback with the returned execution result.
      method moveToPosition
      void moveToPosition(@FloatRange(from = 0) float position, @Nullable final CompletionCallback callback)
      Package:dji.sdk.media
      Description:

      Video playback is skipped to the new position in seconds from the start of the video.

      Input Parameters:
      @FloatRange(from = 0) float positionNew position to play in seconds from start of video. Input with precision of greater than 3 decimal places, will be rounded to 3.
      @Nullable final CompletionCallback callbackThe execution callback with the returned execution result.
      Check Customize DCF File Support
      method
      method isCustomizeDCFFileSupported
      protected boolean isCustomizeDCFFileSupported()
      Package:dji.sdk.media
      Description:

      Checks if the media manager supports customize DCF file naming rule or not. It is Only supported by Zenmuse H20 series.

      Return:
      protected booleantrue if the camera supports customize DCF file.
      Download Media
      method
      method fetchThumbnail
      void fetchThumbnail(@Nullable final CompletionCallback callback)
      Package:dji.sdk.media
      Description:

      Fetches this media's thumbnail with a resolution (99 x 99) from the SD card. This method can be used to fetch either a photo or a video, where the first frame of the video is the thumbnail that is fetched. It is not available if the media type is Panorama.

      Precondition:
      The camera mode is MediaDownload mode.

      Post Condition:
      This method will start to download the media thumbnail in the SD card. The content can be videos or images.

      Input Parameters:
      @Nullable final CompletionCallback callbackThe completion callback with the returned execution result.
      enum FileListState
      enum FileListState
      Package:dji.sdk.media
      Description:

      States of the file list in MediaManager.

      Enum Members:
      UP_TO_DATEThe file list is up-to-date: it is synchronized with the SD card in the aircraft.
      INCOMPLETENew files have been generated since the last call of refreshFileListOfStorageLocation. Calling refreshFileListOfStorageLocation can synchronize the newly generated files and append them to the end of the file list.
      RESETThe file list is reset. The file list will be reset in one of the following cases:
      - Camera is disconnected.
      - SD card is formatted.
      - SD card is not inserted.
      - Error occurs when deleting files from SD card.
      In this state, getSDCardFileListSnapshot will return null.
      DELETINGdeleteFiles has been called and the operation is still in progress.
      RENAMINGA renaming operation is in progress.
      SYNCINGThe media manager is synchronizing the file list from the SD card.
      UNKNOWNUnknown.
      Class Members:
      State Updates
      class
      Media
      class
      Video Playback
      class