Embedded Youtube: How to get high quality on iOS 7

2019-04-11 22:50发布

I have an embedded youtube video on a web page. On the desktop it works fine. However, on an ipad (running iOS7) the video quality is rather poor, probably 480p. Inside the iframe it looks fine, but when you make the video full screen it is very noticeable. I have tried using hd=1&vq=hd720 in the querystring and using cueVideoById with a suggested quality of 'hd720' but neither worked. Are there any work arounds either to get higher resolution on the ipad when embedded youtube videos are made fullscreen, or to force higher resolution for embedded youtube videos on the ipad?

1条回答
Viruses.
2楼-- · 2019-04-11 22:56

I found a workaround that works, although it is hardly elegant.

Basically, I create the iframe with a dimensions large enough to get 720p quality. (Such as making the iframe 720x440 pixels.) And then, I use CSS transforms to scale the iframe back down to the size I want. The CSS looks something like:

-webkit-transform-origin: left top;
-webkit-transform: scale(0.5);

Where 0.5 could be replaced with whatever scale you had to increase the size of the iframe by.

The main downside to this from the user's perspective is that the video controls are scaled down. However, in full screen mode the controls are the normal size, and the user can pinch out to full screen, so for my team at least the trade-off in increased video quality was worth it.

查看更多
登录 后发表回答