Closed. This question needs details or clarity。它当前不接受答案。
                            
                        
                    
                
                            
                                
                
                        
                            
                        
                    
                        
                            想改善这个问题吗?添加详细信息并通过editing this post阐明问题。
                        
                        6年前关闭。
                                                                                            
                
        
我需要在我的应用中播放视频我该怎么办?谢谢。
*这是我的代码。*

#import <MediaPlayer/MediaPlayer.h>
 NSURL *fileURL = [NSURL URLWithString:@"http://nordenmovil.com/urrea/InstalaciondelavaboURREAbaja.mp4"];

       MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
        [moviePlayerController.view setFrame:CGRectMake(0, 0, 320, 270)];
        [self.view addSubview:moviePlayerController.view];
        moviePlayerController.fullscreen = YES;
        [moviePlayerController play];

最佳答案

由于您尝试从URL播放视频,因此可以使用WebView播放视频。这是一些示例代码(已测试!):

 NSURL *fileURL = [NSURL URLWithString:@"http://nordenmovil.com/urrea/InstalaciondelavaboURREAbaja.mp4"];

NSURLRequest* requestUrl = [[NSURLRequest alloc] initWithURL:fileURL];

UIWebView* webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 640)];
[self.view addSubview:webView];
[webView loadRequest:requestUrl];

10-07 18:36