8
NSString *urlPath;
NSURL *videoUrl;
urlPath = [[NSBundle mainBundle] pathForResource:@"fogLoop" ofType:@"mp4"];
videoUrl = [NSURL fileURLWithPath:urlPath];
avPlayer = [AVPlayer playerWithURL:videoUrl];
avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:avPlayer];
avPlayerLayer.frame = videoView.layer.bounds;
avPlayerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
[videoView.layer addSublayer: avPlayerLayer];
avPlayer.actionAtItemEnd = AVPlayerActionAtItemEndNone;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playerItemDidReachEnd:)
name:AVPlayerItemDidPlayToEndTimeNotification
object:[avPlayer currentItem]];
[avPlayer play];
このビューには複数のUILabelsがあります。私は本当に背景要素としてビデオを本当にしたい。このコードでは、すべてのUI要素で機能するようです。バックグラウンドにするにはどうすればいいですか?AVPlayer - ビデオよりUILabelが見えない
にラベルを持参あなたはavPlayerとavPlayerLayerの種類を説明することができますか? –