Hi,
Â
I'm writing an InDesign plugin which needs to query the MediaLocation for any given movie on a page.
Â
I've found 2 ways of doing this: firstly by selecting the page item and accessing the location via IMediaSuite:
Â
IActiveContext* iActiveContext = GetExecutionContextSession()->GetActiveContext ();
ISelectionManager* iSelectionManager = iActiveContext->GetContextSelection();
InterfacePtr<IMediaSuite> ms(iSelectionManager, UseDefaultIID());
if (ms) {
 MediaLocation loc;
 ms->GetMediaLocation(loc);
}
Â
However, ideally I'd like to not have to select the page item first.
The second way I found avoids having to select it, but does not work for remote movies as they have no link:
Â
UID linkUID = Utils<ILinkUtils>()->FindLink(item);
InterfacePtr<ILinkManager> linkManager(db, db->GetRootUID(), UseDefaultIID());
ILink* link = linkManager->QueryLinkByUID(linkUID);
InterfacePtr<const ILinkObject> linkObj(::GetDataBase(link),link->GetObject(),UseDefaultIID());
InterfacePtr<const IMediaInfo> mediaInfo((IMediaInfo*)linkObj->QueryLinkedObject(IID_IMEDIAINFO));
InterfacePtr<const IMediaContent> mediaContent(mediaInfo,UseDefaultIID());
MediaLocation loc = mediaContent->GetLocation();
Â
Is there a way I can get the MediaLocation for both local and remote movies, without first having to select the page item?
Â
Thanks
Liz