I'm trying to add an overlay to a movie player and the overlay is not displaying.
I tried following the example code from Apple which does have an overlay. My code is slightly different in that the player is not on the app delegate. All my video code is in a ViewController called VideoPlaybackViewController.
I think part of my problem seems to be the window the player is in does not seem to be detected properly? In other words, this code does fire thus the attempt to attach the overlay does not work. Is there another way to do this?
Any help appreciated.
NSArray *windows = [[UIApplication sharedApplication] windows];
if ([windows count] > 1)
{
// Locate the movie player window
UIWindow *moviePlayerWindow = [[UIApplication sharedApplication] keyWindow];
if ([moviePlayerWindow viewWithTag:0x3939] == nil) {
self.videoOverlayView.tag = 0x3939;
[moviePlayerWindow addSubview:self.videoOverlayView];
}
[moviePlayerWindow bringSubviewToFront:self.videoOverlayView];
}