ProgressCategoryContainer
data-variant=info
data-slots=text
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
ProgressCategoryContainer instanceconst 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
Returns
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
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
Returns
true if the category was removedconst 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
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
Returns
true if subscription was successfulconst 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
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
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
true if there are completed jobsconst 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
true on successconst 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
true on successconst 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
true on successconst app = require("mediaencoder");
const container = app.ProgressCategoryContainer.getContainer();
await container.resumeAllProgressItems();