In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
The first two articles introduce how to use WebRTC API to implement one-to-one video call and multi-person video conference, and give the corresponding demo program, which is based on the official pre-compiled library. If you want to in-depth study and study of WebRTC, only to master the upper API interface is far from enough, but should be able to compile and modify the WebRTC source code, so that you can unrestricted according to your own needs to optimize and improve product quality and effect.
There are a lot of articles about WebRTC source code compilation on the Internet, and I won't repeat them here, just some key experiences. Generally speaking, there are a few points to be explained in advance:
1. The most reliable compilation guide is the official guide: https://webrtc.org/native-code/android/
2. WebRTC Android compilation can only be done in Linux environment. It is recommended to install physical machine or VPS of Ubuntu 16.04.It is not recommended to use Docker or virtual machine to compile on Mac/Windows. It is easy to encounter a lot of strange problems. Of course, I will also introduce how to use a virtual machine to compile under Mac.
3. The source code and supporting tools of WebRTC Android are about 16 GB. In China, due to GFW, we need to configure agents to download and synchronize, which may bring a lot of strange problems.
4. Time is money, as the configuration of agent synchronization code is easy to encounter various pitfalls, the recommended way is to purchase a foreign VPS virtual machine in Linode or Vultr, basically referring to the WebRTC official documentation, you can successfully get through the entire source code synchronization and compilation process in half a day.
I. compilation steps and procedures
The following first describes the compilation steps and procedures, assuming that you have used a foreign VPS or have solved the agent, the compilation environment is Ubuntu 16.04.
First, log in to VPS through ssh
1 install and configure the compilation environment
/ / install some basic software relying on $sudo apt-get update$ sudo apt-get install-y openssl vim git gcc gaming + curl python build-essential inetutils-ping net-tools sudo lsb-release libxml2// to download and configure the related tools and scripts provided by Google $git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git$ vi ~ / .bashrc// add the following content export DEPOT_TOOLS_PATH=~/depot_toolsexport PATH=$ {PATH}: ${ DEPOT_TOOLS_PATH} / / execute the script to make it effective $source ~ / .bashrc
2 pull the replacement code and install related dependencies
$mkdir webrtc$ cd webrtc$ fetch-- nohooks webrtc_android$ gclient sync / / after an abnormal disconnect, you can execute $cd src$. / build/install-build-deps.sh$. / build/install-build-deps-android.sh a few more times
3 create and compile the project file and execute the compilation
$. Build/android/envsetup.sh$ gn gen out/release/armeabi-v7a-args='target_os= "android" target_cpu= "arm" is_debug=false'$ ninja-C out/release/armeabi-v7a
If you want to compile other CPU schemas, the parameters are configured as follows:
ARM64: target_cpu= "arm64"
32-bit x86: target_cpu= "x86"
64-bit x64: target_cpu= "x64"
After the compilation is successful, the key files output are as follows:
Out/release/armeabi-v7a/lib.java/sdk/android/libwebrtc.jarout/release/armeabi-v7a/libjingle_peerconnection_so.so
Second, create a compilation environment by using Vagrant under Mac
1 pre-environment
There are three ways to realize that the command line can use the shadowsocks proxy:
Proxifier
Privoxy
Polipo
There are a lot of articles about how to use and configure them, and I won't repeat them here, which is a crucial step.
2 install Vagrant and Virtual Box
Download Vagrant and VirtualBox on the official website and install them.
3 install Ubuntu 16.04virtual machine
$mkdir webrtc-builder$ cd webrtc-builder$ vagrant init ubuntu/xenial64
4 configure a shared directory
Here you can use the disk directory under Mac, use NFS to mount to the vagrant virtual machine for code synchronization, so that you can easily modify and edit the WebRTC source code under the Mac system.
$cd webrtc-builder$ vi Vagrantfile// the former is the directory of the host, and the latter is the directory mounted in the virtual machine Note that to mount config.vm.network "private_network" using NFS, ip: "192.168.50.4" config.vm.synced_folder "/ Volumes/fs/webrtc", "/ webrtc", type: "nfs" $vagrant reload// Note: this process requires full disk access to the iTerm console: configure-> Security and Privacy-> Privacy, add iTerm console programs
Note: because the APFS file system used by Mac OS is case-insensitive by default, and there are not only these files with uppercase names but also corresponding files with lowercase names in the WebRTC source directory, the APFS system is unable to distinguish between the two files, resulting in the appearance of git when synchronizing code: "You have unstaged changes." Such an error, for example, a common error prompt is as follows:
Syncing projects: 85% (114 amp 134) src/third_party/android_toolssrc/third_party/android_ndk (ERROR)-- [0:02:21] Started.-- -Error: 83 > 83 > _ src/third_party/android_ndk at 4e2cea441bfd43f0863d14f57b1e1844260b988483 > You have unstaged changes.83 > Please commit Stash, or reset.
Solution: open the Mac computer's "disk tool" and create a new file (suppose: fs) to place the webrtc source code, such as: / Volumes/fs/webrtc, pay attention to choose the format: APFS (case-sensitive) this configuration.
5 Boot and enter the virtual machine
$cd webrtc-builder$ vagrant up$ vagrant ssh
For the remaining steps, please refer to the "compilation steps and procedures" section above. After compilation is complete, you can suspend or shut down the virtual machine by using the vagrant suspend or vagrant halt command.
III. Summary
On how to compile the WebRTC Android platform source code to share here, if you have questions, welcome to write to lujun.hust@gmail.com to communicate. In addition, you are welcome to follow my Sina Weibo @ Lu _ Jun or Wechat official account @ Jhuster for the latest articles and information.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.