A person who plays to the gallery tries to gain popularity by behaving in a way that will appeal to the majority.
"It's no secret that he got elected by playing to the gallery."