改变YTPlayerView的播放质量 [英] Change Playback Quality of YTPlayerView

查看:164
本文介绍了改变YTPlayerView的播放质量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用中存在嵌入式YouTube视频的质量问题。我正在使用 YTPlayerView 来嵌入来自YouTube的视频。我的应用程序有2个选项:选项1是用户可以观看360p质量的视频,选项2是720p质量。这两个选项可能吗?如果是,我可以自定义 YTPlayerView 的视频播放质量吗?

I am having a problem with quality for embedded YouTube videos in my app. I am using YTPlayerView to embed videos from YouTube. My app has 2 options: option 1 is the user can watch video with 360p quality and option 2 is 720p quality. Are these two options possible? If yes, can I customize the video playback quality of the YTPlayerView?

我试图通过这种方式改变质量,但它似乎不起作用:

I tried to change the quality this way, but it does not appear to work:

 [self.playerView setPlaybackQuality:kYTPlaybackQualitySmall];


推荐答案

我假设您使用的是YouTube的 youtube-ios-player-helper

I assume you are using YouTube's youtube-ios-player-helper for iOS.

不幸的是,由于iFrame API的性质,无法强制使用此库进行高质量播放。播放器将以与 YTPlayerView 的大小最接近的分辨率加载视频。如果您以编程方式更改 YTPlayerView 的大小,视图将重新加载视频以适合您的新帧。

Unfortunately, due the to the nature of the iFrame API, it is not possible to force a quality playback with this library. The player will load the video in the closest resolution to your YTPlayerView's size. If you change the size of your YTPlayerView programmatically, the view will reload the video to fit your new frame.

请参阅项目页面上的此GitHub问题。不幸的是,这是该类的预期行为。

See this GitHub issue on the project page. Unfortunately, this is the expected behavior of the class.

这篇关于改变YTPlayerView的播放质量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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