Running extra code when play button is pressed on player

Jul 21, 2010 at 3:09 PM

Hi;

forgive me right off the bat for such a simple question for sure but I want to run a bunch of code and attach it to the PLAY button on the media player...  For the life of me I am drawing a blank...  Say I want to call a WCF web service before I actually play the media...  can anyone contribute a code stub or sample on where to place code that will be called when the user presses play.. now i know how to call a web service and all of that but i just want the starting point to actually attach code to the play button on the player...   I thank you in advance for any help you may be able to contribute... I am new to C# and new to this API so any pointers on how to add more/extend funtionality to the play button however seemingly insignificant would help

Cheers;

Brendon

Jul 21, 2010 at 4:22 PM

Hi;

nobody seems to have any imput yet so here is a snippet of what I am trying to do...  I just can't seem to find the right function signature as I keep getting the error... that no overload matches deligate.  I am thinking this may be a quick answer to someone who knows this better than I as I can't find a function signature for this or am I missing the boat all together on this...

Please help if you can spare the time as I am stuck here and a little bit of help on this will go a long way for me...  I have most everything else I need written.... 

Thanks in Advance

Brendon

 

MYPlayer.Play += new Action<SMFPlayer>(MYPlayer_Play);

 

void MYPlayer_Play(object sender, RoutedEventArgs e)
{
}

 

 

 

Jul 21, 2010 at 6:58 PM

Ok... thanks for ALL the great input...NOT!!!!   However I now know that I have to extend the player to override the play function.  Wasn't sure exactly how to accomplish that but lots of digging got me the answer...  just lack of exposure on my part I guess...  In case anyone else wonders this...  that is the answer...

 

Coordinator
Jul 21, 2010 at 7:52 PM

brendonr, extend from SMFPlayer and override the Play() method.  Something like this:

public class BrendonsPlayer : SMFPlayer

{

public override void Play()

{

base.Play();

//Do your thing here.

}

}

Jul 21, 2010 at 8:05 PM

Thanks...

that is the answer and I got it working now...  took me a while to find it but it may help someone else....

 

Cheers;

Brendon