WMP doesn't play a media on a thread
- From: sisimma <sisimma@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 14 May 2008 13:46:07 -0700
Hi,
I've been experiencing a weired situation with WMP interfaces.
I made a simple function which plays a media(Beep.mp3).
It sounds well when it is called from a class, but it doesn't sound when
called from a thread which is created by the class on init function of the
class.
Is there anyone who can tell the difference between a class, which maybe it
runs on a process, and a thread, which is created from the class?
IS there a way to run the MAWMPControl on a thread so that it can play media
files?
Thank you in advance with any comment
HRESULT MAWMPControl()
{
IWMPPlayer4 *pWP;
IWMPSettings *pWPSet;
IWMPControls *pWPCtrl;
CoInitializeEx(NULL,COINIT_MULTITHREADED);
HRESULT hr = S_OK;
CComBSTR bstrVersionInfo;
BSTR bstr_path, bstr_playmode;
hr = CoCreateInstance( __uuidof(WindowsMediaPlayer), NULL,
CLSCTX_INPROC_SERVER, __uuidof (IWMPPlayer4),(void **)&pWP);
hr = pWP->QueryInterface(__uuidof(IWMPSettings), (void **)&pWPSet);
hr = pWP->QueryInterface(__uuidof(IWMPControls), (void **)&pWPCtrl);
bstr_path = SysAllocString(L"\\Program Files\\CMA16\\Beep.mp3");
bstr_playmode=SysAllocString(L"loop");
hr = pWP->openPlayer(mybstr);
hr = pWPSet->setMode(bstr_playmode,TRUE);
hr = pWPSet->put_autoStart(TRUE);
//hr = pWPSet->put_playCount(100);
hr = pWPSet->put_volume(100);
hr = pWP->put_URL(bstr_path);
CoUninitialize();
return hr;
}
.
- Follow-Ups:
- Re: WMP doesn't play a media on a thread
- From: Alessandro Angeli
- Re: WMP doesn't play a media on a thread
- Prev by Date: Re: Media Player API + uimode problem
- Next by Date: Re: WMP doesn't play a media on a thread
- Previous by thread: Read wmcap.exe output in Java.
- Next by thread: Re: WMP doesn't play a media on a thread
- Index(es):
Loading