I am working on a project based on Linphone-iPhone , the project requires a snapshot of the current video stream (both inside and outside).
I found this "linphone_call_take_video_snapshot" in liblinphone and gave it a try. The code was simple and worked without errors, but the size of the saved file is always 0 kb !
Here is the code:
- (void)capture {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *file_path = [documentsDirectory stringByAppendingPathComponent:@"snapshot.jpeg"];
LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
const char *c_file_path = [file_path cStringUsingEncoding:NSUTF8StringEncoding];
int ret = linphone_call_take_video_snapshot(call, c_file_path);
if (ret >= 0 && [[NSFileManager defaultManager] fileExistsAtPath:file_path]) {
UIImageWriteToSavedPhotosAlbum([UIImage imageWithContentsOfFile:file_path], nil,nil,nil);
}
}
Does linphone_call_take_video_snapshot really work? If so, what am I doing wrong?
source
share