1
votes

I'm trying to play youtube video on my android app using Youtube Player API for Android but the problem is getting that the video quality of the video is not so good and there is not an option for force setting it to HD. So I tried to play video using Youtube Iframe API in android Webview but also there I'm facing the same problem with video quality.

Iframe Code :

<div class="videowrapper">
     <iframe id=\"player\" width=\"720\" height=\"1280\" frameborder=\"0\" allow=\"encrypted-media\" src=\"https://www.youtube.com/embed/uFExenM7-dY?vq=hd720&amp;enablejsapi=1&amp;controls=0&amp;iv_load_policy=3&amp;modestbranding=0&amp;rel=0&amp;showinfo=0\"></iframe>\n"
</div>

.videowrapper {
     float: none;
     clear: both;
     background:#eeeeee;
     width: 100%;
}
.videowrapper iframe {
     position: absolute;
     width: 100%;
     height: 100%;
}

How to make Youtube video to always play in HD quality?

1

1 Answers

1
votes

Try attaching the vq=VIDEO_QUALITY to a youtube video url like

https://www.youtube.com/watch?v=nzliFQ-36kg&vq=720

To make this work using embed, follow the answer in this SO post.

<object width="1280" height="720"><param name="movie" value="//www.youtube.com/v/VIDEO_ID?hl=en_US&amp;version=3&amp;rel=0&amp;vq=hd720"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>

Testing on JSFiddle.

Don't forget to change VIDEO_ID to valid one when testing this.