I have a kiosk app open all the time in the video cycle. In the end, after about 1 day, the application freezes.
Here is the Tools session after 14 hours of operation:




I am still not very familiar with the tools, and although Live Bytes remain constant and low, other values seem very high. But then again, I'm not sure if this is normal or not.
This is how I create a video player:
- (void)setupInitialContentWithBounds:(CGRect)externalScreenBounds
{
avPlayer = [[AVPlayer alloc] init];
avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:avPlayer];
avPlayerLayer.frame = externalScreenBounds;
[self.externalWindow.layer addSublayer:avPlayerLayer];
avPlayer.actionAtItemEnd = AVPlayerActionAtItemEndNone;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playerItemDidReachEnd:)
name:AVPlayerItemDidPlayToEndTimeNotification
object:[avPlayer currentItem]];
[self playVideo:@"Idle"];
}
Here is the playVideo method:
- (void)playVideo:(NSString *)name
{
currentVideo = name;
NSString *filepath = [[NSBundle mainBundle] pathForResource:name ofType:@"mp4"];
NSURL *fileURL = [NSURL fileURLWithPath:filepath];
AVPlayerItem *playerItem = [[AVPlayerItem alloc] initWithURL:fileURL];
[avPlayer replaceCurrentItemWithPlayerItem:playerItem];
[avPlayer play];
}
And here is the notification listener when the video ends:
- (void)playerItemDidReachEnd:(NSNotification *)notification
{
if([currentVideo isEqualToString:@"Idle"])
{
AVPlayerItem *p = [notification object];
[p seekToTime:kCMTimeZero];
}
else
{
NSLog(@"Just finished a different video, so go back to idle");
[self playVideo:@"Idle"];
}
}
EDIT: At first, my client told me that it crashed, but it looks like it actually freezes, the video stops playing, and the application does not respond. Any ideas?