我在 iphone 5 中播放视频时遇到问题。视频在 iphone 中完全全屏播放,但问题出在视网膜显示器上。它不适合全屏并在右侧留下白色的thik bar。
我尝试了以下代码,但它在视网膜显示中不起作用
outputURL = [NSURL fileURLWithPath:filePath];
av = [[AVPlayer alloc] initWithURL:outputURL];
AVPlayerLayer *layer = [AVPlayerLayer playerLayerWithPlayer:av];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
{
[layer setFrame:CGRectMake(0, -20, 1024, 670)];
}
else
{
[layer setFrame:CGRectMake(0, -10, 480, 287)];
}
if([layer.videoGravity isEqualToString:AVLayerVideoGravityResizeAspect])
{
layer.videoGravity = AVLayerVideoGravityResizeAspectFill;
}
else
{
layer.videoGravity = AVLayerVideoGravityResizeAspect;
}
[self.view.layer addSublayer:layer];
av.actionAtItemEnd = AVPlayerActionAtItemEndNone;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:AVPlayerItemDidPlayToEndTimeNotification
object:[av currentItem]];
请帮我解决一些问题。谢谢