Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make setPlaybackQuality work? #66

Open
chiakie opened this issue Jan 21, 2015 · 2 comments
Open

How to make setPlaybackQuality work? #66

chiakie opened this issue Jan 21, 2015 · 2 comments

Comments

@chiakie
Copy link

chiakie commented Jan 21, 2015

First, I've tried many solution, like http://goo.gl/OnJw0Z, but still not working.
Then I tried to invoke player.loadVideoById:startSecond:suggestQuality with hd720 during PLAYING state. But it still turns to low video quality.
Someday I tried to invoke player.setSize(1280,720), it did change quality to hd720! But video visible area is out of current player view bound (e.g. 320x180). Not a solution.

I wonder, is there any way to play high quality video on iPhone with youtube-ios-player-helper?

@Kowaio
Copy link

Kowaio commented Jan 21, 2015

Hello @chiakie

I did a lot of research and tests too regarding this matter since I'd like to play a video in hd720 quality in portrait mode (with width = 375 height = 210 in my case) in order for it to not reload when rotating my device and so playing the video in the new width = 667 height = 375 (iPhone6).

However, I didn't find anything that works. The YT iframe API seems to force the reload as soon as the resolution changes, so I'm hitting a wall too here.

Another member told me that it is the correct behavior on iPhone to avoid playing a kickass quality for 3G/LTE network. However I think that forcing a reload when the user rotates its device (since we're resizing the view) is also intrusive and not smooth imho.

I hope this will be fixed soon or that a solution will present itself.

Feel free to comment our posts if anyone's got an input about that.

Thanks again,

Best regards,

K

@ssimonov
Copy link

Actually no, workaround:

- (void)initializateYTPlayerViewInView:(UIView *)view {
    NSDictionary *playerVars = @{@"controls" : @1,
                                 @"playsinline" : @1,
                                 @"autohide" : @1,
                                 @"modestbranding" : @1,
                                 @"iv_load_policy" : @3,
                                 @"rel" : @0};

    self.YTPlayerView = [YTPlayerView new];
    self.YTPlayerView.frame = view.bounds;
    self.YTPlayerView.delegate = self;
    [view addSubview:self.YTPlayerView];

    [self.YTPlayerView loadWithVideoId:@"OG2eGVt6v2o" playerVars:playerVars];  // Initialize player
}

- (void)playerViewDidBecomeReady:(YTPlayerView *)playerView {
    [self.YTPlayerView loadVideoById:@"OG2eGVt6v2o" startSeconds:0.0f suggestedQuality:kYTPlaybackQualitySmall];  // Force awful quality at start
}

- (IBAction)changeQualityAction:(id)anObject {
    [self.YTPlayerView loadVideoById:@"OG2eGVt6v2o" startSeconds:self.YTPlayerView.currentTime suggestedQuality:kYTPlaybackQualityHD720];  // Force HD Quality
}

Edited: oh yeah, they can force Medium quality, if your view doesn't fit HD quality size. But this workaround can help, if you gonna use lower qualities @ fullscreen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants