@interface DJIMediaFile : NSObject |
Header: | DJIMediaFile.h |
Inherits From: | NSObject |
This class contains information about a multi-media file on the SD card. It also provides methods to retrieve the data in the file.
@property(nonatomic, readonly) NSString *fileName |
Header: | DJIMediaFile.h |
Returns the name of the media file in the SD Card.
@property(nonatomic, readonly) BOOL valid |
Header: | DJIMediaFile.h |
YES
if the media file is still valid. If a media file is from the file list of the media manager, the file will become invalid after the file list is reset.
@property(nonatomic, readonly) NSUInteger index |
Header: | DJIMediaFile.h |
Get the file index used in the camera.
@property(nonatomic, readonly) DJIMediaType mediaType |
Header: | DJIMediaFile.h |
Returns the type of media file.
@property(nonatomic, readonly) DJIMediaVideoFileType videoFileType |
Header: | DJIMediaFile.h |
Returns the type of video media file.
@property(nonatomic, readonly) DJIMediaQuickShotVideoType quickShotVideoType |
Header: | DJIMediaFile.h |
Returns the type of QuickShot video media file. .
@property(nonatomic, readonly) DJICameraShootPhotoMode shootPhotoMode |
Header: | DJIMediaFile.h |
Returns the DJICameraShootPhotoMode
of a photo. Returns nil
if mediaType
is
DJIMediaTypeMOV
or DJIMediaTypeMP4
.
@property(nonatomic, readonly) DJICameraPhotoPanoramaMode panoramaMode |
Header: | DJIMediaFile.h |
Returns the DJICameraPhotoPanoramaMode
of a photo. It is valid when shootPhotoMode
is DJICameraShootPhotoModePanorama
.
@property(nonatomic, readonly) long long fileSizeInBytes |
Header: | DJIMediaFile.h |
Returns the size, in bytes, of the media file.
@property(nonatomic, readonly) NSString *timeCreated |
Header: | DJIMediaFile.h |
Returns the time when the media file was created as a string in the format "yyyy-MM-dd kk:mm:ss".
@property(nonatomic, readonly) float durationInSeconds |
Header: | DJIMediaFile.h |
If the media file is a video, this property returns the duration of the video in seconds. Will be 0s if the media file is a photo.
@property(nonatomic, readonly) DJICameraVideoFrameRate frameRate |
Header: | DJIMediaFile.h |
Frame rate when the media file is a video.
@property(nonatomic, readonly) DJICameraVideoResolution resolution |
Header: | DJIMediaFile.h |
Camera resolution.
@property(nonatomic, readonly) DJICameraOrientation videoOrientation |
Header: | DJIMediaFile.h |
The orientation of the camera when the video file was first recorded. If the camera orientation changes during a video capture, this will report the initial orientation. Will be DJICameraOrientationLandscape
if the media file is a photo. Only Mavic Pro supports this property. Will be DJICameraOrientationLandscape
for other products.
@property(nonatomic, readonly) DJICameraStorageLocation storageLocation |
Header: | DJIMediaFile.h |
Storage location of the media file.
@property(nonatomic, nullable, readonly) NSString *customInformation |
Header: | DJIMediaFile.h |
Custom information can be stored in media file's XMP meta data using setMediaFileCustomInformation:withCompletion
This property contains the information that was written to this media file. If this property returns nil
, use fetchCustomInformationWithCompletion
to populate it. Supported by Zenmuse P1, Zenmuse L1, Phantom 4 RTK, Phantom 4 Pro, Phantom 4 Advanced and Inspire 2 with firmware versions from after May 23 2017.
@property(nonatomic, nullable, readonly) NSString *XMPInformation |
Header: | DJIMediaFile.h |
This property contains the XMP data which was written to this media file. If this property returns nil
, use fetchXMPFileDataWithCompletion
to populate it. Only supported Phantom 4 RTK, Zenmuse P1, Zenmuse L1.
@property(nonatomic, nullable, readonly) UIImage *thumbnail |
Header: | DJIMediaFile.h |
Returns the thumbnail for this media. If this property returns nil, call fetchThumbnailWithCompletion
.
- (void)fetchThumbnailWithCompletion:(DJICompletionBlock)completion |
Header: | DJIMediaFile.h |
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.
DJICompletionBlock completion | The completion block with the returned execution result. |
@property(nonatomic, nullable, readonly) UIImage *preview |
Header: | DJIMediaFile.h |
Returns the preview image for this media. If this property returns nil
, call fetchPreviewWithCompletion
.
- (void)resetThumbnail |
Header: | DJIMediaFile.h |
Free memory by setting cached thumbnail to nil
. This does not need to be called before fetchThumbnailWithCompletion
and is provided for convenience.
- (void)fetchPreviewWithCompletion:(DJICompletionBlock)completion |
Header: | DJIMediaFile.h |
Fetch media's preview image. The preview image is a lower resolution (960 x 540) version of a photo. The DJIMediaType
of this media object should be DJIMediaTypeJPEG
or DJIMediaTypeTIFF
. The preview will be stored in preview
.
DJICompletionBlock completion | The completion block with the returned execution result. |
- (void)resetPreview |
Header: | DJIMediaFile.h |
Free memory by setting cached preview image to nil
. This does not need to be called before fetchPreviewWithCompletion
and is provided for convenience.
- (void)fetchCustomInformationWithCompletion:(DJICompletionBlock)completion |
Header: | DJIMediaFile.h |
Custom information can be stored in media file's XMP meta data using setMediaFileCustomInformation:withCompletion
. The information will be stored in customInformation
. Only supported by Phantom 4 Pro, Phantom 4 Advanced, Phantom 4 Pro V2.0, Zenmuse P1, Zenmuse L1, Zenmuse X4S, Zenmuse X5S, Zenmuse X7 and Mavic 2 Enterprise camera.
DJICompletionBlock completion | The completion block with the returned execution result. |
- (void)fetchXMPFileDataWithCompletion:(DJICompletionBlock)completion |
Header: | DJIMediaFile.h |
Fetch the XMP data stored in the media file. The data will be stored in XMPInformation
. Only supported by Zenmuse P1, Zenmuse L1, Phantom 4 RTK.
DJICompletionBlock completion | The completion block with the returned execution result. |
- (void)fetchFileDataWithOffset:(NSUInteger)offset |
Header: | DJIMediaFile.h |
Fetches this media file's full resolution data from camera. The difference between fetching the media data and fetching the thumbnail is that fetching the thumbnail will return a low-resolution image of the actual picture, while fetching the media data will return all data for a video or image. If last download action is aborted, it will continue to download the data from where the file download has been aborted.
NSUInteger offset | Offset in bytes. Pass 0 to fetch all data from the beginning. Pass the already fetched bytes to continue the previous download. |
dispatch_queue_t queue | Queue to call the update block on. |
NSData *_Nullable data | A chunk of binary data of the file. |
BOOL isComplete | YES if the last byte of the file is returned and thus fetching is complete. |
NSError *_Nullable error | Error retrieving the value. |
void (^_Nonnull)(NSData *_Nullable data, BOOL isComplete, NSError *_Nullable error) updateBlock | Block to receive file data. It will be called multiple times and each time will return the data received since the last call. |
- (void)stopFetchingFileDataWithCompletion:(DJICompletionBlock)completion |
Header: | DJIMediaFile.h |
Stops a currently executing call of fetchFileDataWithOffset:updateQueue:updateBlock
.
DJICompletionBlock completion | The completion block with the returned execution result. |
- (void)fetchSubFileDataListWithCompletion:(void (^_Nonnull)(NSArray<NSData *> *_Nullable dataList, NSError *_Nullable error))completion |
Header: | DJIMediaFile.h |
Fetches the file data of the sub media files. It is available only when mediaType
is DJIMediaTypePanorama
or DJIMediaTypeShallowFocus
.
NSArray<NSData *> *_Nullable dataList | Sub media files' data. They are files are in JPEG format. |
NSError *_Nullable error | Error retrieving the value. |
void (^_Nonnull)(NSArray<NSData *> *_Nullable dataList, NSError *_Nullable error) completion | Completion block to receive the result. |
typedef NS_ENUM (NSUInteger, DJIMediaType) |
Header: | DJIMediaFile.h |
Media types.
typedef NS_ENUM (NSUInteger, DJIMediaVideoFileType) |
Header: | DJIMediaFile.h |
Video file types. It is not supported by camera:didGenerateNewMediaFile
return DJIMediaFile
media file object.
DJIMediaVideoFileTypeNormal | The video file is recorded in normal mode. |
DJIMediaVideoFileTypeTimeLapse | The video file is recorded in time-lapse mode. |
DJIMediaVideoFileTypeSlowMotion | The video file is recorded as slow motion video. |
DJIMediaVideoFileTypeQuickShot | The video file is recorded during a QuickShot mission. Use DJIActiveTrackModeQuickShot to check the detail QuickShot mode of the video file. |
DJIMediaVideoFileTypeHyperlapse | The video is recorded when the aircraft is in hyper-lapse mode. It is only supported by Mavic 2 Zoom and Mavic 2 Pro. Hyper-lapse is only supported by DJI GO 4. |
DJIMediaVideoFileTypeUnknown | Unknown. |
typedef NS_ENUM (NSUInteger, DJIMediaQuickShotVideoType) |
Header: | DJIMediaFile.h |
The QuickShot modes of the video file when its type is DJIMediaVideoFileTypeQuickShot
.