[英]Enable video calling with Linphone iOS SDK
I'm trying to enable video calling on my swift app using Linphone.我正在尝试使用 Linphone 在我的 swift 应用程序上启用视频通话。 I was able to enable audio calling, but I can't make it working with video.
我能够启用音频通话,但无法使用视频。 The app is always crashing if I enable this line:
如果我启用此行,应用程序总是崩溃:
linphone_call_params_enable_video(linCallParams, 1)
I want to only receive video and audio here.我只想在这里接收视频和音频。
@objc func startVideoCall() {
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)
linphone_core_set_native_video_window_id(theLinphone.lc, &videoStreamView)
linphone_core_set_native_preview_window_id(theLinphone.lc, &videoStreamPreview)
do {
try audioSession.setActive(true)
} catch {
print("Audio error: \(error.localizedDescription)")
}
linphone_call_params_unref(linCallParams)
}
This code combo fixed my issue此代码组合解决了我的问题
private func bridge<T: AnyObject>(obj : T) -> UnsafeRawPointer {
let pointer = Unmanaged.passUnretained(obj).toOpaque()
return UnsafeRawPointer(pointer)
}
let viewPointer = UnsafeMutableRawPointer(mutating: bridge(obj: view))
linphone_core_set_native_video_window_id(theLinphone.lc, viewPointer)
let previewPointer = UnsafeMutableRawPointer(mutating: bridge(obj: previewStream))
linphone_core_set_native_preview_window_id(theLinphone.lc, previewPointer)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.