The runner of MediaPipe task graphs.
Public Methods
| void | 
close()
                
                   Closes and cleans up the  TaskRunnerinstance. | 
| static TaskRunner | 
create(Context context, TaskInfo<? extends TaskOptions> taskInfo, OutputHandler<? extends TaskResult, ?> outputHandler)
                
                   Create a  TaskRunnerinstance. | 
| CalculatorGraphConfig | |
| AndroidPacketCreator | 
getPacketCreator()
                
                   Returns the  ERROR(/AndroidPacketCreator)associated to theTaskRunnerinstance. | 
| synchronized TaskResult | |
| synchronized TaskResult | |
| void | 
restart()
                
                   Resets and restarts the  TaskRunnerinstance. | 
| synchronized void | |
| void | 
setErrorListener(ErrorListener listener)
                
                   Sets a callback to be invoked when exceptions are thrown by the  TaskRunnerinstance. | 
Inherited Methods
Public Methods
public static TaskRunner create (Context context, TaskInfo<? extends TaskOptions> taskInfo, OutputHandler<? extends TaskResult, ?> outputHandler)
Create a TaskRunner instance.
Parameters
| context | an Android ERROR(/Context). | 
|---|---|
| taskInfo | a TaskInfoinstance contains task graph name, task options, and graph
     input and output stream names. | 
| outputHandler | a OutputHandlerinstance handles task result object and runtime
     exception. | 
Throws
| for any error during TaskRunnercreation. | 
public CalculatorGraphConfig getCalculatorGraphConfig ()
public AndroidPacketCreator getPacketCreator ()
Returns the ERROR(/AndroidPacketCreator) associated to the TaskRunner instance. 
public synchronized TaskResult process (Map<String, Packet> inputs)
A synchronous method for processing batch data.
Note: This method is designed for processing batch data such as unrelated images and texts. The call blocks the current thread until a failure status or a successful result is returned. An internal timestamp will be assigned per invocation. This method is thread-safe and allows clients to call it from different threads.
Parameters
| inputs | a map contains (input stream String, dataERROR(/Packet)) pairs. | 
|---|
public synchronized TaskResult process (Map<String, Packet> inputs, long inputTimestamp)
A synchronous method for processing offline streaming data.
Note: This method is designed for processing offline streaming data such as the decoded frames from a video file and an audio file. The call blocks the current thread until a failure status or a successful result is returned. The caller must ensure that the input timestamp is greater than the timestamps of previous invocations. This method is thread-unsafe and it is the caller's responsibility to synchronize access to this method across multiple threads and to ensure that the input packet timestamps are in order.
Parameters
| inputs | a map contains (input stream String, dataERROR(/Packet)) pairs. | 
|---|---|
| inputTimestamp | the timestamp of the input packets. | 
public void restart ()
Resets and restarts the TaskRunner instance. This can be useful for resetting a
 stateful task graph to process new data.
public synchronized void send (Map<String, Packet> inputs, long inputTimestamp)
An asynchronous method for handling live streaming data.
Note: This method that is designed for handling live streaming data such as live camera and microphone data. A user-defined packets callback function must be provided in the constructor to receive the output packets. The caller must ensure that the input packet timestamps are monotonically increasing. This method is thread-unsafe and it is the caller's responsibility to synchronize access to this method across multiple threads and to ensure that the input packet timestamps are in order.
Parameters
| inputs | a map contains (input stream String, dataERROR(/Packet)) pairs. | 
|---|---|
| inputTimestamp | the timestamp of the input packets. | 
public void setErrorListener (ErrorListener listener)
Sets a callback to be invoked when exceptions are thrown by the TaskRunner instance.
Parameters
| listener | an ErrorListenercallback. | 
|---|