DJI Mobile SDK Documentation

      class DJIMediaFile

      @interface DJIMediaFile : NSObject
      Header:DJIMediaFile.h
      Inherits From:NSObject
      Description:

      This class contains information about a multi-media file on the SD card. It also provides methods to retrieve the data in the file.

      Class Members:
      Identifier
      property
      property fileName
      @property(nonatomic, readonly) NSString *fileName
      Header:DJIMediaFile.h
      Description:

      Returns the name of the media file in the SD Card.

      property
      property valid
      @property(nonatomic, readonly) BOOL valid
      Header:DJIMediaFile.h
      Description:

      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
      property index
      @property(nonatomic, readonly) NSUInteger index
      Header:DJIMediaFile.h
      Description:

      Get the file index used in the camera.

      Information
      property
      property mediaType
      @property(nonatomic, readonly) DJIMediaType mediaType
      Header:DJIMediaFile.h
      Description:

      Returns the type of media file.

      See Also:

      DJIMediaType

      property videoFileType
      @property(nonatomic, readonly) DJIMediaVideoFileType videoFileType
      Header:DJIMediaFile.h
      Description:

      Returns the type of video media file.

      See Also:

      DJIMediaVideoFileType

      property quickShotVideoType
      @property(nonatomic, readonly) DJIMediaQuickShotVideoType quickShotVideoType
      Header:DJIMediaFile.h
      Description:

      Returns the type of QuickShot video media file. .

      See Also:

      DJIMediaQuickShotVideoType

      property shootPhotoMode
      @property(nonatomic, readonly) DJICameraShootPhotoMode shootPhotoMode
      Header:DJIMediaFile.h
      Description:

      Returns the DJICameraShootPhotoMode of a photo. Returns nil if mediaType is DJIMediaTypeMOV or DJIMediaTypeMP4.

      See Also:

      DJICameraShootPhotoMode

      property
      property panoramaMode
      @property(nonatomic, readonly) DJICameraPhotoPanoramaMode panoramaMode
      Header:DJIMediaFile.h
      Description:

      Returns the DJICameraPhotoPanoramaMode of a photo. It is valid when shootPhotoMode is DJICameraShootPhotoModePanorama.

      See Also:

      DJICameraPhotoPanoramaMode

      property fileSizeInBytes
      @property(nonatomic, readonly) long long fileSizeInBytes
      Header:DJIMediaFile.h
      Description:

      Returns the size, in bytes, of the media file.

      property
      property timeCreated
      @property(nonatomic, readonly) NSString *timeCreated
      Header:DJIMediaFile.h
      Description:

      Returns the time when the media file was created as a string in the format "yyyy-MM-dd kk:mm:ss".

      Photo & Video Properties
      property
      property durationInSeconds
      @property(nonatomic, readonly) float durationInSeconds
      Header:DJIMediaFile.h
      Description:

      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
      property frameRate
      @property(nonatomic, readonly) DJICameraVideoFrameRate frameRate
      Header:DJIMediaFile.h
      Description:

      Frame rate when the media file is a video.

      See Also:

      DJICameraVideoFrameRate

      property
      property resolution
      @property(nonatomic, readonly) DJICameraVideoResolution resolution
      Header:DJIMediaFile.h
      Description:

      Camera resolution.

      See Also:

      DJICameraVideoResolution

      property videoOrientation
      @property(nonatomic, readonly) DJICameraOrientation videoOrientation
      Header:DJIMediaFile.h
      Description:

      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.

      See Also:

      DJICameraOrientation

      Storage Location
      property
      property storageLocation
      @property(nonatomic, readonly) DJICameraStorageLocation storageLocation
      Header:DJIMediaFile.h
      Description:

      Storage location of the media file.

      See Also:

      DJICameraStorageLocation

      Custom Information
      property
      property customInformation
      @property(nonatomic, nullable, readonly) NSString *customInformation
      Header:DJIMediaFile.h
      Description:

      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.

      XMP Data
      property
      property XMPInformation
      @property(nonatomic, nullable, readonly) NSString *XMPInformation
      Header:DJIMediaFile.h
      Description:

      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.

      Download Media
      property
      property thumbnail
      @property(nonatomic, nullable, readonly) UIImage *thumbnail
      Header:DJIMediaFile.h
      Description:

      Returns the thumbnail for this media. If this property returns nil, call fetchThumbnailWithCompletion.

      method fetchThumbnailWithCompletion
      - (void)fetchThumbnailWithCompletion:(DJICompletionBlock)completion
      Header:DJIMediaFile.h
      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:
      DJICompletionBlock completionThe completion block with the returned execution result.
      Preview Image
      property
      property preview
      @property(nonatomic, nullable, readonly) UIImage *preview
      Header:DJIMediaFile.h
      Description:

      Returns the preview image for this media. If this property returns nil, call fetchPreviewWithCompletion.

      Reset thumbnail
      method
      method resetThumbnail
      - (void)resetThumbnail
      Header:DJIMediaFile.h
      Description:

      Free memory by setting cached thumbnail to nil. This does not need to be called before fetchThumbnailWithCompletion and is provided for convenience.

      Fetch Preview
      method
      method fetchPreviewWithCompletion
      - (void)fetchPreviewWithCompletion:(DJICompletionBlock)completion
      Header:DJIMediaFile.h
      Description:

      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.

      Input Parameters:
      DJICompletionBlock completionThe completion block with the returned execution result.
      Reset Preview
      method
      method resetPreview
      - (void)resetPreview
      Header:DJIMediaFile.h
      Description:

      Free memory by setting cached preview image to nil. This does not need to be called before fetchPreviewWithCompletion and is provided for convenience.

      Download Custom Info
      method
      method fetchCustomInformationWithCompletion
      - (void)fetchCustomInformationWithCompletion:(DJICompletionBlock)completion
      Header:DJIMediaFile.h
      Description:

      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.

      Input Parameters:
      DJICompletionBlock completionThe completion block with the returned execution result.
      Fetch XMP File
      method
      method fetchXMPFileDataWithCompletion
      - (void)fetchXMPFileDataWithCompletion:(DJICompletionBlock)completion
      Header:DJIMediaFile.h
      Description:

      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.

      Input Parameters:
      DJICompletionBlock completionThe completion block with the returned execution result.
      method fetchFileDataWithOffset:updateQueue:updateBlock
      - (void)fetchFileDataWithOffset:(NSUInteger)offset
      updateQueue:(dispatch_queue_t)queue
      updateBlock:(void (^_Nonnull)(NSData *_Nullable data, BOOL isComplete, NSError *_Nullable error))updateBlock
      Header:DJIMediaFile.h
      Description:

      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.

      Input Parameters:
      NSUInteger offsetOffset in bytes. Pass 0 to fetch all data from the beginning. Pass the already fetched bytes to continue the previous download.
      dispatch_queue_t queueQueue to call the update block on.
      NSData *_Nullable dataA chunk of binary data of the file.
      BOOL isCompleteYES if the last byte of the file is returned and thus fetching is complete.
      NSError *_Nullable errorError retrieving the value.
      void (^_Nonnull)(NSData *_Nullable data, BOOL isComplete, NSError *_Nullable error) updateBlockBlock to receive file data. It will be called multiple times and each time will return the data received since the last call.
      Stop Fetching File Data
      method
      method stopFetchingFileDataWithCompletion
      - (void)stopFetchingFileDataWithCompletion:(DJICompletionBlock)completion
      Header:DJIMediaFile.h
      Description:

      Stops a currently executing call of fetchFileDataWithOffset:updateQueue:updateBlock.

      Input Parameters:
      DJICompletionBlock completionThe completion block with the returned execution result.
      Fetching File Data
      method
      method fetchSubFileDataListWithCompletion
      - (void)fetchSubFileDataListWithCompletion:(void (^_Nonnull)(NSArray<NSData *> *_Nullable dataList, NSError *_Nullable error))completion
      Header:DJIMediaFile.h
      Description:

      Fetches the file data of the sub media files. It is available only when mediaType is DJIMediaTypePanorama or DJIMediaTypeShallowFocus.

      Input Parameters:
      NSArray<NSData *> *_Nullable dataListSub media files' data. They are files are in JPEG format.
      NSError *_Nullable errorError retrieving the value.
      void (^_Nonnull)(NSArray<NSData *> *_Nullable dataList, NSError *_Nullable error) completionCompletion block to receive the result.
      enum DJIMediaType
      typedef NS_ENUM (NSUInteger, DJIMediaType)
      Header:DJIMediaFile.h
      Description:

      Media types.

      Enum Members:
      DJIMediaTypeUnknownUnknown file type.
      DJIMediaTypeJPEGImage of JPEG format.
      DJIMediaTypeMP4Video of MP4 format.
      DJIMediaTypeMOVVideo of MOV format.
      DJIMediaTypeRAWDNGImage of DNG format.
      DJIMediaTypePanoramaPanorama file type.
      DJIMediaTypeTIFFTIFF file type.
      DJIMediaTypeShallowFocusShallowFocus file type. ShallowFocus files have a shallow depth of field.
      DJIMediaTypeTIFFSequenceTIFF Sequence file type. It is a video format for infrared cameras.
      DJIMediaTypeSEQSEQ file type. It is a video format for infrared cameras.
      DJIMediaTypeAudioAudio file type. It is an audio format for the speaker.
      enum DJIMediaVideoFileType
      typedef NS_ENUM (NSUInteger, DJIMediaVideoFileType)
      Header:DJIMediaFile.h
      Description:

      Video file types. It is not supported by camera:didGenerateNewMediaFile return DJIMediaFile media file object.

      Enum Members:
      DJIMediaVideoFileTypeNormalThe video file is recorded in normal mode.
      DJIMediaVideoFileTypeTimeLapseThe video file is recorded in time-lapse mode.
      DJIMediaVideoFileTypeSlowMotionThe video file is recorded as slow motion video.
      DJIMediaVideoFileTypeQuickShotThe video file is recorded during a QuickShot mission. Use DJIActiveTrackModeQuickShot to check the detail QuickShot mode of the video file.
      DJIMediaVideoFileTypeHyperlapseThe 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.
      DJIMediaVideoFileTypeUnknownUnknown.
      enum DJIMediaQuickShotVideoType
      typedef NS_ENUM (NSUInteger, DJIMediaQuickShotVideoType)
      Header:DJIMediaFile.h
      Description:

      The QuickShot modes of the video file when its type is DJIMediaVideoFileTypeQuickShot.

      Enum Members:
      DJIMediaQuickShotVideoTypeNoneThe video file is not a QuickShot video.
      DJIMediaQuickShotVideoTypeCircleThe QuickShot video file is recorded in Circle mode.
      DJIMediaQuickShotVideoTypeDronieThe QuickShot video file is recorded in Dronie mode.
      DJIMediaQuickShotVideoTypeHelixThe QuickShot video file is recorded in Helix mode.
      DJIMediaQuickShotVideoTypeRocketThe QuickShot video file is recorded in Rocket mode.
      DJIMediaQuickShotVideoTypeBoomerangThe QuickShot video file is recorded in Boomerang mode.
      DJIMediaQuickShotVideoTypeAsteroidThe QuickShot video file is recorded in Asteroid mode.
      DJIMediaQuickShotVideoTypeDollyZoomThe QuickShot video file is recorded in DollyZoom mode.
      DJIMediaQuickShotVideoTypeUnknownUnknown.