NSUrl FileUrlWith Path adds "- file: // localhost /" to the end
I am using MPMoviePlayerController to play video from url. for this I am getting a link from XML parsing. This is normal.
NSString *path=[[self.items objectAtIndex:videoIndex]objectForKey:@"link"];
I am assigning this path to NSURL fileWithPath as shown below.
NSURL *mediaUrl = [NSURL fileURLWithPath:path];
When printing mediaUrl NSLog provides " http://example.com - file: // localhost /"
Why the file: // localhost / is appended to the url is why the video is not palletizing. Any help Please. Thank.
source to share
This is probably a little outdated, but NSURL adds a file - file :: // localhost if the string you are passing is not a valid full path string.
In your case, this is probably because you don't have a line with "/" at the beginning (ie: "var / test" will have file: // localhost added as you saw, but if you change it to "/ var / test", you get the NSURL correctly with "file: // localhost / var / test"
If you are trying to make a relative path, you can start with "~ / somelink" and then use stringByExpandingTildeInPath first to get the full path.
source to share