INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Play/Pause shortcut key behavior not global  (Read 4019 times)

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Play/Pause shortcut key behavior not global
« on: April 09, 2015, 04:00:54 pm »

With pretty much every music player I've ever used, the space bar is the play/pause key.  This works in MC.  However, I have to be clicked on a certain part of the interface for that to work.  If I'm in the left side bar, space bar seems to expand list items or something like that.  Moving the mouse to another area of the screen is not enough to change this.  I have to click on the appropriate area (like the top bar, or the middle) for the behavior to change.

I'd love it if I didn't have to figure this out each and every time I want to pause the music I'm playing.  Is there a way to make play/pause a global shortcut key?  Remember that the custom resources area does NOT seem to work on MC for Mac.

Thanks for any help on this.

Brian.
Logged

HTPC4ME

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 2760
  • LIFE IS A RADIO... CRANK IT UP TO 11!
Re: Play/Pause shortcut key behavior not global
« Reply #1 on: April 09, 2015, 04:21:00 pm »

i didn't have any luck...
http://yabb.jriver.com/interact/index.php?topic=96652.0


edit... sorry didnt notice this was in Mac section. but same issue anyways with windows.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Play/Pause shortcut key behavior not global
« Reply #2 on: April 12, 2015, 03:17:33 pm »

To clarify:  I'm not talking about using keyboard shortcuts to play and pause when I'm focused on OTHER programs.  I'm talking about when MC is the program on top.  I can only use <space bar> to play/pause when I'm clicked on a specific part of the window.  I'd like to just be able to press <space bar> without having to click on a specific part of the window first.

Thanks for any help,

Brian.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Play/Pause shortcut key behavior not global
« Reply #3 on: May 04, 2015, 12:02:33 pm »

Bump.

tl;dr:  I want to press <Space> any time MC is my foreground window and have the music play or pause.  Any insight on how that works?

Thank you!

Brian.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Play/Pause shortcut key behavior not global
« Reply #4 on: May 18, 2015, 12:11:27 pm »

I've just tried to work on this one more time and finally had some luck.  I wish someone could have given me more guidance.

All I wanted to was for <Space> to play/pause MC when I was focused on the window.  It seems <Space> is mapped to other things depending on where in the window you are clicked.  Overriding the key mapping in Resource.xml works but it has to be one of the last key mappings in the file.  This now works no matter where in the window I'm focused.  Yay!

I've also finally gotten a working solution for making these changes OUTSIDE of the contents of the Media Center application.  Previously, we had to make changes toResource.xml inside the app, in it's file structure, and it would be over-written with each app update.  I've taken an idea from Glynor and made a symbolic link from inside the app, to a directory in my Library.  It looks like this:

/Applications/Media Center 20.app/Contents/Resources/Data/Custom Resources ->
/Users/bgentry/Library/Application Support/J River/Media Center 20/Data/Custom Resources/

The -> represents a symbolic link.  Also known as an alias in Mac OSX.  I had to delete the Custom Resources folder from inside the app first.  Then create the symbolic link with the "ln -s" command from the Terminal. 

Now I have Resource.xml in my Library folder as shown above and my custom keys work as expected!

Of course when I update Media Center, I'm going to have to recreate that symbolic link, but that's pretty easy.

Finally, I should mention that I also found out that the media keys on a Macbook Pro (and other Macs with these keys) control Media Center as long as it was the LAST MEDIA APP you were in.  The keys I'm talking about are Play/Pause, track forward and track backward keys located just above 7,8, and 9 on the keyboard.  These 3 keys control MC, even if you're focused on another app (like a web browser).  This is fairly convenient, but the keys are small and I sorta prefer to just switch to MC and hit <space> if I want to pause.

I hope this helps someone else.  It took me quite a bit of experimentation to get it to work.

Thanks,

Brian.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Play/Pause shortcut key behavior not global
« Reply #5 on: May 18, 2015, 01:12:52 pm »

I didn't respond on this before because I'm not sure, but I think this is a bad idea. The spacebar key mapping is limited like that to ensure that it functions normally in other places in MC where you want to, you know, type a space.

If you really succeeded, you might end up reverting the change.

But, I'm not sure.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Play/Pause shortcut key behavior not global
« Reply #6 on: May 18, 2015, 03:05:27 pm »

