林現在只需具有在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顯示覆蓋圖。
有沒有人知道解決這個問題的方法?謝謝