问题
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];
回答1:
I assume you are using YouTube's youtube-ios-player-helper for iOS.
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.
See this GitHub issue on the project page. Unfortunately, this is the expected behavior of the class.
来源:https://stackoverflow.com/questions/29237984/change-playback-quality-of-ytplayerview