I'm playing a video on tvOS using the following code:
NSString *filePath = [[NSBundle mainBundle] pathForResource:name ofType:@"mov"];
NSURL *fileUrl = [NSURL fileURLWithPath:filePath];
self.player = [AVPlayer playerWithURL:fileUrl];
AVPlayerLayer *avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:self.player];
avPlayerLayer.frame = CGRectMake(0, 0, view.frame.size.width, view.frame.size.height);
[view.layer addSublayer:avPlayerLayer];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(replayMovie:) name:AVPlayerItemDidPlayToEndTimeNotification object:nil];
[self.player play];
But I'm getting the following error
ERROR: >aqme> 718: MEMixerChannel::EnableProcessor: failed to open processor type 0x705f6571
Any ideas how to fix it?
Are you running the app in the simulator or on the Apple TV dev kit?
For tvOS, most AV related bugs/crashes I've encountered only occur when I'm using the Apple TV simulator - once I run the app on the physical device, they tend to disappear.
I'm getting a video to load and play locally on the simulator. I wrote it in Swift but you should be able to translate it fairly easy.
if let path = NSBundle.mainBundle().pathForResource("4", ofType:"mp4") {
let url = NSURL(fileURLWithPath: path)
let videoPlayer = AVPlayer(URL: url)
let playerLayer = AVPlayerLayer(player: videoPlayer)
playerLayer.frame = self.view.frame
self.view.layer.addSublayer(playerLayer)
videoPlayer.play()
}
Make sure fileUrl
is not nil
and try removing code that is not needed (like the notification-part) so we can deduce which part is failing.
I'm using Xcode 7.1beta3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With