UXP API freezing Premiere Pro UI during timeline operations
Hi everyone,
I’m currently developing a UXP plugin for Premiere Pro and ran into a serious issue regarding performance and UI blocking.
According to the UXP documentation, the API is asynchronous and should not block the Premiere Pro UI. However, in my implementation, calling my autoSwitchCamera function causes the UI to freeze for a noticeable period. After the freeze, all clips are inserted at once at the end of the timeline. In some cases, Premiere Pro even crashes.
What I’m doing
I process a list of segments and sequentially apply timeline operations (overwrite + trim) using await inside a loop. The operations rely heavily on Project.executeTransaction and SequenceEditor actions.
Observed behavior
- UI becomes unresponsive during execution
- No incremental updates (everything appears after the loop finishes)
- Occasionally leads to Premiere Pro crash
Expectation
Since the API is async, I expected:
- Non-blocking UI
- Incremental updates per segment
- Stable execution without freezing
Question
Am I misunderstanding how UXP async works in Premiere Pro?
- Do timeline operations (e.g.,
executeTransaction,createOverwriteItemAction) run on the main thread regardless ofasync/await? - Is there a recommended pattern to avoid blocking (e.g., batching, yielding, chunking operations)?
Relevant Code
export async function autoSwitchCamera(cameraSegment) {
const sequence = await getActiveSequenceAsync();
const project = await getActiveProjectAsync();
const editor = getSequenceEditor(ppro, sequence);
for (let i = 0; i < cameraSegment.length; i++) {
const segment = cameraSegment[i];
const start = Number(segment.start) || 0;
const end = Number(segment.end) || 0;
const camera = Number(segment.camera);
if (camera === -1) {
continue;
}
const sourceProjectItem = state.videos[camera];
const inPointSeconds = Math.max(start - state.videoStart[camera], 0);
await overwriteItemAndTrim({
ppro,
project,
sequence,
editor,
projectItem: sourceProjectItem,
startSeconds: start,
endSeconds: end,
inPointSeconds: inPointSeconds,
trackType: "video",
trackIndex: camera
});
}
}
And inside:
await executeProjectTransaction(
project,
"Overwrite Clip",
"overwrite video",
function (compoundAction) {
const overwriteAction = editor.createOverwriteItemAction(
projectItem,
startTick,
trackIndex,
-1
);
compoundAction.addAction(overwriteAction);
}
);
Additional Notes
- Each segment results in multiple
executeTransactioncalls - The segment list can be large (hundreds of iterations)
- Everything is awaited sequentially
What I suspect
It feels like:
- Even though the API is
async, the underlying operations are still executed on the main thread - The loop effectively blocks the event loop due to heavy synchronous host-side execution
If anyone has experience with:
- Optimizing UXP timeline operations
- Avoiding UI freezes in Premiere Pro plugins
- Best practices for batching or chunking transactions
I’d really appreciate your guidance.
Thanks in advance.
