林现在只需具有在movieplayer视频之上显示的图/标签/按钮的问题。在苹果公司的MoviePlayer示例项目,您可以在视频上添加一个视图与此代码:
MoviePlayerAppDelegate *appDelegate = (MoviePlayerAppDelegate *)[[UIApplication sharedApplication] delegate];
// initialize a new MPMoviePlayerController object with the specified URL, and play the movie
[appDelegate initAndPlayMovie:[self localMovieURL]];
NSArray *windows = [[UIApplication sharedApplication] windows];
if ([windows count] > 1) {
// Locate the movie player window
UIWindow *moviePlayerWindow = [[UIApplication sharedApplication] keyWindow];
// Add our overlay view to the movie player's subviews so it is displayed above it.
[moviePlayerWindow addSubview:self.overlayView];
}
的OverlayView的是包含所请求的标签和按钮的视图。然而,当我相同的代码应用到包含.m3u8文件电影URL它不例如显示叠加视图http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8
NSURL *newMovieURL = [NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8">];
if (movieURL) {
NSLog(@"movieURL");
if ([movieURL scheme]) // sanity check on the URL
{ NSLog(@"[movieURL scheme]");
[appDelegate initAndPlayMovie:newMovieURL];
NSArray *windows = [[UIApplication sharedApplication] windows];
NSLog(@"windows count:%d", [windows count]);
if ([windows count] > 1) {
UIWindow *moviePlayerWindow = [[UIApplication sharedApplication] keyWindow];
[moviePlayerWindow addSubview:self.overlayView];
}
}
else NSLog(@"![movieURL scheme]"); } else
NSLog(@"!movieURL");
返回窗口的数量仅仅是1,如上面的例子中反对2,即使在影片播放。当我检查的网址,看它是否是确定的movieURL返回null,但它仍然播放流媒体内容。我试图消除对窗口计数大于1的检查,但它仍然didnt显示覆盖图。
有没有人知道解决这个问题的方法?谢谢