我正在使用以下代码在ios应用中使用linphone进行视频通话。该视频未同时显示在预览和显示中。 我认为它将开始录制视频并随呼叫一起发送流。在这种情况下,我不确定相机的工作原理。
func startVideoCall(number:String) { let calleeAccount = number
linphone_core_enable_video_display(theLinphone.lc, 1)
linphone_core_enable_video_capture(theLinphone.lc, 1)
let linCallParams = linphone_core_create_call_params(theLinphone.lc, nil)
linphone_call_params_enable_video(linCallParams, 1)
linphone_call_params_set_video_direction(linCallParams, LinphoneMediaDirectionSendRecv)
linphone_call_params_set_audio_direction(linCallParams, LinphoneMediaDirectionSendRecv)
let call = linphone_core_invite_with_params(theLinphone.lc, calleeAccount, linCallParams)
var display = UIView()
display.backgroundColor = UIColor.green
display.frame = CGRect(x: 20, y: 80, width: 250, height: 420)
var preView = UIView()
preView.backgroundColor = UIColor.blue
preView.frame = CGRect(x: 20, y: 150, width: 200, height: 100)
UIApplication.shared.keyWindow?.addSubview(display)
UIApplication.shared.keyWindow?.addSubview(preView)
let viewPointer = UnsafeMutableRawPointer(mutating: bridge(obj: display))
linphone_core_set_native_video_window_id(theLinphone.lc, viewPointer)
let previewPointer = UnsafeMutableRawPointer(mutating: bridge(obj: preView))
linphone_core_set_native_preview_window_id(theLinphone.lc, previewPointer)
linphone_call_params_unref(linCallParams) }
private func bridge<T: AnyObject>(obj : T) -> UnsafeRawPointer {
let pointer = Unmanaged.passUnretained(obj).toOpaque()
return UnsafeRawPointer(pointer) }