WebRTCat4 iOS 客户端
此项目包含 WebRTCat4 客户端应用程序,以及在其他项目中可包含的可重复使用的 iOS 模块。
在您的 iOS 项目中使用 WebRTCat4
将其用作远程 CocoaPod
在您 的 Podfile
中声明 WebRTCat 4 iOS 客户端作为依赖项
pod 'webrtcat4', :git => 'https://github.com/seg-i2CAT/webrtcat4_ios.git', :branch => '4.0.0'
用作本地 CocoaPod
如果您想在该项目本身上进行开发,请复制源代码并使用 :path
选项。
pod 'webrtcat4', :path => '~../webrtcat4/'
开发您的应用程序
- 在 View Controller 中创建与本地/远程视频轨道和本地采集器相关的本地变量
var localVideoTrack: RTCVideoTrack?
var remoteVideoTrack: RTCVideoTrack?
var localCapturer: RTCCameraVideoCapturer?
var captureController:ARDCaptureController?
- 在 VC 中实现
ARDAPPClientDelegate
、RTCEAGLVideoViewDelegate
、RTCVideoViewDelegate
来自webrtcat4
客户端调用的回调。请参阅示例应用程序以获取实现指南。
func appClient(_ client: ARDAppClient!, didChange state: ARDAppClientState)
func appClient(_ client: ARDAppClient!, didChange state: RTCIceConnectionState)
appClient(_ client: ARDAppClient!, didCreateLocalCapturer localCapturer: RTCCameraVideoCapturer!):
本地捕获器。在localCapturer中设置值并开始捕获。appClient(_ client: ARDAppClient!, didReceiveLocalVideoTrack localVideoTrack: RTCVideoTrack!)
: 在localVideoTrack中设置值。appClient(_ client: ARDAppClient!, didReceiveRemoteVideoTrack remoteVideoTrack: RTCVideoTrack!)
: 在remoteVideoTrack中设置值。appClient(_ client: ARDAppClient!, didError error: Error!)
: 应用程序错误回调appClient(_ client: ARDAppClient!, callStart message: String!)
: 通话开始回调appClient(_ client: ARDAppClient!, didGetStats stats: [Any]!)
: 获取统计信息回调videoView(_ videoView: RTCVideoRenderer, didChangeVideoSize size: CGSize): RTCEAGLVideoViewDelegate
配置您的应用程序以使用相机和麦克风:在您的应用程序中 Info.plist
设置 NSMicrophoneUsageDescription
和 NSCameraUsageDescription。
应用程序示例
应用程序示例基于GoogleWebRTC示例。WebRTCat4示例应用程序依赖于Fitness Cloud Messaging从服务器端进行异步消息,Collider用于WebSocket,以及Node.js服务器应用程序用于房间/用户服务器。
由于安装之间的配置不同,必须在应用程序配置文件中进行一些更改。
要使示例应用程序工作
- 修改
Constants.swift
。使用适当的值配置每个属性。 - 添加您自己的
GoogleService-Info.plist
带有Firebase配置。
许可证
WebRTCat 4 iOS客户端提供MIT许可证(LICENSE)
在此项目中使用的第三方代码在文件LICENSE_THIRD_PARTY中描述。