|
Posted by Chaser7016 on April 30, 2006, 9:30 pm
Please log in for more thread options
Can this code be placed into a html page and visitors on Windows Smartphones
will then see the embedded WM Player? I want to have the ability through my
Windows Smartphone to go to my website via the phone, see the embedded WM
Player and then tune into my online radio station.
If this is the code, where would I add the socket information for my online
radio station?
Cheers, Chaser
"Tom Moon" wrote:
> > Hi Tom,
> > I'm trying desperately to find a way to
> > play a mp3 in my Winmobile 5.0 Application without opening a WMP Window.
> > I read most of your posts in google groups and it seems to me that you are
the only one
> > who has been at least almost succesful with this task.
> > Did you have any newer success with it recently?
> > Thanks for any help in advance.
> > Sincerely,
> > Bojan Konic,
> > Student at ETH Zuerich, Switzerland
>
> Yes, I was able to play mp3s with WinMobile5.0 WMP10.
>
> Start from here:
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/usingthewindowsmediaplayercontrolinaconsoleapplica.asp
>
>
> <code>
> CComBSTR bstrVersionInfo; // WMP version string.
> // COM smart pointers to WMP interfaces
> CComPtr<IWMPPlayer> spPlayer;
> CComPtr<IWMPPlayer3> spPlayer3 = NULL;
> CComPtr<IWMPCore> spWMPCore = NULL;
> CComPtr<IWMPCore3> spWMPCore3 = NULL;
> CComPtr<IWMPControls> spControls = NULL;
> CComPtr<IWMPSettings> spSettings = NULL;
> CComPtr<IWMPSettings2> spSettings2 = NULL;
> CComPtr<IWMPPlaylist> spPlaylist = NULL;
>
> HRESULT hr = CoInitializeEx(NULL,COINIT_MULTITHREADED);
> if(S_OK != hr){
> return FALSE;
> }
>
> // this is the most important interface
> hr = spPlayer.CoCreateInstance(
> __uuidof(WindowsMediaPlayer), 0, CLSCTX_INPROC_SERVER
> );
>
> // set the other derived and retrieved interface pointers
> hr = spPlayer->QueryInterface(&spWMPCore);
> hr = spWMPCore->QueryInterface(&spWMPCore3);
> hr = spPlayer->QueryInterface(&spPlayer3);
> hr = spPlayer->get_settings(&spSettings);
> hr = spPlayer->get_controls(&spControls);
> hr = (spPlayer)->get_currentPlaylist(&spPlaylist);
>
> // print the version info - sanity check;
> hr = (MMSS_WMP::spPlayer)->get_versionInfo(&bstrVersionInfo);
> wprintf(
> L"Windows Media Player Version '%s'\r\n",
> bstrVersionInfo.m_str
> );
>
> {
> // local smartpointers are cool
> CComPtr<IWMPMedia> spMedia;
> // create a new media with
> // our passed URL (i.e. file path)
> hr = spWMPCore3->newMedia(
> (BSTR)L"//foo.mp3", &spMedia
> );
> hr = spPlaylist->appendItem(spMedia);
> }
> hr = spControls->play();
> </code>
>
>
>
> And of course, here's the WMP COM API reference.
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/interfaces.asp
>
> I ran into a bug (of very many bugs in Mobile WMP) wherein some mp3s
> just wouldn't play. It most likely had something to do with their
> encoding. Try mp3s created by different encoders if the above sample
> doesn't work.
> Also, you should check all returned HRESULTs. I removed that code for
> clarity.
>
> -J Tom Moon
> Qualnetics
>
>
|