IOS8 AVPlayer disappears when you add a second view as a sublevel

Presenting init and creating everything is just fine, however, when I move AVPlayer from one layer to another, it disappears. The video is leaving (black at full screen and white at its original size), but the sound is still playing. My controls are still working (play / pause / scrub).

My app was created for iOS7. In the simulator and on devices, this works. In the simulator for iOS8, this works. Only on iOS8 devices does this not work.

Code below:

AVAsset *avAsset = [AVAsset assetWithURL:fileURL];
AVPlayerItem *avPlayerItem =[[AVPlayerItem alloc]initWithAsset:avAsset];
self.currentPlayer = [[AVPlayer alloc] initWithPlayerItem:avPlayerItem];
AVPlayerLayer *tmpPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:self.currentPlayer];
tmpPlayerLayer.frame = self.videoDetailViewPlayer.bounds;
[self.videoDetailViewPlayer.layer addSublayer:tmpPlayerLayer];

* fileURL is a properly formatted NSURL and gets the correct object with the full URL tested against each OS. ** self.videoDetailViewPlayer.bounds is a full-screen mode, and I checked that it had the correct w and h. (I tried [tmpPlayer setFrame], as well as the current setting above, using both the frame and the borders. In everything except iOS8 on the device, it works.

The sound continues again, but the video seems lost.

: , , AVPlayer , , . 2 , , , , , , , " ". (https://developer.apple.com/LIBRARY/ios/documentation/AVFoundation/Reference/AVPlayerLayer_Class/index.html). tmpPlayerLayer , , nil , ( ). AVPlayerLayer ( ), ... , .

+4
1

, AVPLayerLayer , , UIViews ( ). , iOS8 native , , PlayerLayer , , , .

+3

All Articles