MediaPlayer issue locking up notification:

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hello,

1. What is the best way to get a notification or event when user
clicks on "Update Library" in the Media Player?

2. In one thread I have setup ChangeNotification on "\Application Data
\Microsoft\Media Player" folder using FindFirstChangeNotification,
since this is where the *.mlb file is located on the phone. In another
thread I am creating a list of all the songs in the media library by
walking through the Media Collection as shown below. However once the
following piece of code is executed, I see that I do NOT receive any
new Change Notification, when I press "Update Library" in the Media
Player. I created a standalone application that just watches the
"\Application Data\Microsoft\Media Player" folder, in that application
I get the notification about "update library" after I quit the thread
below. If I do not execute the whole loop and just walk through the
loop just once, then I receive the change notification whenever Media
Player library is updated. I checked for any resource leak or memory
leak and I do not see it. Am I missing anything?

----------------------------------------------------------------------------------------------------------------------------
// Get the 'media collection' interface from m_pCore
which is of type IWMPCore *
if (!SUCCEEDED(m_pCore->get_mediaCollection
(&pMediaCollection)))
{
break;
}

if (!SUCCEEDED(pMediaCollection->getAll
(&pMediaItems)))
{
break;
}

long plCount;
if (!SUCCEEDED(pMediaItems->get_count(&plCount)))
break;
BSTR bAttrNames[3];
bAttrNames[0] = SysAllocString(L"Title");
bAttrNames[1] = SysAllocString(L"Author");
bAttrNames[2] = SysAllocString(L"Album");
for (long i = 0; i < plCount; i++)
{
if (!SUCCEEDED(pMediaItems->get_item(i, &pMedia)))
break;

for (long k = 0; k < 3; k++)
{
BSTR bAttrVal = NULL;
if (SUCCEEDED(pMedia->getItemInfo(bAttrNames
[k], &bAttrVal)))
{
appendToBuff(_pData, bAttrVal);
appendToBuff(_pData, L"\t");
}
}
appendToBuff(_pData, L"\t\t\t\n");
nLinesWritten++;
}

for (long k = 0; k < 3; k++)
SysFreeString(bAttrNames[k]);
//Write to the file.
if (_pData)
free(_pData);
if (pMediaCollection)
pMediaCollection->Release();
if (pMediaItems)
pMediaItems->Release();
if (pMedia)
pMedia->Release();
----------------------------------------------------------------------------------------------------------------------------

Thanks in advance,
Rashmi.
.



Relevant Pages

  • Re: MediaPlayer issue locking up notification:
    ... clicks on "Update Library" in the Media Player? ... new Change Notification, when I press "Update Library" in the Media ... loop just once, then I receive the change notification whenever Media ...
    (microsoft.public.windowsmedia.sdk)
  • RE: Media Player 10 und SATA-Brenner
    ... dass auf Ihrem Computer der Windows Media ... Player in der neuesten Version installiert ist. ... Klicken Sie bitte anschließend auf. ...
    (microsoft.public.de.german.windowsxp.multimedia)
  • Re: Get nasty security message using EMBED in html
    ... Song should play automatically. ... media file types, ... usually can use an ActiveX object to play on an IE browser. ... The media is played by a media player and not a browser. ...
    (alt.html)
  • Re: How can I disable windows media center in vista
    ... off Media Center as autoplay in the AutoPlay settings, ... Inserting a dvd still opens up media center. ... Microsoft hasn't seen fit to FIX it's Media Player. ...
    (microsoft.public.windows.vista.music_pictures_video)
  • Re: How can I disable windows media center in vista
    ... Inserting a dvd still opens up media center. ... Go to Control Panel, then Auto Play. ... Microsoft hasn't seen fit to FIX it's Media Player. ...
    (microsoft.public.windows.vista.music_pictures_video)