Friday, June 25, 2010

Audio/Video url String To Data and Data To Audio/Video String conversion

NSString *videoURL=@"http://10.0.2.94:8080/test/v.m4v"; // for MP3 url :  http://10.0.2.94:8080/test/a.mp3
 
//NSURL *movieURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@",videoURL]];//3908777 bytes
NSString *stringData = [NSString stringWithString:videoURL];
NSData *theData = [[NSData alloc] initWithData:[stringData dataUsingEncoding:NSASCIIStringEncoding]];
NSString* theString = [[NSString alloc] initWithData:theData encoding:NSASCIIStringEncoding];
    
NSURL *url = [NSURL URLWithString:theString];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
moviePlayer.scalingMode = MPMovieScalingModeNone;
moviePlayer.movieControlMode = MPMovieControlModeDefault;
[moviePlayer play];

Regards,
Dinesh

No comments:

Post a Comment