President Obama has praised the bravery of Jason Collins after he became the first openly gay NBA player.