【发布时间】:2014-10-12 12:37:43
【问题描述】:
我正在使用YTPlayerView 类播放YouTube 视频。下面是我用来根据设备屏幕尺寸(iPad 大尺寸和 iPhone 小尺寸)加载视频的代码。它工作正常。
问题--
当我将设备模式更改为横向时,我想要更大的YTPlayerView 然后是纵向模式。目前,两种屏幕模式的视频尺寸相同。
- (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"];
}
-----
-----
}
我不能使用这个检查来提供更大的尺寸来查看,因为上面的代码没有调用中间视频播放。
if([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscape)
你们知道如何解决这个问题吗?或者,如果有任何其他使用 JavaScript 和 css 作为 webView 的 html 字符串的解决方案。
【问题讨论】:
标签: ios objective-c uiwebview ytplayerview