I have a piece of Javascript that can successfully make a Embedded YouTube video always play in HD(if that video was uploaded in HD aswell).
My Problem: When I run the code in Internet Explorer it wont play the video in HD720 it only plays it in 420(Large=420px). When I run this exact code in Chrome, Firefox and Safari they all play the video in HD720.
Do you know how I can make IE always play my Embedded Youtube videos in HD720?
My Code: See the note below why 'hd720' doesn't work:
<script type="text/javascript" src="https://www.youtube.com/player_api"></script>
<script>
function onPlayerReady(event) {
event.target.setPlaybackQuality('highres');
// NOTE: MAKING the above value 'hd720' makes NONE of the browsers
// play the video in HD720, test it for yourself to see.
// So thats NOT a solution.
}
function loadYouTubeVideo(uid) {
setTimeout( function() {
var id = uid;
var instPlayer = new YT.Player(id, {
height: '480',
width: '853',
enablejsapi: 1,
suggestedQuality: 'highres',
videoId: uid,
events: {
'onReady': onPlayerReady
}
});
}, 500);
}
</script>
Then you embed a Youtube video in your page like so(Note *VIDEO_ID* is your youtube video's unique ID):
<div id="VIDEO_ID"></div>
<script>
loadYouTubeVideo("VIDEO_ID");
</script>