AVPLayer を使用して、UITableView でビデオを再生しています。ビデオは正常に再生されますが、最初にビデオを再生すると、音は聞こえますが画面が真っ暗になります。ビデオの 5 ~ 6 秒後にビデオが表示されます。私は次のコードを使用しています:
AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil];
playerItem = [AVPlayerItem playerItemWithAsset:asset];
AVPlayer *avPlayer = [AVPlayer playerWithPlayerItem:playerItem];
self.avPlayer = avPlayer;
__weak CLBAVPlayer *weakSelf = self;
[self.avPlayer addPeriodicTimeObserverForInterval:CMTimeMakeWithSeconds(1.0 / 60.0, NSEC_PER_SEC)
queue:nil
usingBlock:^(CMTime time) {
[weakSelf progress];
}];
self.layer = [AVPlayerLayer playerLayerWithPlayer:self.avPlayer];
self.avPlayer.actionAtItemEnd = AVPlayerActionAtItemEndNone;
問題を理解するのを手伝ってください。