Formula One world champion Lewis Hamilton has apologized for posting a video on social media which was widely criticized for gender "shaming" his nephew for wearing a princess dress.