![]() ![]() To play it back, just use NSURL's fileURLWithPath: to create a URL pointing to the local file in the Documents directory and play it as you would any remote video. In connectionDidFinishLoading: or connection:didFailWithError:, close the output stream/file handle and rename or delete the temporary file as appropriate.In the connection:didReceiveData: delegate method, write the data to the output stream/file handle and update the progress bar as necessary.In the connection:didReceiveResponse: delegate method, read out the length of data to be downloaded for proper updating of the progress bar.Do not use sendSynchronousRequest:returningResponse:error:, of course. Allocate and start an NSURLConnection to fetch the file from the URL.Set up your progress bar and whatever else you need to do.Create an NSOutputStream or NSFileHandle opened on a temporary file (in NSTemporaryDirectory() or a temp-named file in your Documents directory).Get the URL to download from, via the YouTube API or whatever other method. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |