I regularly listen to music on my Nexus 7 while working or playing my Xbox. It's light and easy to carry around, and has basically become an extension of my body. The only thing that bugs me is having to constantly turn the screen on to pause or change music tracks. Even if I can do it from my lock screen instead of the actual music player app—I don't want to.
There are only three hard keys on the Nexus 7—Power and the Volume Up/Down keys—but for our purposes, three is key (pun very much intended). I'm going to show you a cool mod that'll let you assign your hardware keys to specific actions, like pausing and playing songs with the screen off.
After rooting and installing Xposed, go into Xposed Installer's Download section, then search for and install Physical Button Music Control by developer XspeedPL.
After installing, enable the module by going back into Xposed's Modules section, checking the box next to Physical Button Music Control, and rebooting your device to complete the activation process.
Once your Nexus 7 has rebooted, go to your app drawer and find PBMC Settings (you can also access the app from Xposed Installer under the Modules section).
There are six tabs for the app's settings (they become a pull-down in landscape), so let's start with General.
The first thing we want to configure is when we want this mod in effect, either all of the time or only when headphones are plugged in. If you only want the mod active when using headphones, check Plugged only. Next, you can have the mod instantly start playing music as soon as you plug in headphones by check Plug & Play.
Another preference to focus on is Exclusive signal receiver, which lets you set an exclusive app for use with this mod. It can be useful if you have a bunch of different music players but want to stick to one main one for hardware key control.
Go to the Play/Pause Media Signals tab to set up a playing function. Check Enable play/pause media signals, then tap on Play/Pause media signal key to select the key.
You'll have a few options, but the Power key makes the most logical sense, so pick that one. It makes sense to set up a delay, as you're still going to want a single power key press to control your screen on/off. I'd suggest something like 200ms, but even 100ms will do the trick.
Now, a slight press-and-hold of the Power key will play/pause your music when your screen is off.
The music that plays will depend on the last artist or playlist you were in. For example, if I was listening to a specific album on Google Play Music and close the app, this mod will begin playing that same album.
The next two tabs, Next Media Signals and Previous Media Signals, are basically the skipping tracks options. We'll go over just the Next Media Signals function, as the process will be exactly the same for Previous Media Signals.
First, check Enable media signals, then select Next media signal key to assign a key. I suggest using the Volume Up key with an added delay. Adjust the delay in milliseconds with Key hold time.
The final two tabs are Volume Up Signals and Volume Down Signals. Check Enable volume signals, then choose the Volume up signal key—leave Delay volume up signals unchecked so it doesn't conflict with your track skipping function.
Now, you can turn the screen off, plug in your headphones and begin manipulating your hard keys to play music. And trust me, once you've used this mod for a day or two, you'll wonder how you ever listened to music without it.