grass valley developers

Home > APIs > AppServer API > Examples > Timeline and Transport Control > Play a Clip

Play a Clip

The code below shows how to create a controller and play a clip. You will need to pass in the name of your client application. See Suspending and Closing AppServers for an explanation of when an existing controller would be returned.

bool isNewController = false;

// create a controller
ISimpleController icontroller = iappServer.CreateController(
"YourApplicationName", "C1", out isNewController);

// cast it to a player recorder and load a clip
ISimplePlayerRecorder player = (ISimplePlayerRecorder) icontroller;

// play for 3 seconds

// eject the clip

// close the channel
short nIsNewController;
ISimpleControllerPtr spController;

// create a controller
HRESULT hr = spAppServer->CreateController(_bstr_t("YourApplicationName"), _bstr_t("C1"), 
 &nIsNewController, &spController);

// cast it to a player recorder and load a clip
ISimplePlayerRecorderPtr spPlayer = (ISimplePlayerRecorderPtr) spController;
hr = spPlayer->Load(_bstr_t("edl/cmf//local/V:/default/Clip"));

// play for 3 seconds
hr = spPlayer->Play();

// eject the clip
hr = spPlayer->Eject();

// close the channel
hr = spController->CloseChannel();