nanoStream – ActiveX Plugin – Development with VisualC++

This tutorial shows how easy it is to create a custom Live Encoding and Streaming application with the nanoStream plugins, based on VisualStudio and C++ for a simple console application.

This tutorial was created with VisualStudio 2008, but should work similar with VS 2010.

Create a new Win32 Console Application Project (File/New Project)

Leave all options to default and press “Finish”

A new project solution is created based on an empty console application.

Add code like this to the main routine:

int _tmain(int argc, _TCHAR* argv[])
{
OleInitialize(NULL); //, if OLE isn't already loaded.

// create nanoStream COM object
CLSID clsid = CLSID_RTMPActiveX;

IRTMPActiveXCommands *nanoVid;

HRESULT hr = CoCreateInstance( clsid, NULL,CLSCTX_INPROC_SERVER, IID_IRTMPActiveXCommands, (LPVOID*)&nanoVid);

if (hr) {

_tprintf(L"could not create nanoStream object");

return 1;

}

hr = nanoVid->InitEncoder();

hr = nanoVid->put_EnablePreview(0);

hr = nanoVid->put_DestinationURL(_T("c:/temp/test.mp4"));

hr = nanoVid->StartBroadcast();

return 0;

}

You need to include additional header files to your project. See the sample source code which is available upon request.