简体   繁体   English

iPhone Live视频流媒体播放器

[英]iPhone Live Video Stream Media Player

I'm hoping to make an app that streams live video that has a view placed on top with labels and a button on it. 我希望制作一个流媒体直播视频的应用,该视频的视图放在顶部,上面带有标签和一个按钮。

From my research and testing of the http video streaming feature (available since iPhone 3.0 OS), it seems that you create a webview that points to the index html that contains the converted video stream, and this displays as a quicktime video in the app. 从我对http视频流功能(自iPhone 3.0 OS开始可用)的研究和测试来看,您似乎创建了一个Web视图,该Web视图指向包含转换后的视频流的索引html,并在应用程序中显示为QuickTime视频。 This means that I don't have control over the Media Player that is opened. 这意味着我无法控制打开的媒体播放器。 Does anyone know how you can control this? 有谁知道你怎么能控制这个?

I know that the Apple's MoviePlayer sample code shows you how to place views on top of a MediaPlayer video, but how can this be done with a http live stream? 我知道Apple的MoviePlayer示例代码向您展示了如何在MediaPlayer视频的顶部放置视图,但是如何使用http实时流来完成此操作?

Thanks in advance. 提前致谢。

Im now just having a problem displaying a view/label/button on top of the movieplayer video. 我现在在电影播放器​​视频顶部显示视图/标签/按钮时遇到了问题。 In Apple's MoviePlayer sample project, you can add a view on top of the video with this code: 在Apple的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];
}

The overlayview is a view that contains the requested label and button. overlayview是一个包含请求的标签和按钮的视图。 However, when I apply the same code to a movie url containing the .m3u8 file it doesn't display the overlay view eg http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8 但是,当我对包含.m3u8文件的电影网址应用相同的代码时,它不会显示叠加视图,例如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");

The number of windows returned is just 1, as opposed to 2 in the previous example, even though the movie plays. 即使播放电影,返回的窗口数也仅为1,而上一个示例为2。 When I check the url to see if it was ok, the movieURL returns null, but it still plays the streamed content. 当我检查网址以查看是否正常时,movieURL返回null,但仍播放流式内容。 I tried removing the check for window count being greater than 1 but it still didnt display the overlay view. 我尝试删除大于1的窗口计数检查,但仍未显示覆盖视图。

Does anybody know a way around this? 有人知道解决这个问题的方法吗? Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM