Is there a way to access the media start and end timecode in UXP?

I’m trying to get the timecode media start and media end of a project item in UXP but coming up short. I can get the in point and outpoint, but not the media start and media end. Am I missing something obvious?

Thanks!

If you’re trying to get the media start timecode for a ProjectItem, you have to cast it to a ClipProjectItem then getMedia() then get the start.

To get the end timecode, you have to add start to duration

const premierepro = require("premierepro");
const proj = await premierepro.Project.getActiveProject();
const root = await proj.getRootItem();
const items = await root.getItems();
// assuming item 0 is a footage projectItem
const casted = await premierepro.ClipProjectItem.cast(items[0]);
const media = await casted.getMedia();
const start = await media.start;
const duration = await media.start;
const endSeconds = start.seconds + duration.seconds;

(overcomplicated I know)

Feel free to reference the examples here:

Hey @justin2taylor That’s the ticket! I should have just jumped over the sample project, but thanks for your help, I really appreciate it.

Sure thing! In a lot of cases, looking at the example will be more helpful than the docs since there are a lot of new concepts that aren’t always super clear in the docs such as locked projects, item casting, and the like.

1 Like