views:

73

answers:

1

Hello All

I would like to develop such iphone application that provides functionality to download viedo. i am doing some as below

1) Loading HTML content on web view 2) The loaded html content contains the video link (i.e http://test.com/test.mp4") 3) When i click on that it will play the video in native player. 4) but i would like to prevent this thing and start downloading video from that URL for example, if i click on link it should not open native video player, it should start downloading from that url and store somewhere on iphone (i.e document directory)

is there any solution for same?

Thanks Vivek

A: 

You should use UIWebViewDelegates webView:shouldStartLoadWithRequest:navigationType: method to decide whether or not to load a URL.

You can check the request, and perform some logic, for instance, checking if the URL's suffix is 'mp4' and if so, do something other than load the request in the webview.

You can intercept the mp4 urls, and then hand them off to another method in your controller that will kick off an NSURLRequest to download the video data.

Once you have the video data, you can write it to the documents directory.

Jasarien