ProgressCategoryContainer

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

The Media Encoder ProgressCategoryContainer API provides access to progress categories, such as the global render progress exposed via RenderQueue.PROGRESS_CATEGORY_ID. Use getOrCreateProgressCategory to obtain a ProgressCategory, and use that category to create and manage individual ProgressItem objects.

The ProgressCategoryContainer class can be accessed from the main app object. Call getContainer to obtain the shared container instance:

const app = require("mediaencoder");
const container = app.ProgressCategoryContainer.getContainer();

Constants

These Constants are used as event IDs with addEventListener / removeEventListener on a ProgressCategoryContainer instance. All Constants are class properties, accessed via the ProgressCategoryContainer object:

const app = require("mediaencoder");
const EVENT_PROGRESS_CATEGORY_ADDED =
  app.ProgressCategoryContainer.EVENT_PROGRESS_CATEGORY_ADDED;

EVENT_PROGRESS_CATEGORY_ADDED

Event ID fired when a new progress category is added. The event carries a progressCategory property.

Type: string

Since: 27.0

EVENT_PROGRESS_CATEGORY_REMOVED

Event ID fired when a progress category is removed. The event carries a progressCategory property.

Type: string

Since: 27.0

EVENT_PROGRESS_ITEM_ADDED

Event ID fired when a new progress item is added to a category. The event carries progressCategory and progressItem properties.

Type: string

Since: 27.0

EVENT_PROGRESS_ITEM_REMOVED

Event ID fired when a progress item is removed from a category. The event carries progressCategory and progressItem properties.

Type: string

Since: 27.0

Methods

getContainer

Class method. Gets the shared instance of the ProgressCategoryContainer object.

Since: 27.0

Parameters

none

Returns

Name
Type
Description
container
object
A ProgressCategoryContainer instance
const app = require("mediaencoder");
const container = app.ProgressCategoryContainer.getContainer();

getOrCreateProgressCategory

Gets an existing progress category by ID, or creates a new one if it doesn't already exist.

Since: 27.0

Parameters

Name
Type
Description
inCategoryID
string
The unique ID for the progress category
inTitle
string (optional)
The display title for the category, if it needs to be created

Returns

ProgressCategory

const app = require("mediaencoder");
const container = app.ProgressCategoryContainer.getContainer();
const category = container.getOrCreateProgressCategory(
  app.RenderQueue.PROGRESS_CATEGORY_ID,
  "My Category",
);

getAllProgressCategories

Gets all currently registered progress categories.

Since: 27.0

Parameters

none

Returns

Name
Type
Description
categories
object[]
Array of ProgressCategory objects
const app = require("mediaencoder");
const container = app.ProgressCategoryContainer.getContainer();
const categories = container.getAllProgressCategories();

removeProgressCategory

Removes the specified progress category from the container.

Since: 27.0

Parameters

Name
Type
Description
inProgressCategory
object
The ProgressCategory to remove

Returns

Name
Type
Description
result
boolean
true if the category was removed
const app = require("mediaencoder");
const container = app.ProgressCategoryContainer.getContainer();
container.removeProgressCategory(category);

getProgressItemFromReferenceID

Retrieves a progress item by its reference ID, across all categories in the container.

Since: 27.0

Parameters

Name
Type
Description
referenceGuid
object
The reference GUID the item was created with, see createProgressItemWithReferenceId

Returns

ProgressItem, or null if there is no progress item under this reference ID.

const app = require("mediaencoder");
const container = app.ProgressCategoryContainer.getContainer();
const item = container.getProgressItemFromReferenceID(referenceGuid);

subscribeToEvent

Registers a subscription to a specific container-level event.

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_CATEGORY_ADDED, EVENT_PROGRESS_CATEGORY_REMOVED, EVENT_PROGRESS_ITEM_ADDED, EVENT_PROGRESS_ITEM_REMOVED

Returns

Name
Type
Description
success
boolean
Returns true if subscription was successful
const app = require("mediaencoder");
const container = app.ProgressCategoryContainer.getContainer();
const event = app.ProgressCategoryContainer.EVENT_PROGRESS_CATEGORY_ADDED;
container.subscribeToEvent(event); // true
const callback = (event) => {
  console.log("Progress category added", event.progressCategory);
};
container.addEventListener(event, callback);

addEventListener

Registers an event handler for the specified event on this ProgressCategoryContainer. The event handling follows the W3C DOM Level 2 Events Specification.

Since: 27.0

Parameters

Name
Type
Description
eventType
string
The event ID to listen for, see Constants
handler
function
A function to be triggered when the specified event occurs

Returns

none

const app = require("mediaencoder");
const container = app.ProgressCategoryContainer.getContainer();
const event = app.ProgressCategoryContainer.EVENT_PROGRESS_CATEGORY_ADDED;
container.subscribeToEvent(event);
const callback = (event) => {
  console.log("Progress category added", event.progressCategory);
};
container.addEventListener(event, callback);

removeEventListener

Unregisters a previously registered event handler for the specified event on this ProgressCategoryContainer.

Since: 27.0

Parameters

Name
Type
Description
eventType
string
The event ID to stop listening for
handler
function
The previously registered callback to remove

Returns

none

const app = require("mediaencoder");
const container = app.ProgressCategoryContainer.getContainer();
const event = app.ProgressCategoryContainer.EVENT_PROGRESS_CATEGORY_ADDED;
container.removeEventListener(event, callback);

hasDoneJobs

Checks whether any progress category in the container has completed jobs.

Since: 27.0

Parameters

none

Returns

Name
Type
Description
result
boolean
true if there are completed jobs
const app = require("mediaencoder");
const container = app.ProgressCategoryContainer.getContainer();
container.hasDoneJobs();

removeDoneJobs

Removes completed progress items across all progress categories in the container.

Since: 27.0

Parameters

none

Returns

Name
Type
Description
result
boolean
true on success
const app = require("mediaencoder");
const container = app.ProgressCategoryContainer.getContainer();
container.removeDoneJobs();

pauseAllProgressItems

Pauses all progress items across all progress categories in the container.

Since: 27.0

Parameters

none

Returns

Name
Type
Description
result
boolean
true on success
const app = require("mediaencoder");
const container = app.ProgressCategoryContainer.getContainer();
await container.pauseAllProgressItems();

resumeAllProgressItems

Resumes all paused progress items across all progress categories in the container.

Since: 27.0

Parameters

none

Returns

Name
Type
Description
result
boolean
true on success
const app = require("mediaencoder");
const container = app.ProgressCategoryContainer.getContainer();
await container.resumeAllProgressItems();