0

このコードを使用して、サーバーでビデオを再生しようとしています。エラーがあります。

//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 は Video クラスで定義されており、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]];
4

1 に答える 1

0

aVideo.urlVideoは有効なURL文字列ではありません。nilであるのはNSURLです。

于 2010-05-11T23:25:32.060 に答える