I didn't respond on this before because I'm not sure, but I think this is a bad idea. The spacebar key mapping is limited like that to ensure that it functions normally in other places in MC where you want to, you know, type a space.

Do you have another suggestion?  Space is a fairly universal keyboard mapping for play/pause in media players.  I've never seen one that had a problem with you typing spaces in data entry fields.

But you *are* correct!  This mapping I made prevents me from typing a space character in data entry fields.  Which occurs to me as being completely ridiculous.  But I also realize that in software like this, "with great power comes great responsibility."  ...and it turns out that the authors demonstrate their design intelligence here once again.

The TranslateFlags determine when a character is interpreted as a literal, or as a mapped Accelerator key.  Looks like they use bit flags, because they have values like 8, 16, 32, etc that all control different aspects, and you add them up to select multiples.  All of which is very smart.  :)

Through some quick experimentation, I've determined that TranslateFlags="21" seems to make <Space> do play/pause where I want it to, but not in any data entry field I've tested so far.  Glynor, you seem to know this program as well or better than anyone on the boards.  Any places I should test this to make sure I won't have a gotcha moment later on?

Thanks for your help.  This program is so *great*; but can be a little frustrating when I can't get any help, so I WAY appreciate any help I get from anyone here.  :)

Brian.
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10969
Re: Play/Pause shortcut key behavior not global
« Reply #7 on: May 19, 2015, 05:25:36 pm »

We support Space for Play/Pause in the Windows version. I would be surprised it wouldn't be enabled on Mac. Of course it only works when no other element has focus that would otherwise take keyboard input.
Resource.xml has such an entry by default which enables this: <Entry Key="Space" Command="28011" Param="-1" TranslateFlags="401" />

Reading your post again, I guess the "problem" for you is that some other control actually did have focus?
Its probably the 256 flag which you don't want then, but navigating around the tree manually with a keyboard is much harder without the spacebar .. but if you never use that...
Logged
~ nevcairiel
~ Author of LAV Filters

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Play/Pause shortcut key behavior not global
« Reply #8 on: May 19, 2015, 07:01:10 pm »

^ Yes, I frequently found that the focus was on something other than the player; something like 90% of the time I'd press <space>, it would not play/pause, which was frustrating.  Clicking on the right area and then pressing space worked, but wasn't what I wanted.

Now, having finally figured out where to put the Resource.xml file *and* figured out a way for it to persist between updates, *and* figured out the correct TranslateFlags (21 in this case, though I think 1 or 5 would work equally well), I'm a happy camper.  Plus I finally got Command-Right and Command-Left mapped to change tracks.

Brian.
Logged

avpman

  • Galactic Citizen
  • ****
  • Posts: 445
  • Dad to three beatuiful Boxers by rescue.
Re: Play/Pause shortcut key behavior not global
« Reply #9 on: May 19, 2015, 08:05:19 pm »

^ Yes, I frequently found that the focus was on something other than the player; something like 90% of the time I'd press <space>, it would not play/pause, which was frustrating.  Clicking on the right area and then pressing space worked, but wasn't what I wanted.

Now, having finally figured out where to put the Resource.xml file *and* figured out a way for it to persist between updates, *and* figured out the correct TranslateFlags (21 in this case, though I think 1 or 5 would work equally well), I'm a happy camper.  Plus I finally got Command-Right and Command-Left mapped to change tracks.

Brian.

Brian,
Would you mind posting your resource file map entries for the above?
Thanks!
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Play/Pause shortcut key behavior not global
« Reply #10 on: May 19, 2015, 08:57:14 pm »

Sure.  I've got 5 entries here.  One to bring up the DSP Studio on a hot key.  A second to switch directly to Now Playing.  The other three are for the space bar pause and the arrow key track navigation.

Code: [Select]
    <Entry Key="Ctrl;D" Command="10016" Param="0" />
    <Entry Key="Space" Command="10000" Param="0" TranslateFlags="21" />
    <Entry Key="Ctrl;Right" Command="10003" Param="0" TranslateFlags="21" />
    <Entry Key="Ctrl;Left" Command="10004" Param="0" TranslateFlags="21" />
    <Entry Key="Ctrl;N" Command="10013" Param="1" />

Brian.
Logged
Pages: [1]   Go Up