iPhone 5 でビデオを再生するのに問題があります。ビデオは iPhone でフルスクリーンで正確に再生されますが、Retina ディスプレイに問題があります。全画面に収まらず、右側に白い太いバーが残ります。
次のコードを試しましたが、Retina ディスプレイで動作しません
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]];
解決策を教えてください。ありがとうございました