The disclosed embodiments disclose techniques for optimizing the display of videos. During operation, a computing device receives a video stream to be displayed. The computing device determines a preferred orientation for the video stream, determines a present orientation for the computing device, and determines a mismatch between the preferred orientation and the present orientation. The computing device adjusts the video stream while displaying the video stream on the display. As the video stream plays, the computing device detects any rotation of the computing device, and if so, re-adjusts how the video stream is displayed.