ITMEDIAPLAYBACK.playlist = "WHAT?" in vb.net

G

Guest

1)I want to play a file when someone dials my phone no
2) also to detect the digit pressed by the caller
can i get any idea how to do this in VB.net using TAPI 3
MSDN provides code snippet of how to play a file in C++
but i am unable to carry this in vb.net
PLEASE help
 
G

Guest

sir i am pasting the C++ code as in MSDN..
The following code snippet illustrates simple playback.

First, use ITBasicCallControl2 to create the terminal for recording. This tells the TSP/MSP that we are going to perform file playback on this call. The TSP/MSP creates a terminal for the application to use, and returns it on success.

ITTerminal *pFilePlaybackTerminal = NULL;

pCall->CreateTerminal(
CLSID_MediaFilePlaybackTerminal,
TD_RENDER,
TAPIMEDIATYPE_MultiTrack,
&pFileTerminal
);
Get the ITMediaPlayback interface pointer from the terminal interface and use it to set the file name to play back.

ITMediaPlayback *pMediaPlayback = NULL;
pFilePlaybackTerminal->QueryInterface(IID_ITMediaPlayback, (void**)pMediaPlayback);

// Allocate the array to hold the playlist.
SAFEARRAYBOUND DimensionBounds[1];
DimensionBounds[0].lLbound = 0;
DimensionBounds[0].cElements = 1; // 1 element in the array
SAFEARRAY *pPlayListArray = NULL;
pPlayListArray = SafeArrayCreate(VT_VARIANT, 1, DimensionBounds);

// Allocate the array variant for the playlist.
Variant PlayListVariant;
VariantInint(&PlayListVariant);
PlayListVariant.vt = VT_ARRAY;
VT_ARRAY(PlayListVariant) = pPlayListArray;

// Put the file name into the array.
VARIANT *pvarArrayEntry;
SafeArrayAccessData(pPlayListArray, (void**)&pvarArrayEntry );

// Allocate the string and put it into the array.
VariantInit(pvarArrayEntry);
pvarArrayEntry.vt = VT_BSTR;
VT_BSTR(pvarArrayEntry) = SysAllocString(L"c:\MyFile");

long lArrayPos = 1;
SafeArrayPutElement(pPlayListArray, &lArrayPos, &pvarArrayEntry );
SafeArrayUnaccessData(pPlayListArray);

// Add other file names and/or IStream(s) to the array.

// Pass the array to the terminal.
pMediaPlayback->put_PlayList(pPlayListArray);

// Select the terminal on call.
pCall->SelectTerminalOnCall(pFilePlaybackTerminal);

// Start playback.
pFilePlaybackTerminal->QueryInterface(
IID_ITmediaControl,
(void**)&pMediaControl);
pMediaControl->Start()

// Playback will stop when the file finishes
// or when the application makes the following call.
pMediaControl->Stop();

// Clean up code
pFilePlaybackTerminal->Release();
pMediaControl->Release();
pMediaPlayback->Release()
Assuming the file contains one audio stream and one video stream, and the call has a capture audio stream and a capture video stream, the file will be played back on the two outgoing streams.
pleaze reply to this
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top