DJI Mobile SDK Documentation

      class DJIMediaManager

      @interface DJIMediaManager : NSObject
      Header:DJIMediaManager.h
      Inherits From:NSObject
      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:
      State Updates
      property
      property delegate
      @property (nonatomic, nullable, weak) id<DJIMediaManagerDelegate> delegate
      Header:DJIMediaManager.h
      Description:

      Delegate that receives media manager's status update.

      See Also:

      DJIMediaManagerDelegate

      property taskScheduler
      @property (nonatomic, readonly) DJIFetchMediaTaskScheduler *taskScheduler
      Header:DJIMediaManager.h
      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.

      See Also:

      DJIFetchMediaTaskScheduler

      property sdCardFileListState
      @property (nonatomic, readonly) DJIMediaFileListState sdCardFileListState
      Header:DJIMediaManager.h
      Description:

      The file list state of the SD card.

      See Also:

      DJIMediaFileListState

      method sdCardFileListSnapshot
      - (NSArray<DJIMediaFile *> *_Nullable)sdCardFileListSnapshot
      Header:DJIMediaManager.h
      Description:

      Returns a copy of the current file list on the SD card after you call refreshFileListOfStorageLocation:withCompletion. Returns nil if sdCardFileListState is reset.

      Return:
      NSArray<DJIMediaFile *> *_NullableAn array of DJIMediaFile objects.
      property internalStorageFileListState
      @property (nonatomic, readonly) DJIMediaFileListState internalStorageFileListState
      Header:DJIMediaManager.h
      Description:

      The file list state of the internal storage.

      See Also:

      DJIMediaFileListState

      method internalStoragefileListSnapshot
      - (NSArray<DJIMediaFile *> *_Nullable)internalStoragefileListSnapshot
      Header:DJIMediaManager.h
      Description:

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

      Return:
      NSArray<DJIMediaFile *> *_NullableAn array of DJIMediaFile objects.
      method refreshFileListOfStorageLocation:withCompletion
      - (void)refreshFileListOfStorageLocation:(DJICameraStorageLocation)storageLocation withCompletion:(DJICompletionBlock)completion
      Header:DJIMediaManager.h
      Description:

      Refreshes the file list of the storage. If the current state is DJIMediaFileListStateReset, the media manager will try to fetch the complete file list. If the current state is DJIMediaFileListStateIncomplete, the media manager will only fetch the missing list of files. If the file list is refreshed successfully, the corresponding file list state (either sdCardFileListState or internalStorageFileListState) will become DJIMediaFileListStateUpToDate.

      Input Parameters:
      DJICameraStorageLocation storageLocationThe storage location of the file list to refresh.
      DJICompletionBlock completionCompletion block to receive the result.
      method deleteFiles:withCompletion
      - (void)deleteFiles:(NSArray<DJIMediaFile *> *_Nonnull)files withCompletion:(void (^_Nullable)(NSArray<DJIMediaFile *> *_Nonnull failedFiles, NSError *_Nullable error))completion
      Header:DJIMediaManager.h
      Description:

      Delete media files from storages. If the operation is started successfully, DJIMediaFileListState will become DJIMediaFileListStateDeleting. If there is error or "failedFiles" is not empty, DJIMediaFileListState will become DJIMediaFileListStateReset.

      Input Parameters:
      NSArray<DJIMediaFile *> *_Nonnull filesMedia files to delete.
      NSArray<DJIMediaFile *> *_Nonnull failedFilesFiles that failed to delete.
      NSError *_Nullable errorError retrieving the value.
      void (^_Nullable)(NSArray<DJIMediaFile *> *_Nonnull failedFiles, NSError *_Nullable error) completionCompletion block to receive the result.
      Video Playback
      method
      method isVideoPlaybackSupported
      - (BOOL)isVideoPlaybackSupported
      Header:DJIMediaManager.h
      Description:

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

      Return:
      BOOLYES if the media manager supports video playback.
      method playVideo:withCompletion
      - (void)playVideo:(DJIMediaFile *)videoMedia withCompletion:(DJICompletionBlock)completion
      Header:DJIMediaManager.h
      Description:

      Start video playback through DJIMediaManager. When the media manager is playing a video, video data can be received frommanager:didUpdateVideoPlaybackData:length:forRendering and playback state received from manager:didUpdateVideoPlaybackState. Video playback through DJIMediaManager is fixed at 720p.

      Input Parameters:
      DJIMediaFile * videoMediaThe video to play.
      DJICompletionBlock completionThe completion block to receive the command execution result.
      method resumeWithCompletion
      - (void)resumeWithCompletion:(DJICompletionBlock)completion
      Header:DJIMediaManager.h
      Description:

      The media manager resumes the paused video.

      Input Parameters:
      DJICompletionBlock completionThe completion block to receive the command execution result.
      method pauseWithCompletion
      - (void)pauseWithCompletion:(DJICompletionBlock)completion
      Header:DJIMediaManager.h
      Description:

      The media manager pauses the playing video.

      Input Parameters:
      DJICompletionBlock completionThe completion block to receive the command execution result.
      method stopWithCompletion
      - (void)stopWithCompletion:(DJICompletionBlock)completion
      Header:DJIMediaManager.h
      Description:

      The media manager stops the playing video.

      Input Parameters:
      DJICompletionBlock completionThe completion block to receive the command execution result.
      method moveToPosition:withCompletion
      - (void)moveToPosition:(float)position withCompletion:(DJICompletionBlock)completion
      Header:DJIMediaManager.h
      Description:

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

      Input Parameters:
      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.
      DJICompletionBlock completionThe completion block to receive the command execution result.
      enum DJIMediaFileListState
      typedef NS_ENUM(NSUInteger, DJIMediaFileListState)
      Header:DJIMediaManager.h
      Description:

      States of the file list in DJIMediaManager.

      Enum Members:
      DJIMediaFileListStateUpToDateThe file list is up-to-date: it is synchronized with the SD card in the aircraft.
      DJIMediaFileListStateIncompleteNew files have been generated since the last call of refreshFileListOfStorageLocation:withCompletion. Calling refreshFileListOfStorageLocation:withCompletion can synchronize the newly generated files and append them to the end of the file list.
      DJIMediaFileListStateResetThe 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, sdCardFileListSnapshot will return nil.
      DJIMediaFileListStateDeletingdeleteFiles:withCompletion has been called and the operation is still in progress.
      DJIMediaFileListStateRenamingA renaming operation is in progress.
      DJIMediaFileListStateSyncingThe media manager is synchronizing the file list from the SD card.
      DJIMediaFileListStateUnknownUnknown.
      State Updates
      protocol
      protocol DJIMediaManagerDelegate
      @protocol DJIMediaManagerDelegate <NSObject>
      Header:DJIMediaManager.h
      Inherits From:NSObject
      Description:

      This protocol provides a delegate method to receive the updated video playback state of the media manager.

      Protocol Methods:

      Protocol Method

      method manager:didUpdateVideoPlaybackState
      @optional
      -(void)manager:(DJIMediaManager *)manager didUpdateVideoPlaybackState:(DJIMediaVideoPlaybackState *)state
      Header:DJIMediaManager.h
      Description:

      Updates the video playback state of the media manager. This update method will only be called when the media manager is playing a video.

      Input Parameters:
      DJIMediaManager * managerThe media manager updates the playback state.
      DJIMediaVideoPlaybackState * stateThe playback state.
      method manager:didUpdateVideoPlaybackData:length:forRendering
      @optional
      -(void)manager:(DJIMediaManager *)manager didUpdateVideoPlaybackData:(uint8_t *)data length:(size_t)length forRendering:(BOOL)forRendering
      Header:DJIMediaManager.h
      Description:

      Updates the video playback data of the media manager. This update method will only be called when the media manager is playing a video.

      Input Parameters:
      DJIMediaManager * managerThe media manager updates the playback state.
      uint8_t * dataAn uint8_t value of video playback data.
      size_t lengthA size_t value of the data length.
      BOOL forRenderingCheck if it's for rendering.
      method manager:didUpdateFileListState
      @optional
      -(void)manager:(DJIMediaManager *)manager didUpdateFileListState:(DJIMediaFileListState)fileListState
      Header:DJIMediaManager.h
      Description:

      Updates the file list state of the media manager.

      Input Parameters:
      DJIMediaManager * managerThe media manager with updated file list state.
      DJIMediaFileListState fileListStateThe new file list state.
      method manager:didUpdateStorageLocation:fileListState
      @optional
      -(void)manager:(DJIMediaManager *)manager didUpdateStorageLocation:(DJICameraStorageLocation)location
      fileListState:(DJIMediaFileListState)fileListState
      Header:DJIMediaManager.h
      Description:

      Updates the file list state of the media manager.

      Input Parameters:
      DJIMediaManager * managerThe media manager with updated file list state.
      DJICameraStorageLocation locationThe storage location of the file list.
      DJIMediaFileListState fileListStateThe latest state of the file list.
      Media
      class
      Video Playback
      class