2010-05-11 80 views
0

我嘗試使用此代碼在服務器上播放視頻。我有一個錯誤。使用MPMoviePlayerController從服務器播放視頻時出錯

//Play the video from server 
    - (IBAction)playVideo:(id)sender; 
    { 
     NNSURL *url = [[NSURL alloc]initWithString: aVideo.urlVideo]; 
NSLog(@"URLVIDEO %@", url); 
MPMoviePlayerController *VideoPlayer = [[MPMoviePlayerController alloc]initWithContentURL: url]; 
[VideoPlayer play];  
    } 

//控制檯

URLVIDEO http://147.83.74.180/videos/low/ElTemps-index.m3u8 
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Content URL must not be nil.' 

如果我這樣做,我可以aVideo.urlVideo定義的視頻類和它得到的值時,我解析XML文件

//Video.h 
NSString urlVideo; 

//XMLParser.m 
    [aVideo setValue:currentElementValue forKey:elementName]; //here i add the string 

播放視頻:

NSString *videoURL = @"http://147.83.74.180/videos/low/ElTemps-index.m3u8"; 
    MPMoviePlayerController *VideoPlayer = [[MPMoviePlayerController alloc]initWithContentURL:[NSURL URLWithString:videoURL]]; 

回答

0

aVi deo.urlVideo不是有效的URL字符串。這是NSURL是零。

+0

我該如何解決這個問題? – nabrugir 2010-05-11 23:27:20

+0

如果我們不知道字符串是什麼,我們不能評論它。 – 2010-05-12 07:03:26

+0

我粘貼更多代碼。我不知道你是否告訴我... – nabrugir 2010-05-12 11:15:25

相關問題