我已成功按照以下说明在MAC上构建WebRTC:http://www.webrtc.org/reference/getting-started
有没有人在iOS上成功构建它?我知道有人(arik)已成功在iOS上构建它:https://groups.google.com/forum/#!msg/discuss-webrtc/VJg-fk2-i_0/dtG200DOzsgJ但步骤不明确。
某人(建立在ios上的人)可以总结这些步骤,以便将来对所有人都有用吗?
答案 0 :(得分:4)
我写了一篇详细的博客文章,其中包含有关如何构建WebRTC示例iOS应用程序的所有说明,以及如何在iOS模拟器或实际的iOS设备上运行它。您可以take a look here阅读详细信息,这是一个非常漫长的过程。
答案 1 :(得分:3)
是的,为iOS编译是一项非常痛苦的任务......特别是让它在Xcode中运行。
这是我尝试获取ios的AppRTC演示
克隆/拉动:https://github.com/pristineio/webrtc-build-scripts
获取回购后,然后在ios目录中打开xcode项目。将目标设置为WebRTC Dance,然后执行。此时,脚本将更新depot_tools并执行所有脏工作(拉,修改,构建),以便AppRTCDemo的目标能够解析丢失的文件并执行。
完成后,您可以使用模拟器或真实设备将目标更改为AppRTC演示,单击运行并执行该目标。在那里链接的指南中有更详细的信息,以及自述文件中的更新。
如果您想知道在幕后运行什么,请查看git repo的ios目录中的build.sh文件。当您选择WebRTC Dance时,舞蹈功能就是为您执行的。
描述构建过程并不是很容易(过多的事情),但构建脚本repo应该指向正确的方向并帮助你在ios上获得AppRTCDemo'正常工作'
还有一个谷歌开发者视频发布here,他们试图打破构建过程,以便你可以为ios构建(youtube标题具有误导性)。
另外,我刚刚为ios webrtc添加了cocoapods支持,将其添加到你的Podfile中,
pod "libjingle_peerconnection"
# Add this to the bottom so it won't have issues with active architecture
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
config.build_settings['VALID_ARCHS'] = ['armv7', 'i386']
end
end
end
并非所有修订都已构建,因此请查看the cocoadocs for which revisions are available
答案 2 :(得分:2)
我过去几个月一直在这个领域工作 - iOS上的webrtc并不容易。为了解决这个问题,我使用webrtc添加了一个带有iOS应用程序的github repo。
https://github.com/gandg/webrtc-ios
该网站也引用了Google代码网站,因此它应该是一个有用的起点。
答案 3 :(得分:1)
答案 4 :(得分:0)
嗯,好久没来回答这个帖子了。但是,我希望有人可以 从中获得更好的直觉。
我一直在处理 iOS 和 Android 平台的 webrtc 编译过程。如果您有效地遵循每个步骤,则此过程非常简单。要为 iOS 编译库,请按照以下给出的命令进行操作,并确保您使用 Mac 终端 的相同 (only-1
) 选项卡进行 WebRTC 本地编译设置,如下所示: >
首先,请确保您已经安装了以下内容,如果没有,请使用这些命令来执行此操作:
- sudo add-apt-repository ppa:openjdk-r/ppa
- sudo apt-get install openjdk-8-jdk
- sudo apt-get install pkg-config
- sudo apt-get update
如果尚未安装,请同时安装 python==2.7
。
- sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
- sudo xcode-select --switch /Library/Developer/CommandLineTools
- git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
- export PATH="$PATH:${HOME}/depot_tools"
之后,再开始下面的步骤。根据机器规格和互联网速度,每一步都需要自己的时间,因此请确保每一步都没有中断地完成。
- mkdir webrtc_ios
- cd webrtc_ios
- fetch --nohooks webrtc_ios
- gclient sync
- cd src
- ./build/install-build-deps.sh
- git checkout origin/master
- git branch
确保您位于 webrtc_ios/src/
目录中,然后只需运行以下命令:
- ./tools_webrtc/ios/build_ios_libs.sh
事实证明,您最终将编译和构建包含 Webrtc 头文件的 WebRtc 框架。您可以简单地将此框架拖放到您的 Xcode 生产环境中或直接导入它。
设置编译环境后,现在每次对原生堆栈进行更改时,只需运行此命令 ./tools_webrtc/ios/build_ios_libs.sh
即可生成更新的框架。
如果您最终遇到有关 webrtc 框架编译的问题。请按照以下步骤操作。确保您位于此目录中 webrtc_ios/src/
:
- git checkout origin/master
# To make sure you're using origin/master
- git branch
- gclient revert
- gclient sync
- ./tools_webrtc/ios/build_ios_libs.sh
希望您的问题得到解决。我总是建议你们,你可以检查一个位于 origin/master
后面的分支,那里没有构建 iOS 的 webrtc 框架所必需的所有依赖项和模块。因此,请始终检查 branch/head
的 webrtc 原生堆栈
现在,如果您尝试使用这两个过程来构建 WebRTC,例如:
1- 使用 Bash 构建工具 (./tools_webrtc/ios/build_ios_libs.sh
)
2- 使用手动编译
$ # debug build for 64-bit iOS
$ gn gen out/ios_64 --args='target_os="ios" target_cpu="arm64"'
$ # debug build for simulator
$ gn gen out/ios_sim --args='target_os="ios" target_cpu="x64"'
2.1- 编译 (ninja -C out/Debug
)
两个程序都可以。