grass valley developers

Home > APIs > AppServer API > Examples > Asset Management > Get Event Notifications

Get Event Notifications

When you get an instance of a MediaMgr, it keeps track of event notifications (i.e. changes in assets, bins, edits, etc.). Calling MediaMgr's GetXmlChanges returns an XML document of all notifications since the last time you called it. The next time GetXmlChanges is called, only new notifications will be returned. Note that each MediaMgr object keeps track of its own list of notifications.

Currently, the best way for getting event notifications is to call GetXmlChanges on a regular interval (say, every 0.5 second).

The different event types returned by GetXmlChanges can be found here: K2EventTypes.xml

For example, let's say you want to keep track of all new clips or changes to clips. Calling GetXmlChanges and querying for notices with EventType="MovieContent" returns this information plus all attributes of the clips. This is an efficient way of finding out what has changed rather than querying individual properties of clips.

Here are some code examples of how to call GetXmlChanges:

IMediaMgr mediaMgr = iappServer.CreateMediaMgr(appName);

int loopCount = 0;
int changeCount = 0;
string xmlData = "";

while ( loopCount < 10 )
 mediaMgr.GetXmlChanges(1000000, ref changeCount, out xmlData);
 if ( xmlData.Length > 0)


IMediaMgrPtr spMediaMgr;
hr = spAppServer->CreateMediaMgr(m_bstrAppName, &spMediaMgr);

long count = 0;
BSTR bstrXmlData = NULL; // must set this to NULL!

spMediaMgr->GetXmlChanges(1000000, &count, &bstrXmlData);