The phrase “to play to the gallery” means to seek popular acclaim.
The expression came from the theater, as long ago, at least, as the seventeenth century.
Originally, the notion seems to have been a play that was written expressly for those in an audience thought to have been of lower intelligence and, hence, to occupy the gallery seats, rather than for the educated persons who had seats below.
Later, the reference was, as it is today, to the actor or other public person who, cheapening his abilities, seeks the favor of the populace without troubling to exhibit qualities that might also win the approval of the fewer persons able to appreciate skill and artistry.
In America, a synonymous expression, with the baseball diamond as its source, is “to play to the grandstand,” that is, to play for applause from the grandstand; hence, to do something showy for effect.