iOS YTPlayerView Strange Behaviour

289 Views Asked by At

I have noticed a strange behaviour of YTPlayerView on iOS, that is, on a iPhone 6s Plus screen portrait with a player both height and width less than 500 but in 16:9 ratio, the auto-selected quality is HD720. However, in an iPad with a player height around 700 and width more than 1000, the auto-selected quality is medium.

Below is a list of devices I have observed:

iPhone 5/5s/4s: medium in both portrait and landscape

iPhone 6/6s/7: medium in portrait, HD720 in landscape

iPhone 6 Plus/ 6s Plus/7 Plus: HD720 in both portrait and landscape

iPad Pro(both size): HD720 in both portrait and landscape

Other iPads than iPad Pros: medium in both portrait and landscape

Based on this, the iframe API(or at least YTPlayerView) does not seem to select its quality based on size. I run these tests in simulators on my Mac, which means there should not be a great difference on network speed or performance.

Does anyone know what's the inside problem? And how could I make HD720 on all iPads? (setPlaybackQuality(.HD720) did not work)

1

There are 1 best solutions below

1
On

I don't know what is the problem with resolution. But if you want to load a video forcefully in particular quality, you can use following lines of code.

- (void)playerViewDidBecomeReady:(YTPlayerView *)playerView 
{
   [playerView loadVideoById:@"YourVideoId" startSeconds:0.0f suggestedQuality: kYTPlaybackQualityHD720];  //This will force the video to load in HD720
}