Group:  English: Entertainment ยป microsoft.public.windowsmedia.sdk
Thread: IWMPControls::put_currentPosition Fails

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

IWMPControls::put_currentPosition Fails
Atif <visitatif[ at ]gmail.com> 02.07.2007 06:49:29
Hi,

I have come to a problem that i think is bug in WinCE WMP, I have put
a lot of time in it.
I am developing an applications that is required audio playback and I
am using IWMPPlayer , IWMPSettings and IWMPControls to control this
audio. Every thing is fine. But IWMPControls::put_currentPosition
failes when i use it while starting audio, imediately after put_URL.
put_currentPosition works fine if I use it after playing few seconds
audio. Kindly help me about this, is it a bug or I am missing some
thing. This is the code I am using to start the audio

#include "wmp.h"

void StartAudio()

{

HRESULT hr;

CComPtr<IWMPPlayer> spWMPPlayer;

CComBSTR bstr(TEXT(""\\Storage Card\\EnmacQuran\\QuranAudio\
\002_01A.mp3"));

CComPtr<IWMPControls> spWMPControls;

hr = CoInitializeEx(NULL,0);

if (SUCCEEDED(hr))

{

hr = spWMPPlayer.CoCreateInstance(__uuidof(WindowsMediaPlayer), 0,
CLSCTX_INPROC_SERVER );

}

if (SUCCEEDED(hr))

{

hr = spWMPPlayer->QueryInterface(__uuidof(IWMPControls),
(void**)&spWMPControls);

}

if (SUCCEEDED(hr))

{

spWMPPlayer->put_URL(bstr); // Audio started

}

if (SUCCEEDED(hr))

{

spWMPControls->put_currentPosition(100.0); // failed

}

else

{

CString s;

s.Format(TEXT("%x"),hr) ;

MessageBox(0,s,0,0);

}


}

audio starts playing from start but instruction spWMPControls-
[Quoted Text]
>put_currentPosition(100.0) failes here. It gives error 0xc00d1080,
that seems to be undocumented in MSDN.

please help me about this matter.

Regards

Atif

Re: IWMPControls::put_currentPosition Fails
"Oleksandr Paraska" <shoniko[ at ]gmail.com> 03.07.2007 00:57:42
That error means: "the current state of the player does not allow that
operation". So I think that the player did not start playback yet when you
call put_currentposition (WindowsCE devices are not as fast and powerful as
full PCs).. I don't think that's a bug, though.


"Atif" <visitatif[ at ]gmail.com> wrote in message
news:1183358969.771789.143740[ at ]k79g2000hse.googlegroups.com...
[Quoted Text]
> Hi,
>
> I have come to a problem that i think is bug in WinCE WMP, I have put
> a lot of time in it.
> I am developing an applications that is required audio playback and I
> am using IWMPPlayer , IWMPSettings and IWMPControls to control this
> audio. Every thing is fine. But IWMPControls::put_currentPosition
> failes when i use it while starting audio, imediately after put_URL.
> put_currentPosition works fine if I use it after playing few seconds
> audio. Kindly help me about this, is it a bug or I am missing some
> thing. This is the code I am using to start the audio
>
> #include "wmp.h"
>
> void StartAudio()
>
> {
>
> HRESULT hr;
>
> CComPtr<IWMPPlayer> spWMPPlayer;
>
> CComBSTR bstr(TEXT(""\\Storage Card\\EnmacQuran\\QuranAudio\
> \002_01A.mp3"));
>
> CComPtr<IWMPControls> spWMPControls;
>
> hr = CoInitializeEx(NULL,0);
>
> if (SUCCEEDED(hr))
>
> {
>
> hr = spWMPPlayer.CoCreateInstance(__uuidof(WindowsMediaPlayer), 0,
> CLSCTX_INPROC_SERVER );
>
> }
>
> if (SUCCEEDED(hr))
>
> {
>
> hr = spWMPPlayer->QueryInterface(__uuidof(IWMPControls),
> (void**)&spWMPControls);
>
> }
>
> if (SUCCEEDED(hr))
>
> {
>
> spWMPPlayer->put_URL(bstr); // Audio started
>
> }
>
> if (SUCCEEDED(hr))
>
> {
>
> spWMPControls->put_currentPosition(100.0); // failed
>
> }
>
> else
>
> {
>
> CString s;
>
> s.Format(TEXT("%x"),hr) ;
>
> MessageBox(0,s,0,0);
>
> }
>
>
> }
>
> audio starts playing from start but instruction spWMPControls-
>>put_currentPosition(100.0) failes here. It gives error 0xc00d1080,
> that seems to be undocumented in MSDN.
>
> please help me about this matter.
>
> Regards
>
> Atif
>

Re: IWMPControls::put_currentPosition Fails
"Alessandro Angeli" <nobody[ at ]nowhere.in.the.net> 03.07.2007 04:44:33
From: "Atif"

[Quoted Text]
> But IWMPControls::put_currentPosition failes when i use
> it while starting audio, imediately after put_URL.
> put_currentPosition works fine if I use it after playing
> few seconds audio. Kindly help me about this, is it a bug
> or I am missing some thing. This is the code I am using

As Oleksandr said, most likely the player hasn't started
playing if you call put_currentPosition() too soon. This is
by design and you are supposed to wait for the playState to
transition to Playing before calling playback-related
methods. You can either block while listening for the
PlayStateChange event or lazily poll the playState property
(the latter is much easier and adequate for your needs).


--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net