Safari(iOS):嵌入的YouTube视频始终以低质量播放 [英] Safari(iOS): Embed YouTube Video Always Plays In Low Quality

查看:219
本文介绍了Safari(iOS):嵌入的YouTube视频始终以低质量播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在移动电视网络应用上播放分辨率至少为720p的YouTube视频,但野​​生动物园总是会以最低的质量播放它们.

I need to play YouTube Videos with at least 720p resolution on my mobile tv web app, but safari plays them always with the lowest quality, that sucks.

我尝试了许多已经发布的解决方案,但是它们似乎已经过时了.例如不幸的是,&vq=hd720&hd=1&vq=hd1080附加到嵌入的iframe上.

I tried a lot of solutions that have been already posted, but they seem to be outdated. e.g. &vq=hd720, &hd=1, &vq=hd1080 appending to the embed iframe, unfortunately it's not working.

我也尝试使用youtube javascript API做到这一点,这真是令人惊讶,也没有运气.

I also tried to do it with the youtube javascript api, what a surprise, no luck either.

我可以尝试其他解决方案吗?这些视频以720x1280的肖像格式上传.

Any other solutions I could try? The Videos are uploaded in portrait format 720x1280.

推荐答案

我今天遇到了这些完全相同的问题,最终想到了一些可以满足我特定需求的技巧.诀窍是将包裹iframe嵌入的父元素之一的大小加倍,然后使用转换将其再次缩小.例如:

I ran into these exact same issues today and ultimately came up with a bit of a hack that worked for my specific needs. The trick is to double the size of one of the parent elements that's wrapping the iframe embed and then to scale it down again using a transform. For example:

.video-wrap {
  width: 200%; 
  transform: scale(0.5);
  transform-origin: left top;
}

或者,如果您想精确地获得360、720、1080等,也可以为其指定确切的宽度/高度.

Alternatively, you can also specify an exact width/height for it if you're trying to get exactly 360, 720, 1080, etc.

此解决方案"的唯一主要缺点是,它还会缩小整个视频播放器的用户界面.就我而言,这是可以接受的,因为还有其他UI元素可以让用户控制视频.

The only major downside to this "solution" is that it will also scale down the whole video player UI. In my case this was acceptable because there are other UI elements that allow the user to control the video.

我也将这些样式仅基于css断点应用于较小的屏幕,因为较大的屏幕无论如何都会拉入正确分辨率的视频.

I'm also only applying these styles to smaller screens based on css breakpoints, because the larger screens pull in the right resolution video regardless.

我真的希望YouTube最终能够修复其setPlaybackQuality函数,但是与此同时,我希望这可以帮助某人.

I really hope YouTube will eventually fix their setPlaybackQuality function, but in the mean time, I hope this helps someone out.

这篇关于Safari(iOS):嵌入的YouTube视频始终以低质量播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