1

ビデオを録画してドキュメント フォルダに保存しています。ビデオ パスを使用して後でもう一度再生したいのですが、再生されません。次のコードを使用して、ドキュメント フォルダ内のファイルのパスを取得してから再生しています。

          NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *documentsDirectory = [paths objectAtIndex:0];



      NSDateFormatter *dateFormat = [[[NSDateFormatter alloc] init] autorelease];
        [dateFormat setDateFormat:@"dd-MM-yyyy||HH:mm:SS"];
      NSDate *now = [[[NSDate alloc] init] autorelease];
      NSDate* theDate = [dateFormat stringFromDate:now];
      NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@"Default Album"];
     if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath])
            [[NSFileManager defaultManager] createDirectoryAtPath:dataPath withIntermediateDirectories:NO attributes:nil error:nil];
     NSString *videopath= [[[NSString alloc] initWithString:[NSString stringWithFormat:@"%@/%@.mov",documentsDirectory,theDate]] autorelease];
     NSLog(@"Vide Path %@",videopath);
     NSString *path = [[NSBundle mainBundle] pathForResource:videopath ofType:@"mov" inDirectory:nil];
     NSURL *movieURL = [NSURL fileURLWithPath:path];
     player= [[ MPMoviePlayerViewController alloc] initWithContentURL:movieURL];
     [self presentMoviePlayerViewControllerAnimated:player];

私を助けてくれませんか。

4

2 に答える 2