public class

DJIMedia

extends Object
java.lang.Object
   ↳ dji.sdk.Camera.DJIMedia

Class Overview

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

Summary

Nested Classes
enum DJIMedia.MediaType Media types. 
Fields
public float durationSeconds If the media file is a video, this property returns the duration of the video in seconds.
public long fileSize File Size in Bytes of the media file
public int frameRate Frame rate when the media file is a video.
public long mTimeCreated Returns the time in unit second.
public DJICameraSettingsDef.CameraVideoResolution resolution Camera resolution.
Public Constructors
DJIMedia()
Public Methods
void fetchMediaData(File destDir, String fileName, CameraDownloadListener<String> callback)
Fetches this media from the SD card.
void fetchPreviewImage(CameraDownloadListener<Bitmap> callback)
Fetch media's preview image.
void fetchSubMediaFileList(CameraDownloadListener<ArrayList<DJIMedia>> callback)
Fetch sub media files.
void fetchThumbnail(CameraDownloadListener<Bitmap> callback)
Fetches this media's thumbnail with a resolution (99 x 99) from the SD card.
String getCreatedDate()
Returns the time when the media file was created as a string in the format "YYYY-MM-DD hh:mm:ss".
String getFileName()
Returns the name of the media file in the SD Card.
String getFileNameWithoutExtension()
Returns the name of the media file in the SD card.
int getId()
Get the file index used in the camera.
DJIMedia.MediaType getMediaType()
Returns the type of media file.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public float durationSeconds

If the media file is a video, this property returns the duration of the video in seconds. If the media file is a picture, it returns 0.

public long fileSize

File Size in Bytes of the media file

public int frameRate

Frame rate when the media file is a video.

public long mTimeCreated

Returns the time in unit second. Starts from January 1st, 1970.

public DJICameraSettingsDef.CameraVideoResolution resolution

Camera resolution.

Public Constructors

public DJIMedia ()

Public Methods

public void fetchMediaData (File destDir, String fileName, CameraDownloadListener<String> callback)

Fetches this media from the SD card. The difference with 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 will return all data of a video or an image. The fetched data is stored in the directory destDir, with the name fileName+"."+fileExtension. DJI SDK will add the file extension according to the media type.

Precondition:
The camera mode should be set as MediaDownload mode.

Post Condition:
This method will start to download the media's original file from the SD card. The content can be videos or images. This method will be called per file.

Parameters
destDir - File instance of location to save the files, which can not be null.
fileName - The fileName to store in mobile devices, without the file extension.
If it is null, the file name in the camera's SDCard will be used.
callback - CameraDownloadListener monitors the download progress. It requires the developer to implement five methods:

onStart() called once the download process for per file starts.
onRateUpdate() called to update the download rate.
onProgress() called to update the download progress for per file.
onSuccess() called when the download for per file is finished.
onFailure() called if an error occurs for per file.

public void fetchPreviewImage (CameraDownloadListener<Bitmap> callback)

Fetch media's preview image. The preview image is lower resolution (960 x 540) version of a still picture or the first frame of a video. The mediaType of this media object should be 'DJIMediaTypeJPG'. It is not available if the media type is Panorama.

Precondition:
The camera work mode is MediaDownload mode.

Post Condition:
This method will start to download the media's preview image in the SD card, which has a resolution of 960x540. The content can be videos or images.

Parameters
callback - CameraDownloadListener listens to how the download progress. It requires the developer to implement five methods. The details of the five methods are as follows:

onStart() which will be called once the download process starts.
onRateUpdate() which will be called to update the downloading rate.
onProgress() which will be called to update the downloading progress.
onSuccess() which will be called once the download is finished.
onFailure() which will be called once an error occurs.

public void fetchSubMediaFileList (CameraDownloadListener<ArrayList<DJIMedia>> callback)

Fetch sub media files. It is available only when the media type is Panorama. User should use this method to fetch the set of photos shot in a panorama mission.

Precondition:
The camera mode should be set as MediaDownload mode.

Parameters
callback - CameraDownloadListener monitors the download progress. It requires the developer to implement five methods:

onStart() called once the download process for sub-media file list info starts.
onRateUpdate() called to update the download rate.
onProgress() called to update the download progress for sub-media file list info.
onSuccess() called when the download for sub-media file list info is finished.
onFailure() called if an error occurs for sub-media file list info.

public void fetchThumbnail (CameraDownloadListener<Bitmap> callback)

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.

Parameters
callback - CameraDownloadListener listens to how the download progress. It requires the developer to implement five methods. The details of the five methods are as follows:

onStart() which will be called once the download process starts.
onRateUpdate() which will be called to update the downloading rate.
onProgress() which will be called to update the downloading progress.
onSuccess() which will be called once the download is finished.
onFailure() which will be called once an error occurs.

public String getCreatedDate ()

Returns the time when the media file was created as a string in the format "YYYY-MM-DD hh:mm:ss".

public String getFileName ()

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

public String getFileNameWithoutExtension ()

Returns the name of the media file in the SD card. The name here is without extension.

Returns
  • The file name without its extension.

public int getId ()

Get the file index used in the camera.

Returns
  • The ID of the file.

public DJIMedia.MediaType getMediaType ()

Returns the type of media file.