On Minecraft, is there a way to make the Jukebox play music only within a certain proximity?

If so, how do I do it to make it work?

Wire it up so that it is only active from a certain distance (use either pressure pates or sunlight

There's no way to control the on/off control a juke box, no remote activation, nothing.
It maybe possible to do it with a mod, for PC, but in the standard game, there's no way to control the on/off function