Skip to content
This repository has been archived by the owner on Mar 15, 2021. It is now read-only.

Fullscreen doesn’t preserve original aspect ratio #11

Open
DrWhat opened this issue Jun 24, 2010 · 2 comments
Open

Fullscreen doesn’t preserve original aspect ratio #11

DrWhat opened this issue Jun 24, 2010 · 2 comments

Comments

@DrWhat
Copy link

DrWhat commented Jun 24, 2010

When clicking the fullscreen button for videos on YouTube, the video will stretch to fill the entire screen disregarding the original aspect ratio of the video.

A possible workaround can be found inside this extension:

http://www.cyberhq.nl/2010/06/08/restore-full-screen-playback-in-youtubes-html5-player.html

@ghost
Copy link

ghost commented Jun 24, 2010

I've noticed this as well—it's a lot more apparent on older 4x3 YouTube videos like this one:

http://www.youtube.com/watch?v=bNF_P281Uu4

@DrWhat
Copy link
Author

DrWhat commented Jun 25, 2010

Indeed, it is.

This is how the author of FullScreenYouTube deals with it:

function goToFullScreen(){
var video = document.getElementsByClassName("video-stream")[0];

// Set the width of the video /element/ to the width of the actual video to
// prevent stretching a 4:3 video onto a 16:9 screen
// Note: this currently breaks the 'change size' function because the size sticks and
// we can't detect exiting full-screen to reset it.
var w = (video.clientHeight * video.videoWidth) / video.videoHeight;

video.style.width = Math.ceil(w) + "px";
video.style.height = video.clientHeight + "px";

video.webkitEnterFullScreen();

}

Pretty neat and it does the job well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant