2

I'm using YTPlayerView to play videos from Youtube in an iOS app. (See Youtube Helper Library)

And I'm facing a little issue that I would like to solve: video previews have low quality when using the following method:

- (void) cueVideoById:(NSString *)videoId startSeconds:(float)startSeconds suggestedQuality:(YTPlaybackQuality)suggestedQuality , which is recommended to use when loading another video into web view.

If I use - (BOOL) loadWithVideoId:(NSString *)videoId playerVars:(NSDictionary *)playerVars , then preview quality is fine, but this will reload the web view, not recommended. See sample screenshots:

enter image description here enter image description here

As suggested quality I use kYTPlaybackQualityAuto, also I tried the best ones without success.

How could I solve this and get a better preview quality without reloading videos every time?

iOS Dev
  • 4,143
  • 5
  • 30
  • 58
  • possible duplicate of [Change Playback Quality of YTPlayerView](http://stackoverflow.com/questions/29237984/change-playback-quality-of-ytplayerview) – JAL Apr 30 '15 at 17:26

1 Answers1

1

Just call this method after initialising the player.

[youtubePlayer setPlaybackQuality:kYTPlaybackQualityHD720];

Following are the possible values-

typedef NS_ENUM(NSInteger, YTPlaybackQuality) {
    kYTPlaybackQualitySmall,
    kYTPlaybackQualityMedium,
    kYTPlaybackQualityLarge,
    kYTPlaybackQualityHD720,
    kYTPlaybackQualityHD1080,
    kYTPlaybackQualityHighRes,
    kYTPlaybackQualityAuto, /** Addition for YouTube Live Events. */
    kYTPlaybackQualityDefault,
    kYTPlaybackQualityUnknown /** This should never be returned. It is here for future proofing. */
};
Vaibhav Khatri
  • 101
  • 3
  • 9
  • Thanks for your reply, but unfortunately it didn't help. – iOS Dev Apr 30 '15 at 12:04
  • Is anything printing in the log? You can set breakpoint and check when the quality changes. – Vaibhav Khatri May 01 '15 at 09:58
  • @RaduMatei implement the `didChangeToQuality` delegate method, log the `YTPlaybackQuality` quality returned from that video, and post the results back here. – JAL May 02 '15 at 17:53
  • YTPlayerView is used in my iOS app. How can I update or migrate the app? Because in the YTPlayerView there is UIWebView's are available. – sejn Feb 09 '22 at 09:30