Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Entertainment » microsoft.public.windowsmedia.sdk
Thread: Size of media item

HTVi
TV Discussion Newsgroups

Size of media item
Justin Bozalina 7/6/2007 5:00:00 PM
Hi,

I'm new to WMP SDK. I've been working on this problem for a week or so and
haven't been able to come up with a solution. I have a WMP window in my MFC
application that I'm popping up to play an AVI selected in a file dialog.
Playing the file works fine, but I'm trying to size the window correctly
based on the size of the AVI. I'm doing this by putting the URL of my file,
then getting the current media item. However, the
get_imageSourceHeight/Width functions always return zero as their sizes.
Alternatively, is there a way to "autosize" the WMP window. I've looked for
this functionality in the documentation and haven't been able to find
anything about it.

My code:
if(m_spWMPPlayer)
hr = m_spWMPPlayer->put_URL(bstrURL);
if(m_spWMPPlayer2)
m_spWMPPlayer2->put_stretchToFit(TRUE);

IWMPMedia* pMedia = NULL;
long width, height;
m_pWMPCore3->get_currentMedia(&pMedia);
pMedia->get_imageSourceHeight(&height); //height returns = 0
pMedia->get_imageSourceWidth(&width); //width returns = 0

Thanks for any help!

Re: Size of media item
"AUGE_OHR" <AUGE_OHR_NOSPAM_[ at ]CSI.COM> 7/6/2007 5:25:11 PM
hi,

[Quoted Text]
> My code:
> if(m_spWMPPlayer)
> hr = m_spWMPPlayer->put_URL(bstrURL);
> if(m_spWMPPlayer2)
> m_spWMPPlayer2->put_stretchToFit(TRUE);

you have to "play" it before you can get High/wide

> IWMPMedia* pMedia = NULL;
> long width, height;
> m_pWMPCore3->get_currentMedia(&pMedia);
> pMedia->get_imageSourceHeight(&height); //height returns = 0
> pMedia->get_imageSourceWidth(&width); //width returns = 0

greetings by OHR
Jimmy


Re: Size of media item
Justin Bozalina 7/6/2007 6:22:01 PM
Hey Jimmy. I changed the code to try this:

IWMPControls* pControl = NULL;
IWMPMedia* pMedia = NULL;

if(m_spWMPPlayer)
{
m_spWMPPlayer->put_URL(bstrURL);
m_spWMPPlayer->put_stretchToFit(TRUE);
}

m_pWMPCore->get_controls(&pControl);
pControl->play();

long width, height;
m_pWMPCore->get_currentMedia(&pMedia);
pMedia->get_imageSourceHeight(&height);
pMedia->get_imageSourceWidth(&width);

But it still returns zero for the width and height. The functions aren't
failing, they're just not returning the right values.

Re: Size of media item
"AUGE_OHR" <AUGE_OHR_NOSPAM_[ at ]CSI.COM> 7/6/2007 8:19:17 PM
hi,

[Quoted Text]
> m_pWMPCore->get_controls(&pControl);
> pControl->play();

use some "sleep(10)" after "play" but before rest

> long width, height;
> m_pWMPCore->get_currentMedia(&pMedia);
> pMedia->get_imageSourceHeight(&height);
> pMedia->get_imageSourceWidth(&width);

greetings by OHR
Jimmy


Re: Size of media item
Mark Salsbery 7/7/2007 1:04:02 AM
Sleep isn't going to work :/ That would be bad form :)

Maybe add an event handler for PlayStateChange and when the state is 3
(playing) then you can get the video dimensions, duration, etc.

Mark

--
Mark Salsbery
Microsoft MVP - Visual C++


"Justin Bozalina" wrote:

[Quoted Text]
> Hey Jimmy. I changed the code to try this:
>
> IWMPControls* pControl = NULL;
> IWMPMedia* pMedia = NULL;
>
> if(m_spWMPPlayer)
> {
> m_spWMPPlayer->put_URL(bstrURL);
> m_spWMPPlayer->put_stretchToFit(TRUE);
> }
>
> m_pWMPCore->get_controls(&pControl);
> pControl->play();
>
> long width, height;
> m_pWMPCore->get_currentMedia(&pMedia);
> pMedia->get_imageSourceHeight(&height);
> pMedia->get_imageSourceWidth(&width);
>
> But it still returns zero for the width and height. The functions aren't
> failing, they're just not returning the right values.
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen