小编Pat*_*Lin的帖子

linphone_call_take_video_snapshot保存了空文件

我正在基于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);
    }
}
Run Code Online (Sandbox Code Playgroud)

难道linphone_call_take_video_snapshot真的有用吗?如果是这样,我在做什么错?

ios linphone

5
推荐指数
0
解决办法
180
查看次数

标签 统计

ios ×1

linphone ×1