0
對於我的應用程序我希望用戶錄製將存儲在緩存目錄中的視頻,以便在整個應用程序中重複使用。將視頻加載到庫中的視圖/緩存
NSString *DestFilename = @ "output.mov";
//Set the file save to URL
NSLog(@"Starting recording to file: %@", DestFilename);
NSString *DestPath;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
DestPath = [paths objectAtIndex:0];
DestPath = [DestPath stringByAppendingPathComponent:DestFilename];
NSURL* saveLocationURL = [[NSURL alloc] initFileURLWithPath:DestPath];
[MovieFileOutput startRecordingToOutputFileURL:saveLocationURL recordingDelegate:self];
的NSLog的說:
url = file:///var/mobile/Containers/Data/Application/BD41ABB0-77BA-4872-B447-07906A3C6FA7/Library/Caches/output.mov
我如何可以加載或可能嵌入此視頻爲我的故事板ViewControllers之一?
這看起來不錯,非常感謝。謝謝! –
不客氣。爲了進一步實現,你應該考慮處理一些關於視頻播放狀態的觀察,比如視頻開始,結束,狀態更改等等。 – HDT
非常感謝。是否可以使用容器視圖或其他方法將此解決方案嵌入到另一個視圖中?我不需要控件或任何東西可見我只想將視頻作爲視圖的一小部分顯示。 –