AUTELPlaybackManager
class AUTELPlaybackManager
@interface AUTELPlaybackManager : NSObject
describe:Playback manager mainly interacts with files taken and stored in the SD card, including obtaining all the files, thumbnail images, previews, deleting files, or downloading files from the SD card to mobile devices.
method initWithStorageType
- (instancetype _Nonnull )initWithStorageType:(AUTELCameraStorageType)storageType
describe:create playbackManager with storage type.
input parameter:
storageType: AUTELCameraStorageType, Describe the storage device type of the aircraft. EVOII supports: SD card or onboard flash memory
output parameter:instance of AUTELPlaybackManager.
method fetchMediaFileListFromOffset:fileCount:fileType:withCompletion
- (void)fetchMediaFileListFromOffset:(NSUInteger)offset
fileCount:(NSUInteger)count
fileType:(AUTELGetFileListType)fileType
withCompletion:(void (^_Nonnull)(NSArray<AUTELMedia *> *_Nullable mediaList, NSError *_Nullable error))block
describe:Get the file list in the storage device. You can specify the file type: All, Video, Photo.
If the subscript of the last file outnumbers the actual number of files in SD card, then the number of files in the returned file list will be equal to the actual number of files.
input parameter:
offset:The starting subscript of the requested file list. The first file is subscripted as zero.
count:The number of files requested.
fileType:AUTELGetFileListType. specify the file type: All, Video, Photo.
block:Completion block. This block includes 2 parameters. One is the requested AUTELMedia file list, another one is error which indicates error message. Error retuns nil if this function applies successfully.
method fetchMediaFileListFromOffset:fileCount:withCompletion
- (void)fetchMediaFileListFromOffset:(NSUInteger)offset
fileCount:(NSUInteger)count
withCompletion:(void (^_Nonnull)(NSArray<AUTELMedia *> *_Nullable mediaList, NSError *_Nullable error))block
describe:Get the file list in the storage device. the file type is All.
If the subscript of the last file outnumbers the actual number of files in SD card, then the number of files in the returned file list will be equal to the actual number of files.
input parameter:
offset:The starting subscript of the requested file list. The first file is subscripted as zero.
count:The number of files requested.
block:Completion block. This block includes 2 parameters. One is the requested AUTELMedia file list, another one is error which indicates error message. Error retuns nil if this function applies successfully.
method fetchThumbnailForMedia:withCompletion
- (void)fetchThumbnailForMedia:(AUTELMedia *_Nonnull)media
withCompletion:(AUTELLowerResolutionImageCompletion)block
describe:Get the corresponding thumbnail images.
input parameter:
media:AUTELMedia. An object that describes a media file.
block:AUTELLowerResolutionImageCompletion, Completion block. This block includes 2 parameters. One is the corresponding thumbnail images , another one is error which indicates error message. Error retuns nil if this function applies successfully.
method fetchPreviewImageForMedia:withCompletion
- (void)fetchPreviewImageForMedia:(AUTELMedia *_Nonnull)media
withCompletion:(AUTELLowerResolutionImageCompletion)block;
describe:Get the corresponding previews.
input parameter:
media:AUTELMedia. An object that describes a media file.
block:AUTELLowerResolutionImageCompletion, Completion block. This block includes 2 parameters. One is the corresponding previews , another one is error which indicates error message. Error retuns nil if this function applies successfully.
method fetchPreviewImageForMedia:withCompletion
- (void)playerItemForVideo:(AUTELMedia *_Nonnull)media
withCompletion:(void (^_Nullable)(AVPlayerItem *_Nullable playerItem, BOOL isOriginalData, NSError * _Nullable error))block;
describe:Check whether there is a thumbnail video interface. Generally, there is no thumbnail video for 2.7K \ 4k video.
input parameter:
media:AUTELMedia. An object that describes a media file.
block:Completion block. This block includes 3 parameters. One is the thumbnail video object, one is define Whether it is the original video , another one is error which indicates error message. Error retuns nil if this function applies successfully.
method deleteMedia:withProgress:deleteListCompletion:overallCompletion
- (void)deleteMedia:(NSArray<AUTELMedia *> *_Nonnull)medias withProgress:(AUTELFileDeletingProgress)progressBlock deleteListCompletion:(AUTELFileDeleteListCompletion)deleteListBlock overallCompletion:(AUTELFileDeleteCompletion)deleteAllBlock;
describe:This method deletes all media files in batches. One batch consists of 25 images or a single video file. deleteListBlock returns the files failed to be deleted in every batch.
input parameter:
medias:All files that need to be deleted. AUTELMedia
progressBlock:AUTELFileDeletingProgress , Callback describing deletion progress. The block has 2 parameters, deleteFileNo: the number of files deleted, and expectedFileNo: the number of files to be deleted
deleteListBlock:AUTELFileDeleteListCompletion , Callback describing array of deleted media file objects. The block has 1 parameter, successMedias:Array of media files successfully deleted.
deleteAllBlock:AUTELFileDeleteCompletion , Callback describing the result of the entire delete operation. The block has two parameters, failedMedias:Array of failed media objects. another one is error which indicates error message. Error retuns nil if this function applies successfully.
method deleteMediaItem:withCompletion
- (void)deleteMediaItem:(AUTELMedia *_Nonnull)media withCompletion:(AUTELCompletionBlock)block;
describe:Delete Video Files.
input parameter:
medias:All files that need to be deleted. AUTELMedia
block:AUTELCompletionBlock,Completion block .
method cancelDeletingWithCompletion
- (void)cancelDeletingWithCompletion:(AUTELCompletionBlock)completion;
describe:Cancel the current deleting task.
input parameter:
block:AUTELCompletionBlock,Completion block .
method downloadMedia:withType:preparation:progress:downloadCompletion:overallCompletion
- (void)downloadMedia:(NSArray<AUTELMedia *> *_Nonnull)medias
withPreparation:(AUTELFileDownloadPreparingBlock)prepareBlock
progress:(AUTELFileDownloadProgressBlock)progressBlock
downloadCompletion:(AUTELFileDownloadCompletionBlock)fileCompletionBlock
overallCompletion:(AUTELCompletionBlock)overallCompletionBlock;
- (void)downloadMedia:(NSArray<AUTELMedia *> *_Nonnull)medias
withType:(AUTELDownloadVideoResolutionType)resolutionType
preparation:(AUTELFileDownloadPreparingBlock)prepareBlock
progress:(AUTELFileDownloadProgressBlock)progressBlock
downloadCompletion:(AUTELFileDownloadCompletionBlock)fileCompletionBlock
overallCompletion:(AUTELCompletionBlock)overallCompletionBlock;
describe:Downloading video files from the storage devices of aircraft. You can specify the video file resolution type: thumbnail video or original video
Before using the interface for downloading album files, you need to configure the download path downloadDirectory of AUTELPlaybackManager. Otherwise, the download will fail.
input parameter:
medias:Media file array. AUTELMedia
resolutionType:AUTELDownloadVideoResolutionType , Describes the video file download compression type It is divided into thumbnail video or original video. If it is not transmitted, it will be the original video by default.
prepareBlock:AUTELFileDownloadPreparingBlock , Describe the block triggered before downloading the file.
progressBlock:AUTELFileDownloadProgressBlock , A block that describes the progress returned when the file is downloaded TotalBytesWritten: number of downloaded file bytes, totalBytesExpectedToWrite: number of file bytes to download
fileCompletionBlock:AUTELFileDownloadCompletionBlock , Describe the block where the file download is completed FileLocation: the local path where the file is downloaded
overallCompletionBlock:AUTELCompletionBlock , Block describes the end of all download tasks The error is nil, and the operation succeeds. Otherwise, the operation fails
method cancelDownloadingWithCompletion
- (void)cancelDownloadingWithCompletion:(AUTELCompletionBlock)completion;
describe:Cancel the current downloading task.
input parameter:
block:AUTELCompletionBlock,Completion block .
method cancelPreviewDownload
- (void)cancelPreviewDownload;
describe:Cancel downloading all previews.
method cancelAllDownload
- (void)cancelAllDownload;
describe:Cancel all download tasks, including previews, high-definition images, and videos.
property delegate
@property (nonatomic, weak) id <AUTELPlaybackDelegate> _Nullable delegate;
describe:Delegate of AUTELPlaybackDelegate.
property storageType
@property (nonatomic, readonly) AUTELCameraStorageType storageType;
describe:The current storage device type of PlaybackManager, EVO 2 supports both SD Card and Flash Card. AUTELCameraStorageType
enum AUTELCameraStorageType
describe:Describe the storage device type,EVOII support: SD card (available only when the SD card is inserted in the aircraft, optional) and onboard flash memory
typedef NS_ENUM (uint8_t, AUTELCameraStorageType) {
/**
* SD card
*/
AUTELCameraStorageTypeSDCard = 0,
/**
* onboard flash memory
*/
AUTELCameraStorageTypeEMMC,
/**
* unknow
*/
AUTELCameraStorageTypeUnknown = 0xFF
}
enum AUTELPlaybackExecuteTaskState
describe:The playback status of the current task of AUTELPlaybackManager.
typedef NS_ENUM(NSInteger, AUTELPlaybackExecuteTaskState) {
/**
* @brief Retrieving the file list.
*
*/
AUTELPlaybackExecuteTaskFetchingFileList,
/**
* @brief Retrieving the file thumbnail.
*
*/
AUTELPlaybackExecuteTaskFetchingThumbnail,
/**
* @brief Retrieving the file preview.
*
*/
AUTELPlaybackExecuteTaskFetchingPreview,
/**
* @brief Retrieving the original file.
*
*/
AUTELPlaybackExecuteTaskDownloading,
/**
* @brief Deleting the file.
*
*/
AUTELPlaybackExecuteTaskDeleting,
/**
* @brief Idle state.
*
*/
AUTELPlaybackExecuteTaskIdle
};
typedef block AUTELLowerResolutionImageCompletion
typedef void (^_Nullable AUTELLowerResolutionImageCompletion)(UIImage *_Nullable image, NSError *_Nullable error)
describe:This block is used when requesting thumbnails or previews.
input parameter:
image:the UIImage object of the thumbnail or previews . If the UIImage object of the thumbnail is null, the image cannot be obtained
error:The error is nil, the request succeeds. The error is not null, and the request fails
typedef block AUTELFileDeletingProgress
typedef void (^_Nullable AUTELFileDeletingProgress)(NSUInteger deleteFileNo, NSUInteger expectedFileNo)
describe:Block describing the deletion progress
input parameter:
deleteFileNo:the number of files deleted
expectedFileNo:the number of files to be deleted.
typedef block AUTELFileDeleteListCompletion
typedef void (^_Nullable AUTELFileDeleteListCompletion)(NSArray<AUTELMedia *> *_Nonnull successMedias)
describe:Callback describing array of deleted media file objects.
input parameter:
successMedias:Array of media files successfully deleted. AUTELMedia .
typedef block AUTELFileDeleteCompletion
typedef void (^_Nullable AUTELFileDeleteCompletion)(NSArray<AUTELMedia *> *_Nullable failedMedias, NSError *_Nullable error)
describe:Callback describing the result of the entire delete operation.
input parameter:
failedMedias:Array of failed media objects. AUTELMedia.
error:error which indicates error message. Error retuns nil if this function applies successfully.
typedef block AUTELFileDownloadPreparingBlock
typedef void (^_Nullable AUTELFileDownloadPreparingBlock)(AUTELMedia *_Nullable media, AUTELDownloadFileType fileType, BOOL skip)
describe:Describe the block triggered before downloading the file.
input parameter:
media:Video file to download. AUTELMedia.
fileType:The file type of the media file object to download. AUTELDownloadFileType.
skip:Skip this file download. It is not skipped here by default
typedef block AUTELFileDownloadProgressBlock
typedef void (^_Nullable AUTELFileDownloadProgressBlock)(int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite)
describe:A block that describes the progress returned when the file is downloaded.
input parameter:
totalBytesWritten:number of downloaded file bytes.
totalBytesExpectedToWrite:number of file bytes to download.
typedef block AUTELFileDownloadCompletionBlock
typedef void (^_Nullable AUTELFileDownloadCompletionBlock)(NSURL *_Nullable fileLocation)
describe:Describe the block where the file download is completed.
input parameter:
fileLocation:the local path where the file is downloaded.
protocol AUTELPlaybackDelegate
@protocol AUTELPlaybackDelegate <NSObject>
describe:delegate of AUTELPlaybackManager
method playbackManager:didUpdatePlaybackState
describe:This will be called when the camera playback state changes.
Playback State: playback operation (obtaining thumbnail/preview images, download, delete) is available only when the playbackState.state is AUTELPlaybackExecuteTaskIdle.
@optional
/**
* @brief This will be called when the camera playback state changes.
*
* @param Playback State: playback operation (obtaining thumbnail/preview images, download, delete) is available only when the playbackState.state is AUTELPlaybackExecuteTaskIdle.
*
* @see AUTELPlaybackWorkState
*/
- (void)playbackManager:(AUTELPlaybackManager *_Nonnull)playbackManager didUpdatePlaybackState:(AUTELPlaybackWorkState *_Nonnull)playbackState;
@end