# WebRTC
A java wrapper for WebRTC by JNI based on WebRTC M70, you could use this java lib to communicate with any other WebRTC client(eg: chrome browser, android, ios...), stream from other client to java side isn't supported yet, if anyone would like to finish this part, your PR will been very expected.
You could use this lib to transport video stream(include audio) to other WebRTC clients.
This project may not be designed very well, but you can use it as a reference to know how to use webrtc native lib. You can take it as a start point to build your project.
# Blog about this lib
[ZhiHu](https://zhuanlan.zhihu.com/p/86762371)
[My site](https://www.beikejiedeliulangmao.top/%E5%9C%A8Java%E4%B8%AD%E4%BD%BF%E7%94%A8WebRTC%E4%BC%A0%E8%BE%93%E8%A7%86%E9%A2%91/)
# Concept
- libwebrtc: Chromium WebRTC c++ lib
- rtc4j native lib: WebRTC java wrapper jni lib
- rtc4j: WebRTC java wrapper
# Dependencies of building native
1. build libwebrtc by [libwebrtc-m70](https://github.com/BeiKeJieDeLiuLangMao/libwebrtc-m70)
2. install libwebrtc
3. install libyuv
4. install libjpegturbo
5. install ffmpeg
# Feature
1. Build connection with other webrtc client
2. Use data channel to communicate with other client
3. Send video frame from java to other client(include audio)
4. Use ffmpeg's h264 encoder
5. Use NVIDIA device to accelerate encode, if you do have a NVIDIA device installed
6. Limit java side webrtc communicate port
7. Set java side socket ip white list
8. Change webrtc video transport bandwidth
9. Change video resolution in runtime, this lib will automatically send a new key frame to change the stream resolution
# How to run it
```bash
# Step 1: Build ./native by cmake
# These are some build scripts in ./native/scripts
# and if you are in MacOS, the native lib already built and located in ./rtc4j/src/main/resources/jni
# Step 2: maven install rtc4j
cd ./rtc4j
mvn install
# Step 3: maven run spring demo
cd ./demo/spring
mvn spring-boot:run
# Step 4: maven run front vue demo
cd ./demo/vue
npm install
npm run serve
# open http://localhost:8080/
```
# How to develop based on it
1. As described in `Dependencies`, you should build your own webrtc native lib, it's free to upgrade webrtc native lib if necessary
2. Add new feature in both `/cpp(JNI)` side and `rtc4j(Java)` side(If you upgrade webrtc native lib, it is very likely you need to upgrade existed JNI code too)
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
WebRTC-master.zip (97个子文件)
WebRTC-master
demo
vue
postcss.config.js 59B
public
index.html 543B
favicon.ico 4KB
.browserslistrc 33B
.eslintrc.js 353B
src
main.js 709B
views
Use.vue 5KB
store.js 417B
App.vue 338B
assets
logo.png 7KB
router.js 464B
babel.config.js 53B
README.md 361B
.gitignore 175B
package-lock.json 390KB
package.json 601B
.gitignore 413B
spring
src
main
resources
test_90.jpg 28KB
test.jpg 29KB
gong.wav 237KB
application.yml 232B
java
bbm
webrtc
demo
common
NamedThreadFactory.java 2KB
Constants.java 539B
config
SocketIoConfig.java 1KB
WebRtcTurnConfig.java 583B
Application.java 1KB
use
UseContext.java 2KB
handler
SessionHandler.java 1KB
MessageHandler.java 13KB
README.md 596B
pom.xml 2KB
.gitignore 350B
README.md 2KB
rtc4j
src
main
resources
log4j.properties 319B
jni
librtc.dylib 17.37MB
java
bbm
webrtc
rtc4j
utils
SystemUtils.java 2KB
model
IceCandidate.java 287B
VideoFrame.java 511B
DataChannelConfig.java 2KB
Turn.java 292B
DataBuffer.java 442B
SessionDescription.java 274B
LogLevel.java 391B
SignalingState.java 496B
core
ImageUtils.java 375B
video
VideoCapturer.java 374B
RTC.java 5KB
Utils.java 397B
observer
SessionDescriptionObserver.java 207B
PeerConnectionObserver.java 374B
DataChannelObserver.java 191B
PeerConnection.java 6KB
audio
AudioCapturer.java 461B
DataChannel.java 3KB
script
build-header-files.sh 219B
pom.xml 3KB
.gitignore 365B
.gitignore 7B
native
src
rtc
rtc_observer.h 10KB
utils
image_utils.h 227B
image_utils.cpp 2KB
datachannel
data_channel.cpp 3KB
data_channel.h 734B
rtc.h 3KB
network
socket_factory_wrapper.cpp 6KB
socket_factory_wrapper.h 2KB
rtc.cpp 12KB
peerconnection
peer_connection.h 2KB
peer_connection.cpp 10KB
media
codec
video_encoder_decoder_factory.cpp 5KB
h264
ffmpeg_h264_encoder_impl.cpp 25KB
h264.cpp 832B
ffmpeg_h264_encoder_impl.h 4KB
h264.h 1KB
open_h264_encoder_impl.h 3KB
open_h264_encoder_impl.cpp 25KB
video_encoder_decoder_factory.h 496B
video
fake_video_capturer.h 2KB
fake_video_capturer.cpp 6KB
audio
audio_device_module_wrapper.h 8KB
fake_audio_device_module.cpp 11KB
fake_audio_device_module.h 10KB
jni
bbm_webrtc_rtc4j_core_DataChannel.h 1KB
jni_utils.cpp 11KB
bbm_webrtc_rtc4j_core_Utils.h 582B
bbm_webrtc_rtc4j_core_ImageUtils.h 607B
bbm_webrtc_rtc4j_core_RTC.h 2KB
bbm_webrtc_rtc4j_core_PeerConnection.h 4KB
jni_utils.h 2KB
scripts
build-linux.sh 209B
build-windows.sh 219B
build-mac.sh 195B
CMakeModules
FindLibyuv.cmake 537B
FindFFMPEG.cmake 5KB
FindLibJpegTurbo.cmake 754B
CMakeLists.txt 1KB
.gitignore 44B
共 97 条
- 1
贝克街的流浪猫
- 粉丝: 36
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
前往页