United States Code specifies how people should act when the Star-Spangled Banner is played: "All present except those in uniform should stand at attention facing the flag with the right hand over the heart; men not in uniform should remove their headdress with their right hand and hold the headdress at the left shoulder, the hand being over the heart."
The uniform in question is military, not athletic.
This is not mandatory in the sense of law. It does show the proper respect. If you do not show the proper respect, you may find yourself subject to criticism and other problems.
But this is still a free country and you may do as you wish.