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.

[C#]
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;
player.Load("edl/cmf//local/V:/default/Clip");

// play for 3 seconds
player.Play();
Thread.Sleep(3000);

// eject the clip
player.Eject();

// close the channel
icontroller.CloseChannel();
[C++] 
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();
Sleep(3000);

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

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