Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Download a video using UIWebView

I want to download a the video using web-view but I am not getting how to download it? my video link is here

the sample code for playing video which I am using is

-(void)embedYouTubeInWebView:(NSString*)url theWebView:(UIWebView *)aWebView {
    NSString* html = [NSString stringWithFormat:@"%@", url];
    [aWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:html]]];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
   [self embedYouTubeInWebView:@"http://player.vimeo.com/video/32983838" theWebView:myWebView];
    // Do any additional setup after loading the view, typically from a nib.
}

can anyone please help me to download this video?

like image 463
Noor Avatar asked Dec 31 '12 10:12

Noor


Video Answer


1 Answers

To download a file i used the following Code. Hope it will work for you too.

- (IBAction)getFileFromFtpServer:(UIView *)sender
{

  NSString *stringURL = @"http://player.vimeo.com/video/32983838";
NSURL  *url = [NSURL URLWithString:stringURL];
NSData *urlData = [NSData dataWithContentsOfURL:url];
if ( urlData )
{
  NSArray       *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  NSString  *documentsDirectory = [paths objectAtIndex:0];  

  NSString  *filePath = [NSString stringWithFormat:@"%@/%@", documentsDirectory,@"filename.mpeg4"];
  [urlData writeToFile:filePath atomically:YES];
}


}
like image 177
Siba Prasad Hota Avatar answered Oct 17 '22 14:10

Siba Prasad Hota