@interface DJIFetchMediaTaskScheduler : NSObject |
Header: | DJIFetchMediaTaskScheduler.h |
Inherits From: | NSObject |
The camera stores the media it captures to SD or SSD storage on the product. When the mobile device wants to access the media, it needs to download it from the product over the wireless link between the product, remote controller and mobile device (depending on the product). Each media file captured by the camera can have several types of content associated with it including the full resolution media content, a lower resolution preview, a lower resolution again thumbnail, and custom data within the file's XML meta data. The full resolution content can take a long time to download over the wireless link, so it is often useful to download previews or thumbnails of many media files, and then only download the full resolution content of fewer select media files. This scheduler conveniently allows the small content types of media files (preview, thumbnail and custom data) to be downloaded to the mobile device. The scheduler can be used to queue and download content from a series of files, as well as used to re-prioritize files during the download process. The scheduler holds a list of pending tasks and it completes them one by one in first-in-first-out order. To prioritize a new task, moveTaskToNext
can be used. Each task relates to a media file and can download multiple content types sequentially. When the last content type of a task starts being downloaded, the task is removed from the list. Note, the scheduler cannot be used to queue the download of full resolution media content. Only fetchFileDataWithOffset:updateQueue:updateBlock
can be used for this.
@property (atomic, readwrite) BOOL suspendAfterSingleFetchTaskFailure |
Header: | DJIFetchMediaTaskScheduler.h |
Set YES
to suspend the scheduler when an error occurs during the execution.
@property (atomic, readonly) DJIFetchMediaTaskSchedulerState state |
Header: | DJIFetchMediaTaskScheduler.h |
State of the scheduler.
-(NSArray<DJIFetchMediaTask *> *)pendingTasks |
Header: | DJIFetchMediaTaskScheduler.h |
Gets a copy of the pending tasks.
NSArray<DJIFetchMediaTask *> * | An array of DJIFetchMediaTask objects. |
-(void)moveTaskToEnd:(DJIFetchMediaTask *)task |
Header: | DJIFetchMediaTaskScheduler.h |
Pushes a task to the back of the queue. The task will be executed after all other tasks are complete.
DJIFetchMediaTask * task | Task to schedule. |
-(void)moveTaskToNext:(DJIFetchMediaTask *)task |
Header: | DJIFetchMediaTaskScheduler.h |
Pushes a task to the front of the queue. The task will be executed after the executing task is complete.
DJIFetchMediaTask * task | Task to schedule. |
-(void)removeTaskWithFile:(DJIMediaFile *)file andContent:(DJIFetchMediaTaskContent)content |
Header: | DJIFetchMediaTaskScheduler.h |
Remove content from tasks, and tasks from the scheduler. If all content is removed from a task, then the task is removed from the scheduler.
DJIMediaFile * file | An object of DJIMediaFile . |
DJIFetchMediaTaskContent content | An enum value of DJIFetchMediaTaskContent . |
-(void)removeAllTasks |
Header: | DJIFetchMediaTaskScheduler.h |
Removes all the pending tasks.
-(void)suspendWithCompletion:(DJICompletionBlock)completion |
Header: | DJIFetchMediaTaskScheduler.h |
Suspends the scheduler. The scheduler will not continue to execute tasks in the queue.
DJICompletionBlock completion | The completion block with the returned execution result. |
-(void)resumeWithCompletion:(DJICompletionBlock)completion |
Header: | DJIFetchMediaTaskScheduler.h |
Resumes the scheduler. The scheduler will execute tasks in the queue sequentially.
DJICompletionBlock completion | The completion block with the returned execution result. |
typedef NS_ENUM(NSUInteger, DJIFetchMediaTaskSchedulerState) |
Header: | DJIFetchMediaTaskScheduler.h |
States of the fetch media file task scheduler DJIFetchMediaTaskScheduler
.
DJIFetchMediaTaskSchedulerStateIdle | Scheduler is waiting for tasks. |
DJIFetchMediaTaskSchedulerStateExecuting | Scheduler is executing tasks. |
DJIFetchMediaTaskSchedulerStateSuspended | Scheduler is suspended. Use resumeWithCompletion to resume the scheduler. |
DJIFetchMediaTaskSchedulerStateUnknown | Unknown. |