KMP wrapper for WebRTC.
Platform | ๐ Builds๐ + ๐ฌTests๐ฌ |
---|---|
Android |
๐ |
iOS |
๐ |
macOS |
๐ |
Windows X64 |
๐ |
JS (Chrome) |
๐ |
Linux X64 |
๐ |
You only need to add gradle dependency:
// add common source set dependency
kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation("com.piasy:kmp-webrtc:$version")
}
}
}
}
Download and extract the libs
dir:
wget https://github.com/HackWebRTC/kmp-webrtc/releases/latest/download/libs.zip
unzip -o libs.zip
You need to install RVM to manage your ruby version, and install gems. You need to use homebrew to install the following tools:
brew install cocoapods xcodegen
# if you have installed them earlier, you need to remove them at first,
# or run brew link --overwrite xcodegen cocoapods
You may need to restart your system so that Android Studio could use the correct ruby.
Follow this guide to install Visual Studio 2022 and necessary tools.
Open the project (the repo root dir) in Android studio, and run the example.androidApp target.
./scripts/setup_apple.sh
# open example/iosApp/iosApp.xcworkspace in Xcode, and run it.
./scripts/setup_apple.sh
# open example/macApp/macApp.xcworkspace in Xcode, and run it.
.\scripts\setup_windows.bat
# open example\winApp\winApp.sln in Visual Studio 2022, and run it.
./scripts/build_linux_demo.sh
./example/linuxApp/build/loopback <path to video file>
./gradlew :example:webApp:jsBrowserRun
hack_webrtc_43659 branch of HackWebRTC/webrtc, which is based on m133.
File structure for macOS:
- webrtc_apple
- src
- kmp-webrtc
File structure for Windows:
- webrtc_windows
- src
- kmp-webrtc
File structure for Linux:
- webrtc_android
- src
- kmp-webrtc
CPP code need to be built on Linux.
# on Linux
./sdk/build_android_libs.sh <output path> --skip-build-ffmpeg
# on macOS, copy prebuilt_libs into sdk/android_gradle/webrtc/
# then build aar like this:
pushd ../webrtc_apple/src/sdk/android_gradle/ && \
./gradlew :webrtc:assembleRelease && \
cp webrtc/build/outputs/aar/webrtc-release.aar \
../../../../kmp-webrtc/libs/android/webrtc.aar && \
popd
pushd ../webrtc_apple/src/ && \
./sdk/build_apple_framework.sh ../../kmp-webrtc/libs --skip-build-ffmpeg && \
popd
In x64 Native Tools Command Prompt for VS 2022
:
.\sdk\build_windows_libs.bat ..\..\kmp-webrtc
pushd ../webrtc_android/src/ && \
./sdk/build_linux_libs.sh ../../kmp-webrtc/libs --skip-build-ffmpeg && \
popd
zip -ry build/libs.zip libs
Then upload build/libs.zip to GitHub releases.
Maven central portal credentials and signing configs are set in ~/.gradle/gradle.properties
.
Login to https://central.sonatype.com/publishing/deployments, and release them manually.