linphone_call_take_video_snapshot保存了空文件

时间:2014-07-31 18:41:38

标签: ios linphone

我正在开发基于 Linphone-iPhone 的项目,该项目需要拍摄当前视频流的快照(包括进出)。

我在liblinphone中找到了这个' linphone_call_take_video_snapshot '并尝试了一下。 代码很简单,运行时没有任何错误,但保存文件的大小总是 0 kb

以下是代码:

- (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);
    }
}

linphone_call_take_video_snapshot 真的有效吗?如果是这样,我做错了什么?

0 个答案:

没有答案