Override OnAction while video is playing (1 Viewer)

bmt

Portal Member
February 17, 2010
23
0
Home Country
Germany Germany
Hi everyone,

I'm stuck with something. Hope you guys can help me.
This is what I want to do:
When a video is playing, i want to add an ActionListener with the key "l"

This is what I got:

Code:
class 1
{
	  ...
      if (control == Play)
      {
        g_Player.Play(file);
	g_Player.ShowFullScreenWindow();
      }

    public override void OnAction(MediaPortal.GUI.Library.Action action)
    {
      switch (action.wID)
      {

        case MediaPortal.GUI.Library.Action.ActionType.ACTION_KEY_PRESSED:
          {
            if ((char)action.m_key.KeyChar == 'l')
            {
              doSomething();
            }
          }
          break;
      }
      base.OnAction(action);	  
    }
	...
}

This is what happens: While the video is playing, there is a new window that doesn't react to my input.
Can I add the OnAction to the current window that is playing the file?

Grateful for any hint!
 

SilentException

Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    I see you're overriding OnAction and that is only working while your window is active.. ShowFullScreenWindow deactivates your window..

    What you need to do is register new action handler like this:

    GUIGraphicsContext.OnNewAction += new OnActionHandler(OnAction2)
     

    dukus

    Portal Pro
    January 20, 2006
    783
    748
    45
    Home Country
    Romania Romania
    Code:
    ......
     GUIGraphicsContext.Receivers += GUIGraphicsContext_Receivers;
    ....
    
        void GUIGraphicsContext_Receivers(GUIMessage message)
        {
          if (message.Message == GUIMessage.MessageType.GUI_MSG_CLICKED)
          {
    .......................
          }
        }
     

    bmt

    Portal Member
    February 17, 2010
    23
    0
    Home Country
    Germany Germany
    Sounds logical to me. And even works.
    Thank you!
     

    Users who are viewing this thread

    Top Bottom