ProgressItem

data-variant=info
data-slots=text
UXP for Adobe Media Encoder is in public beta. This reference is being written, and the supported API surface may change before general availability.

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 listener receives a ProgressItemValueChangedEvent object with the following properties:

Name
Type
Description
progressItem
ProgressItem
The progress item whose value changed
status
string
The status message of the progress item
value
string
The new progress value as a string. Convert it with Number(event.value) and compare it with getMaxValue

Type: string (readonly, class)

Since: 27.0

EVENT_PROGRESS_ITEM_CANCELLED

Event ID fired when the progress item is cancelled. The listener receives a ProgressItemCancelledEvent object with the following property:

Name
Type
Description
progressItem
ProgressItem
The progress item that was cancelled

Type: string (readonly, class)

Since: 27.0

EVENT_PROGRESS_ITEM_TITLE_CHANGED

Event ID fired when the progress item's title changes. The listener receives a ProgressItemTitleChangedEvent object with the following properties:

Name
Type
Description
progressItem
ProgressItem
The progress item whose title changed
title
string
The new title

Type: string (readonly, class)

Since: 27.0

Properties

referenceId

The reference ID of the progress item. For an item created with createProgressItemWithReferenceId, this is the reference ID you passed. Otherwise, Media Encoder generates a unique ID. If the progress item no longer exists, this is the all-zero GUID 00000000-0000-0000-0000-000000000000.

Type: Guid (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

Name
Type
Description
value
number
The current progress value
const app = require("mediaencoder");
item.getValue();

getMaxValue

Gets the maximum progress value.

Since: 27.0

Parameters

none

Returns

Name
Type
Description
maxValue
number
The maximum progress value
const app = require("mediaencoder");
item.getMaxValue();

getStatusMessage

Gets the current status message.

Since: 27.0

Parameters

none

Returns

Name
Type
Description
statusMessage
string
The current status message
const app = require("mediaencoder");
item.getStatusMessage();

getTitle

Gets the title of the progress item.

Since: 27.0

Parameters

none

Returns

Name
Type
Description
title
string
The title of the progress item
const app = require("mediaencoder");
item.getTitle();

getProgressState

Gets the current progress state.

Since: 27.0

Parameters

none

Returns

Name
Type
Description
state
number
One of the PROGRESS_STATE_* constants
const app = require("mediaencoder");
item.getProgressState();

isComplete

Checks whether the progress item is complete.

Since: 27.0

Parameters

none

Returns

Name
Type
Description
result
boolean
true if the item is complete
const app = require("mediaencoder");
item.isComplete();

isInProgress

Checks whether the progress item is currently in progress.

Since: 27.0

Parameters

none

Returns

Name
Type
Description
result
boolean
true if the item is in progress
const app = require("mediaencoder");
item.isInProgress();

isIndeterminateProgress

Checks whether the progress item has been configured as unknown (indeterminate) progress.

Since: 27.0

Parameters

none

Returns

Name
Type
Description
result
boolean
true if the item reports unknown progress
const app = require("mediaencoder");
item.isIndeterminateProgress();

isPending

Checks whether the progress item is pending.

Since: 27.0

Parameters

none

Returns

Name
Type
Description
result
boolean
true if the item is pending
const app = require("mediaencoder");
item.isPending();

supportsCancellation

Checks if the progress item can be cancelled.

Since: 27.0

Parameters

none

Returns

Name
Type
Description
result
boolean
true if the item supports cancellation
const app = require("mediaencoder");
item.supportsCancellation();

supportsPauseAndResume

Checks if the progress item can be paused and resumed.

Since: 27.0

Parameters

none

Returns

Name
Type
Description
result
boolean
true if the item supports pause and resume
const app = require("mediaencoder");
item.supportsPauseAndResume();

cancelProgress

Cancels this progress item.

Since: 27.0

Parameters

none

Returns

Name
Type
Description
result
boolean
true on success
const app = require("mediaencoder");
await item.cancelProgress();

pauseOrResumeProgress

Pauses or resumes this progress item.

Since: 27.0

Parameters

Name
Type
Description
inProgresState
number
One of PROGRESS_STATE_PAUSED / PROGRESS_STATE_RESUMED

Returns

Name
Type
Description
result
boolean
true on success
const app = require("mediaencoder");
await item.pauseOrResumeProgress(app.ProgressItem.PROGRESS_STATE_PAUSED);

setProgressStatus

Sets the current progress value and max value.

Since: 27.0

Parameters

Name
Type
Description
value
number
The current progress value
maxValue
number
The maximum progress value

Returns

Name
Type
Description
result
boolean
true on success
const app = require("mediaencoder");
await item.setProgressStatus(50, 100);

setProgressStatusAndToolTip

Sets the current progress value, max value, status message, and tooltip.

Since: 27.0

Parameters

Name
Type
Description
value
number
The current progress value
maxValue
number
The maximum progress value
statusMessage
string
The status message to display
toolTip
string
The tooltip to display

Returns

Name
Type
Description
result
boolean
true on success
const 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

Name
Type
Description
statusMessage
string
The status message to display

Returns

Name
Type
Description
result
boolean
true on success
const app = require("mediaencoder");
await item.setUnknownProgress("Analyzing...");

setToolTip

Sets the tooltip for the progress item.

Since: 27.0

Parameters

Name
Type
Description
toolTip
string
The tooltip to display

Returns

Name
Type
Description
result
boolean
true on success
const app = require("mediaencoder");
await item.setToolTip("Job 1 of 4");

setStatusMessage

Sets the status message for the progress item.

Since: 27.0

Parameters

Name
Type
Description
statusMessage
string
The status message to display

Returns

Name
Type
Description
result
boolean
true on success
const app = require("mediaencoder");
await item.setStatusMessage("Encoding...");

setTitle

Sets the title of the progress item.

Since: 27.0

Parameters

Name
Type
Description
title
string
The new title to set

Returns

Name
Type
Description
result
boolean
true on success
const app = require("mediaencoder");
await item.setTitle("Encoding job 1 (retry)");

setProgressState

Sets the progress state.

Since: 27.0

Parameters

Name
Type
Description
state
number
One of the PROGRESS_STATE_* constants

Returns

Name
Type
Description
result
boolean
true on success
const 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

Name
Type
Description
toolTip
string
The tooltip to display for cancel

Returns

Name
Type
Description
result
boolean
true on success
const app = require("mediaencoder");
await item.setCancelToolTip("Cancel this job");

setType

Sets the type of the progress item. The type is a GUID that your plugin defines, so that you can tell your own kinds of progress items apart.

Since: 27.0

Parameters

Name
Type
Description
type
Guid
The type of the progress item, created with Guid.fromString

Returns

Name
Type
Description
success
boolean
Returns true if the type was set, false if the progress item no longer exists
const app = require("mediaencoder");
const item = category.createProgressItem("Uploading renders");
await item.setType(app.Guid.fromString("6f1c2b7e-3d4a-4f5b-9c8d-1e2f3a4b5c6d")); // true

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

Name
Type
Description
eventKey
string
The event ID to subscribe to, one of EVENT_PROGRESS_ITEM_VALUE_CHANGED, EVENT_PROGRESS_ITEM_CANCELLED, EVENT_PROGRESS_ITEM_TITLE_CHANGED

Returns

Name
Type
Description
success
boolean
Returns true if subscription was successful
const 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);