ポイントに行くと、私の問題は、ビデオをロードするWebビューを作成し、ストリームが開始したら、そのビデオデータをアプリケーションのリソースフォルダーにダウンロード/保存したいということです。どうすればよいですかそれ?
誰かが私を助けてください。
ブラジル
エモン
ポイントに行くと、私の問題は、ビデオをロードするWebビューを作成し、ストリームが開始したら、そのビデオデータをアプリケーションのリソースフォルダーにダウンロード/保存したいということです。どうすればよいですかそれ?
誰かが私を助けてください。
ブラジル
エモン
実行時にビデオをリソース フォルダーに保存することはできませんが、ファイルを NSDocuments に保存し、NSFileManagers を使用して取得することはできます。このリンク http://www.techotopia.com/index.php/Working_with_Files_on_the_iPhone
このコードを試してファイルを保存してください
NSArray *paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [NSString stringWithFormat:@"%@/filename.MP4",documentsDirectory];
NSData* videoData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"your Url"]];
[[NSFileManager defaultManager] createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil];
[filemanager createFileAtPath:filePath contents:videoData attributes:nil];
取得するには:
NSArray *paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [NSString stringWithFormat:@"%@/filename.MP4",documentsDirectory];
BOOL exists = [fm fileExistsAtPath:newDirectory isDirectory:&isDir];
if (exists) {
//Play Video with contents of file path.
}