Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shepeliev/webrtc-kmp
WebRTC Kotlin Multiplatform SDK
https://github.com/shepeliev/webrtc-kmp
Last synced: about 1 month ago
JSON representation
WebRTC Kotlin Multiplatform SDK
- Host: GitHub
- URL: https://github.com/shepeliev/webrtc-kmp
- Owner: shepeliev
- License: apache-2.0
- Created: 2021-01-14T08:19:36.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-09-15T07:37:33.000Z (3 months ago)
- Last Synced: 2024-09-16T01:39:09.179Z (3 months ago)
- Language: Kotlin
- Homepage:
- Size: 29.2 MB
- Stars: 169
- Watchers: 5
- Forks: 34
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-kotlin-multiplatform - webrtc-kmp - WebRTC Kotlin Multiplatform SDK. (Libraries / Network)
- kmp-awesome - WebRTC KMP - WebRTC client (Libraries / 🌎 Network)
README
# WebRTC KMP ![Maven Central](https://img.shields.io/maven-central/v/com.shepeliev/webrtc-kmp?style=flat-square)
WebRTC Kotlin Multiplatform SDK is a comprehensive toolkit for integrating WebRTC functionality into your multiplatform projects.
It supports Android, iOS, JS. Other platforms - PRs are welcome.## API implementation map
API | Android | iOS | JS/WasmJS
:-: |:------------------:| :-: | :---:
Audio/Video | :white_check_mark: | :white_check_mark: | :white_check_mark:
Data channel | :white_check_mark: | :white_check_mark: | :white_check_mark:
Screen Capture | :white_check_mark: | | :white_check_mark:## WebRTC revision
Current revision: M125## Installation
The library is published to [Maven Central](https://search.maven.org/artifact/com.shepeliev/webrtc-kmp).### Add dependency to your common source set:
```kotlin
commonMain.dependencies {
dependencies {
implementation("com.shepeliev:webrtc-kmp:$webRtcKmpVersion")
}
}
```### Running on iOS
On iOS, the WebRTC SDK is not linked as a transitive dependency, so you need to add it to your iOS project manually.
This can be done using CocoaPods or SPM, depending on your project setup. Here is an example of how to link
the WebRTC SDK using CocoaPods in `build.gradle.kts`:```kotlin
kotlin {
cocoapods {
version = "1.0.0"
summary = "Shared module"
homepage = "not published"
ios.deploymentTarget = "13.0"
pod("WebRTC-SDK") {
version = "125.6422.05"
moduleName = "WebRTC"
}
podfile = project.file("../iosApp/Podfile")
framework {
baseName = "shared"
isStatic = true
}
xcodeConfigurationToNativeBuildType["CUSTOM_DEBUG"] = NativeBuildType.DEBUG
xcodeConfigurationToNativeBuildType["CUSTOM_RELEASE"] = NativeBuildType.RELEASE
}iosX64()
iosArm64()
iosSimulatorArm64()
}
```Also add the following to your `Podfile` in the target section:
```Ruby
use_frameworks!
pod 'shared', :path => '../shared'
```## Usage
Please refer to [sample](sample/README.md).
### Screen Share in Android
```kotlin
// Set MediaProjection permission intent using `MediaProjectionIntentHolder`
val mediaProjectionPermissionLauncher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.StartActivityForResult()
) { activityResult ->
activityResult.data?.also {
MediaProjectionIntentHolder.intent = it
}
}
```