Hi Ron,
After you start the player, try calling System.Threading.Thread.Sleep(500),
but with the desired wait time in milliseconds (my example is 1/2 second).
Then you can retrieve the attribute.
If the player is running on the executing thread than you'll have to wait
asynchronously. Maybe a bit convoluted, but here's one solution:
// 2.0 framework syntax
System.Threading.SynchronizationContext context =
System.Threading.SynchronizationContext.Current;
MethodInvoker invoker = new MethodInvoker(delegate()
{
// this code will run asynchronously
System.Threading.Thread.Sleep(500);
context.Send(delegate(object state)
{
// this code will run on the main UI thread
// TODO: retrieve value
}, null);
});
// TODO: start player
invoker.BeginInvoke(delegate(IAsyncResult result)
{
invoker.EndInvoke(result);
}, null);
--
Dave Sexton
http://davesexton.com/blog http://www.codeplex.com/DocProject (Sandcastle in VS IDE)
"Ronald S. Cook" <rc***@westinis.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
In my Win app, I'm needing to load a media file into my Windows Media
Player control, and THEN read an attribute from the file.
The thing is, the file has to be playing for a split second before the
attribute can be read.
I can have wmpPlayer.URL = @"D:\Web\FWT\TestFile.wma"; in my form load
event and then a button on the form to get the value I need...
label1.Text = wmpPlayer.currentMedia.getItemInfo("Abstract");
But I don't want to have to manually click a button. I want the form to
load, start playing the file, and then somehow trigger an event to go and
get the attribute.
Thanks for any help.
Ron