I am using YTPlayerView
classes to play YouTube
videos. Below is the code i am using to load video according to device screen size (large size for iPad and small size for iPhone). And it is working fine.
Problem --
When i change device mode to landscape, i want larger YTPlayerView
then in portrait mode. For now video has same size for both screen modes.
- (BOOL)loadWithPlayerParams:(NSDictionary *)additionalPlayerParams {
NSDictionary *playerCallbacks = @{
@"onReady" : @"onReady",
@"onStateChange" : @"onStateChange",
@"onPlaybackQualityChange" : @"onPlaybackQualityChange",
@"onError" : @"onPlayerError"
};
NSMutableDictionary *playerParams = [[NSMutableDictionary alloc] init];
[playerParams addEntriesFromDictionary:additionalPlayerParams];
if([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad)
{
[playerParams setValue:@"551px" forKey:@"height"];
[playerParams setValue:@"768px" forKey:@"width"];
}
else
{
[playerParams setValue:@"250px" forKey:@"height"];
[playerParams setValue:@"320px" forKey:@"width"];
}
-----
-----
}
I can not use this check to give larger size to view, because above code does not called in-between video play.
if([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscape)
Do you people have any idea how to fix this problem? Or if there is any other solution using JavaScript and css as html string to webView.