@interface DJIMediaManager : NSObject |
Header: | DJIMediaManager.h |
Inherits From: | NSObject |
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.
@property (nonatomic, nullable, weak) id<DJIMediaManagerDelegate> delegate |
Header: | DJIMediaManager.h |
Delegate that receives media manager's status update.
@property (nonatomic, readonly) DJIFetchMediaTaskScheduler *taskScheduler |
Header: | DJIMediaManager.h |
Fetch media task scheduler. This can be used to queue the download of the previews, thumbnails and XML custom data from multiple media files.
@property (nonatomic, readonly) DJIMediaFileListState sdCardFileListState |
Header: | DJIMediaManager.h |
The file list state of the SD card.
- (NSArray<DJIMediaFile *> *_Nullable)sdCardFileListSnapshot |
Header: | DJIMediaManager.h |
Returns a copy of the current file list on the SD card after you call refreshFileListOfStorageLocation:withCompletion
. Returns nil
if sdCardFileListState
is reset.
NSArray<DJIMediaFile *> *_Nullable | An array of DJIMediaFile objects. |
@property (nonatomic, readonly) DJIMediaFileListState internalStorageFileListState |
Header: | DJIMediaManager.h |
The file list state of the internal storage.
- (NSArray<DJIMediaFile *> *_Nullable)internalStoragefileListSnapshot |
Header: | DJIMediaManager.h |
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.
NSArray<DJIMediaFile *> *_Nullable | An array of DJIMediaFile objects. |
- (void)refreshFileListOfStorageLocation:(DJICameraStorageLocation)storageLocation withCompletion:(DJICompletionBlock)completion |
Header: | DJIMediaManager.h |
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
.
DJICameraStorageLocation storageLocation | The storage location of the file list to refresh. |
DJICompletionBlock completion | Completion block to receive the result. |
- (void)deleteFiles:(NSArray<DJIMediaFile *> *_Nonnull)files withCompletion:(void (^_Nullable)(NSArray<DJIMediaFile *> *_Nonnull failedFiles, NSError *_Nullable error))completion |
Header: | DJIMediaManager.h |
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
.
NSArray<DJIMediaFile *> *_Nonnull files | Media files to delete. |
NSArray<DJIMediaFile *> *_Nonnull failedFiles | Files that failed to delete. |
NSError *_Nullable error | Error retrieving the value. |
void (^_Nullable)(NSArray<DJIMediaFile *> *_Nonnull failedFiles, NSError *_Nullable error) completion | Completion block to receive the result. |
- (BOOL)isVideoPlaybackSupported |
Header: | DJIMediaManager.h |
Checks if the media manager supports video playback or not. @return YES
if the media manager supports video playback.
BOOL | YES if the media manager supports video playback. |
- (void)playVideo:(DJIMediaFile *)videoMedia withCompletion:(DJICompletionBlock)completion |
Header: | DJIMediaManager.h |
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.
DJIMediaFile * videoMedia | The video to play. |
DJICompletionBlock completion | The completion block to receive the command execution result. |
- (void)resumeWithCompletion:(DJICompletionBlock)completion |
Header: | DJIMediaManager.h |
The media manager resumes the paused video.
DJICompletionBlock completion | The completion block to receive the command execution result. |
- (void)pauseWithCompletion:(DJICompletionBlock)completion |
Header: | DJIMediaManager.h |
The media manager pauses the playing video.
DJICompletionBlock completion | The completion block to receive the command execution result. |
- (void)stopWithCompletion:(DJICompletionBlock)completion |
Header: | DJIMediaManager.h |
The media manager stops the playing video.
DJICompletionBlock completion | The completion block to receive the command execution result. |
- (void)moveToPosition:(float)position withCompletion:(DJICompletionBlock)completion |
Header: | DJIMediaManager.h |
Video playback is skipped to the new position in seconds from the start of the video.
float position | New position to play in seconds from start of video. Input with precision of greater than 3 decimal places, will be rounded to 3. |
DJICompletionBlock completion | The completion block to receive the command execution result. |
typedef NS_ENUM(NSUInteger, DJIMediaFileListState) |
Header: | DJIMediaManager.h |
States of the file list in DJIMediaManager
.
DJIMediaFileListStateUpToDate | The file list is up-to-date: it is synchronized with the SD card in the aircraft. |
DJIMediaFileListStateIncomplete | New 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. |
DJIMediaFileListStateReset | The 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 . |
DJIMediaFileListStateDeleting | deleteFiles:withCompletion has been called and the operation is still in progress. |
DJIMediaFileListStateRenaming | A renaming operation is in progress. |
DJIMediaFileListStateSyncing | The media manager is synchronizing the file list from the SD card. |
DJIMediaFileListStateUnknown | Unknown. |
@protocol DJIMediaManagerDelegate <NSObject> |
Header: | DJIMediaManager.h |
Inherits From: | NSObject |
This protocol provides a delegate method to receive the updated video playback state of the media manager.
@optional |
Header: | DJIMediaManager.h |
Updates the video playback state of the media manager. This update method will only be called when the media manager is playing a video.
DJIMediaManager * manager | The media manager updates the playback state. |
DJIMediaVideoPlaybackState * state | The playback state. |
@optional |
Header: | DJIMediaManager.h |
Updates the video playback data of the media manager. This update method will only be called when the media manager is playing a video.
DJIMediaManager * manager | The media manager updates the playback state. |
uint8_t * data | An uint8_t value of video playback data. |
size_t length | A size_t value of the data length. |
BOOL forRendering | Check if it's for rendering. |
@optional |
Header: | DJIMediaManager.h |
Updates the file list state of the media manager.
DJIMediaManager * manager | The media manager with updated file list state. |
DJIMediaFileListState fileListState | The new file list state. |
@optional |
Header: | DJIMediaManager.h |
Updates the file list state of the media manager.
DJIMediaManager * manager | The media manager with updated file list state. |
DJICameraStorageLocation location | The storage location of the file list. |
DJIMediaFileListState fileListState | The latest state of the file list. |