How to force youtube to play HD videos
YouTube may be altering the quality of the playback based on your window size. See this article: http://demosthenes.info/blog/717/Force-Embedded-YouTube-Videos-To-Play-In-HD
Pls see this article: http://www.reddit.com/r/youtube/comments/2fckq3/did_youtube_disable_hdlinking_adding_hd1_at_the/
it seems that you could use vq=1080 to suggest the use of hd video, but the HD will be used only when the video window is large enough
I just solved this problem for a website I was working on.
I have embedded iframes with youtube videos in them and they, annoyingly, auto-played at a low resolution despite my wanting them to auto-play at 720p. This issue is caused by the actual size of the video, on your page, being detected by YouTube which will trigger an auto-selection of a lower res.
Here's what I did to keep my video embed small, but have it auto play on 720p etc -
- You need to add ?vq=hd720 at the end of your video id, as you have done.
- Manually set the iframe width to width="1280" height="720" - which will make the video huge on your site.
- Wrap the iframe in a div and give it a class selector so you can style it with css.
- Use CSS to tell your div wrapper to be the size you actually want the video to be.
- Use CSS to set the iframe width:100% and height:100%.
This code will basically set the video size to be that of the resolution you want it to auto-play on, which will trick YouTube into setting this for you. Then the CSS dynamically resizes the video to be whatever actual size you need.
And that's all there is to it :)
CODE EXAMPLE:
HTML
<div class="youtube-embed">
<iframe width="1280" height="720" src="https://www.youtube.com/embed/VIDEOID?vq=hd720" frameborder="0" allowfullscreen></iframe>
</div>
CSS
.youtube-embed {
width : 740px;
height : 400px;
}
.youtube-embed iframe {
width : 100%;
height : 100%;
}