ProgressItem
data-variant=info
data-slots=text
Since: 27.0
A ProgressItem represents a single item of progress within a ProgressCategory, such as one render job's progress within the global render category. ProgressItem instances are not constructed directly; obtain one from ProgressCategory.createProgressItem, createProgressItemWithReferenceId, or getProgressItemFromReferenceID.
const app = require("mediaencoder");
const item = category.createProgressItem("Encoding job 1");
Constants
PROGRESS_STATE_NORMAL
Normal progress state. Returned by getProgressState and accepted by setProgressState / pauseOrResumeProgress.
Type: number (readonly, class)
Since: 27.0
PROGRESS_STATE_PAUSED
Paused progress state.
Type: number (readonly, class)
Since: 27.0
PROGRESS_STATE_RESUMED
Resumed progress state.
Type: number (readonly, class)
Since: 27.0
PROGRESS_STATE_WAITING
Waiting progress state.
Type: number (readonly, class)
Since: 27.0
PROGRESS_STATE_FAILED
Failed progress state.
Type: number (readonly, class)
Since: 27.0
PROGRESS_STATE_CANCELLED
Cancelled progress state.
Type: number (readonly, class)
Since: 27.0
EVENT_PROGRESS_ITEM_VALUE_CHANGED
Event ID fired when the progress item's value changes. The event carries progressItem, status, and value properties.
Type: string (readonly, class)
Since: 27.0
EVENT_PROGRESS_ITEM_CANCELLED
Event ID fired when the progress item is cancelled. The event carries a progressItem property.
Type: string (readonly, class)
Since: 27.0
EVENT_PROGRESS_ITEM_TITLE_CHANGED
Event ID fired when the progress item's title changes. The event carries progressItem and title properties.
Type: string (readonly, class)
Since: 27.0
Properties
referenceId
The reference ID the item was created with, if any.
Type: object (readonly)
Since: 27.0
creationTime
The time the progress item was created.
Type: string (readonly)
Since: 27.0
Methods
getValue
Gets the current progress value.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
item.getValue();
getMaxValue
Gets the maximum progress value.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
item.getMaxValue();
getStatusMessage
Gets the current status message.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
item.getStatusMessage();
getTitle
Gets the title of the progress item.
Since: 27.0
Parameters
none
Returns
const app = require("mediaencoder");
item.getTitle();
getProgressState
Gets the current progress state.
Since: 27.0
Parameters
none
Returns
PROGRESS_STATE_* constantsconst app = require("mediaencoder");
item.getProgressState();
isComplete
Checks whether the progress item is complete.
Since: 27.0
Parameters
none
Returns
true if the item is completeconst app = require("mediaencoder");
item.isComplete();
isInProgress
Checks whether the progress item is currently in progress.
Since: 27.0
Parameters
none
Returns
true if the item is in progressconst app = require("mediaencoder");
item.isInProgress();
isIndeterminateProgress
Checks whether the progress item has been configured as unknown (indeterminate) progress.
Since: 27.0
Parameters
none
Returns
true if the item reports unknown progressconst app = require("mediaencoder");
item.isIndeterminateProgress();
isPending
Checks whether the progress item is pending.
Since: 27.0
Parameters
none
Returns
true if the item is pendingconst app = require("mediaencoder");
item.isPending();
supportsCancellation
Checks if the progress item can be cancelled.
Since: 27.0
Parameters
none
Returns
true if the item supports cancellationconst app = require("mediaencoder");
item.supportsCancellation();
supportsPauseAndResume
Checks if the progress item can be paused and resumed.
Since: 27.0
Parameters
none
Returns
true if the item supports pause and resumeconst app = require("mediaencoder");
item.supportsPauseAndResume();
cancelProgress
Cancels this progress item.
Since: 27.0
Parameters
none
Returns
true on successconst app = require("mediaencoder");
await item.cancelProgress();
pauseOrResumeProgress
Pauses or resumes this progress item.
Since: 27.0
Parameters
PROGRESS_STATE_PAUSED / PROGRESS_STATE_RESUMEDReturns
true on successconst app = require("mediaencoder");
await item.pauseOrResumeProgress(app.ProgressItem.PROGRESS_STATE_PAUSED);
setProgressStatus
Sets the current progress value and max value.
Since: 27.0
Parameters
Returns
true on successconst app = require("mediaencoder");
await item.setProgressStatus(50, 100);
setProgressStatusAndToolTip
Sets the current progress value, max value, status message, and tooltip.
Since: 27.0
Parameters
Returns
true on successconst app = require("mediaencoder");
await item.setProgressStatusAndToolTip(50, 100, "Encoding...", "Job 1 of 4");
setUnknownProgress
Marks the progress item as having unknown (indeterminate) progress.
Since: 27.0
Parameters
Returns
true on successconst app = require("mediaencoder");
await item.setUnknownProgress("Analyzing...");
setToolTip
Sets the tooltip for the progress item.
Since: 27.0
Parameters
Returns
true on successconst app = require("mediaencoder");
await item.setToolTip("Job 1 of 4");
setStatusMessage
Sets the status message for the progress item.
Since: 27.0
Parameters
Returns
true on successconst app = require("mediaencoder");
await item.setStatusMessage("Encoding...");
setTitle
Sets the title of the progress item.
Since: 27.0
Parameters
Returns
true on successconst app = require("mediaencoder");
await item.setTitle("Encoding job 1 (retry)");
setProgressState
Sets the progress state.
Since: 27.0
Parameters
PROGRESS_STATE_* constantsReturns
true on successconst app = require("mediaencoder");
await item.setProgressState(app.ProgressItem.PROGRESS_STATE_CANCELLED);
setCancelToolTip
Sets the tooltip shown for the cancel action on this progress item.
Since: 27.0
Parameters
Returns
true on successconst app = require("mediaencoder");
await item.setCancelToolTip("Cancel this job");
subscribeToEvent
Registers a subscription to a specific event on this progress item.
Note: addEventListener() is required after a subscribeToEvent() call in order to actually react to an event, the same pattern used by RenderQueueInstance.
Since: 27.0
Parameters
Returns
true if subscription was successfulconst app = require("mediaencoder");
const event = app.ProgressItem.EVENT_PROGRESS_ITEM_VALUE_CHANGED;
item.subscribeToEvent(event); // true
const callback = (event) => {
console.log("Progress value changed", event.value);
};
item.addEventListener(event, callback);