Issue Accessing Caption Items via CaptionTrack API in Premiere Pro UXP Scripting
Dear Adobe Premiere Pro Support Team,
I am currently developing a Premiere Pro extension using the UXP scripting API, and I am encountering difficulties when trying to access captions from a sequence’s CaptionTrack.
Specifically, I can successfully retrieve the CaptionTrack object using sequence.getCaptionTrack(), and I can confirm its presence and properties such as id and name. However, when attempting to get caption items using methods like getItems() or getTrackItems(), I consistently receive errors such as:
-
“Not Enough Parameters”
-
“captionTrack.getItems is not a function”
From inspecting the CaptionTrack object, I found that it has a method getTrackItems(), but it appears to require parameters which are not clearly documented.
Below is a simplified snippet of the code I tried:
const captionTrack = await sequence.getCaptionTrack();
if (!captionTrack) {
alert("No caption track found.");
} else {
alert(`CaptionTrack found. ID: ${captionTrack.id}, Name: ${captionTrack.name}`);
// Attempting to get caption items
try {
const items = await captionTrack.getTrackItems();
alert(`Number of captions: ${items.length}`);
} catch (error) {
alert(`Error: ${error.message}`);
}
}
I would greatly appreciate guidance on the correct usage of the CaptionTrack API to access individual caption items (text, timing, etc.) within a CaptionTrack in the UXP environment. If there is sample code or updated documentation addressing this, that would be very helpful.
Thank you very much for your support and assistance.
Best regards,
Muhammadhussein Ammari
