Hi Ron,
After you start the player, try calling System.Threadin g.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.Threadin g.Synchronizati onContext context =
System.Threadin g.Synchronizati onContext.Curre nt;
MethodInvoker invoker = new MethodInvoker(d elegate()
{
// this code will run asynchronously
System.Threadin g.Thread.Sleep( 500);
context.Send(de legate(object state)
{
// this code will run on the main UI thread
// TODO: retrieve value
}, null);
});
// TODO: start player
invoker.BeginIn voke(delegate(I AsyncResult result)
{
invoker.EndInvo ke(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******** ********@TK2MSF TNGP06.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\Te stFile.wma"; in my form load
event and then a button on the form to get the value I need...
label1.Text = wmpPlayer.curre ntMedia.getItem Info("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