我在我的应用程序中使用 AVPlayer 而不是 MPMoviePlayerController 因为我想将播放器作为子层。但是我需要像播放、暂停、搜索和全屏这样的控制。我如何在 AVPlayer 中获得该按钮?这就是我放置播放器的方式:
AVURLAsset *avasset = [[AVURLAsset alloc] initWithURL:URL1 options:nil];
AVPlayerItem *item = [[AVPlayerItem alloc] initWithAsset:avasset];
player = [[[AVPlayer alloc] initWithPlayerItem:item]retain];
playerLayer = [AVPlayerLayer playerLayerWithPlayer:player];
CGSize size = self.view.bounds.size;
float x = size.width/2.0-187.0;
float y = size.height/2.0 - 125.0;
playerLayer.frame = CGRectMake(x, y, 474, 320);
[playerLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill];
[self.view.layer addSublayer:playerLayer];
[player play];