Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
db081db
Try and force the use of the correct event-target-shim module. (#1515)
8BallBomBom Mar 13, 2024
35e992a
example: added UVC support to sample
tommiilmonen Mar 28, 2024
e4c648e
android, ios: remove track when removed from peerconnection (#1525)
davidliu Apr 1, 2024
f2dbfc1
android: fix senderGetStats lookup (#1527)
davidliu Apr 1, 2024
e04497f
android: don't declare foreground service permissions
saghul Apr 4, 2024
f6c3340
release 118.0.4
saghul Apr 4, 2024
1a03f67
android: drop UVC camera support
saghul Apr 4, 2024
a5112e1
release 118.0.5
saghul Apr 8, 2024
5d85486
android,ios: don't reject promise for getStats (#1541)
davidliu Apr 10, 2024
c0c446a
ios: fix not being able to deactivate encodings
saghul Apr 11, 2024
8dfc9c3
Revert "android, ios: remove track when removed from peerconnection (…
8BallBomBom Apr 17, 2024
882f8b1
release 118.0.6
saghul Apr 11, 2024
822cac7
release 118.0.7
saghul Apr 18, 2024
495658d
ci: fix build (#1562)
davidliu May 3, 2024
ff6110e
webrtc: update WebRTC to M124
saghul Jun 3, 2024
bbd903c
api: allow sdpMid / sdpLineIndex to be null in RTCIceCandidate
omerts Jun 4, 2024
f36b6b8
ios: refactor rendering in RTCVideoView
saghul Jun 11, 2024
64e8298
ios: add all available camera device types
brkkyk Apr 30, 2024
20cf1d5
preserve order
May 3, 2024
232fc06
release 124.0.1
saghul Jun 13, 2024
54b5607
build(deps-dev): bump braces from 3.0.2 to 3.0.3 (#1578)
dependabot[bot] Jun 13, 2024
0a36e9d
android: release audio manager module after creating factory
davidliu Jun 21, 2024
5fdb6ad
android: declare dependency on androidx.core 1.7.0 (#1586)
davidliu Jun 25, 2024
160ece9
ios: fix compatibility with RN >= 0.73
saghul Jun 27, 2024
a45efdc
release 124.0.2
saghul Jul 8, 2024
3e11c99
misc: ignore Android build files when releasing to npm
saghul Jul 8, 2024
09f609b
release 124.0.3
saghul Jul 8, 2024
a1bb18a
ios: add support for external cameras on iPad
mtdxc Jul 10, 2024
c0ddefd
ci: remove flipper from gumtestapp (#1608)
davidliu Aug 7, 2024
fb02a5b
pc: align createDataChannel with standard
saghul Aug 6, 2024
4c34ae1
android: report actual size in camera MediaStreamTrack settings (#1598)
davidliu Aug 7, 2024
f6667c8
ios: fix exception in iOS 17+ w/ Xcode 15.4
mtdxc Aug 7, 2024
ac7f578
android: remove no longer used replace rule from manifest (#1609)
saghul Aug 7, 2024
6cfedd7
sender: fix serializing RTCRtpSendParameters
saghul Aug 14, 2024
89557ca
misc: make serialization more resilient
saghul Aug 14, 2024
fb026de
release 124.0.4
saghul Aug 14, 2024
609c0b5
ios: Add RTCAudioSession helper methods needed for CallKit (#1614)
davidliu Aug 16, 2024
f3f3301
ios,android: add device/groupId to MediaStreamTrack.getSettings and i…
davidliu Aug 26, 2024
8bd5e0a
android: don't use minSdkVersion set by app (#1625)
davidliu Sep 17, 2024
4f337cd
doc: remove duplicate / confusing information about screen-sharing (#…
saghul Nov 4, 2024
b62727a
ios: add background camera access option
davidliu Dec 2, 2024
996c128
ios: picture in picture implementation
davidliu Dec 13, 2024
036e374
android: add libwebrtc consumer proguard rules
davidliu Dec 20, 2024
359caea
android: document how to set audio category to media
msabaeian Jan 4, 2025
803e720
release 124.0.5
saghul Jan 7, 2025
4c5d0f9
audit: update dependencies
saghul Jan 7, 2025
918866a
tools: tweak release message
saghul Jan 7, 2025
7a0b713
ci: update GHA versions
saghul Jan 7, 2025
19ca31d
ci: fix boost checksum error preventing builds (#1672)
davidliu Feb 3, 2025
76bc08a
tools: delete tools/build-webrtc.py
saghul Feb 20, 2025
8035eb5
Update build.gradle
Dimon70007 Apr 1, 2025
90c1815
refactor: improve type safety in RTCPeerConnection's getSenders and g…
yoohaso Apr 11, 2025
a388aba
fix: improve RTCPIPView component forwardRef type definition to remov…
yoohaso Apr 28, 2025
94175ed
Multiple video frame processors + implementation for ios (#1681)
8BallBomBom Jun 27, 2025
f515ee5
fix(android): Compatibility with RN 0.80+
oliverlaz Jul 23, 2025
c1ac950
ts: remove mandatory from sessionConstraints in docs, add createOffer…
mrakesh0608 Jul 25, 2025
cadefa5
Feature/video dimensions (#1724)
hmeerlo Jul 25, 2025
2f09f2d
misc: format
saghul Jul 28, 2025
0f1a265
release: 124.0.6
saghul Jul 28, 2025
bb7fa47
Merge branch 'upstream-tag-124.0.6' into main-synced-to-124.0.6
filipi87 Sep 9, 2025
6eae8a6
Fixing merge conflicts.
filipi87 Sep 9, 2025
6c5b489
Fixing to build typescript and updating package-lock
filipi87 Sep 9, 2025
c031c19
Fixing merge conflict issue.
filipi87 Sep 9, 2025
6cbb93e
Adding the new types.
filipi87 Sep 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/android_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ jobs:
android-compile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm install
- name: Check if the git repository is clean
run: $(exit $(git status --porcelain --untracked-files=no | head -255 | wc -l)) || (echo "Dirty git tree"; git diff; exit 1)
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/ios_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ jobs:
ios-compile:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

Expand Down
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Documentation/
examples/
apple/WebRTC.xcframework
apple/WebRTC.dSYMs
android/build/
*.jar
*.tgz
*.zip
.github
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
142 changes: 66 additions & 76 deletions Documentation/AndroidInstallation.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,27 @@ If you plan to also support Bluetooth devices then also add the following.
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
```

### Screen-sharing

Starting with version 118.0.2 a foreground service is included in this library in order to make
screen-sharing possible under Android 14 rules.

If you want to enable it, first declare the following permissions:

```xml
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
```

Then enable the builtin service as follows, by adding the following code very early in your
application, in your main activity's `onCreate` for instance:

```java
// Initialize the WebRTC module options.
WebRTCModuleOptions options = WebRTCModuleOptions.getInstance();
options.enableMediaProjectionService = true;
```

## Enable Java 8 Support

In `android/app/build.gradle` add the following inside the `android` section.
Expand All @@ -43,84 +64,53 @@ compileOptions {
}
```

## R8/ProGuard Support

In `android/app/proguard-rules.pro` add the following on a new line.

```proguard
-keep class org.webrtc.** { *; }
```

## Screen Capture Support - Android 10+

You'll need [Notifee](https://notifee.app/react-native/docs/overview) or another library that can handle foreground services for you.
The basic requirement to get screen capturing working since Android 10 and above is to have a foreground service with `mediaProjection` included as a service type and to have that service running before starting a screen capture session.

In `android/app/main/AndroidManifest.xml` add the following inside the `<application>` section.

```xml
<service
android:name="app.notifee.core.ForegroundService"
android:foregroundServiceType="mediaProjection|camera|microphone" />
## Set audio category (output) to media

The audio is considered calls by default. If you don't want your audio to be treated as a call stream you need to change the category. To set the category:

if your Android files are written in Java, modify `MainApplication.java`:
```java
// add imports
import com.oney.WebRTCModule.WebRTCModuleOptions;
import android.media.AudioAttributes;
import org.webrtc.audio.JavaAudioDeviceModule;

public class MainApplication extends Application implements ReactApplication {
@Override
public void onCreate() {
// append this before WebRTCModule initializes
WebRTCModuleOptions options = WebRTCModuleOptions.getInstance();
AudioAttributes audioAttributes = AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_MEDIA)
.setContentType(AudioAttributes.CONTENT_TYPE_SPEECH)
.build();
options.audioDeviceModule = JavaAudioDeviceModule.builder(this)
.setAudioAttributes(audioAttributes)
.createAudioDeviceModule();
}
}
```

Additionally, add the respective foreground service type permissions before the `<application>` section.

```xml
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
```

The following will create an ongoing persistent notification which also comes with a foreground service.
You will be prompted for permissions automatically each time you want to initialise screen capturing.
A notification channel is also required and created.

```javascript
import notifee, { AndroidImportance } from '@notifee/react-native';

try {
const channelId = await notifee.createChannel( {
id: 'screen_capture',
name: 'Screen Capture',
lights: false,
vibration: false,
importance: AndroidImportance.DEFAULT
} );

await notifee.displayNotification( {
title: 'Screen Capture',
body: 'This notification will be here until you stop capturing.',
android: {
channelId,
asForegroundService: true
}
} );
} catch( err ) {
// Handle Error
};
```

Once screen capturing has finished you should then stop the foreground service.
Usually you'd run a notification cancellation function but as the service is involved, instead run the following.

```javascript
try {
await notifee.stopForegroundService();
} catch( err ) {
// Handle Error
};
```

Lastly, you'll need to add this to your project's main `index.js` file.
Otherwise, you'll receive errors relating to the foreground service not being registered correctly.

```javascript
notifee.registerForegroundService( notification => {
return new Promise( () => {

} );
} );
if your Android files are written in Kotlin, modify `MainApplication.kt`:
```kt
// add imports
import com.oney.WebRTCModule.WebRTCModuleOptions;
import android.media.AudioAttributes
import org.webrtc.audio.JavaAudioDeviceModule;

class MainApplication : Application(), ReactApplication {
override fun onCreate() {
// append this before WebRTCModule initializes
val options = WebRTCModuleOptions.getInstance()
val audioAttributes = AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_MEDIA)
.setContentType(AudioAttributes.CONTENT_TYPE_SPEECH)
.build()
options.audioDeviceModule = JavaAudioDeviceModule.builder(this)
.setAudioAttributes(audioAttributes)
.createAudioDeviceModule()
}
}
```

## Fatal Exception: java.lang.UnsatisfiedLinkError
Expand Down
41 changes: 34 additions & 7 deletions Documentation/BasicUsage.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,9 @@ That will allow you to enable and disable video streams on demand while a call i

```javascript
let sessionConstraints = {
mandatory: {
OfferToReceiveAudio: true,
OfferToReceiveVideo: true,
VoiceActivityDetection: true
}
offerToReceiveAudio: true,
offerToReceiveVideo: true,
voiceActivityDetection: true
};
```

Expand Down Expand Up @@ -307,8 +305,13 @@ try {
// Taken from above, we don't want to flip if we don't have another camera.
if ( cameraCount < 2 ) { return; };

const videoTrack = await localMediaStream.getVideoTracks()[ 0 ];
videoTrack._switchCamera();
const videoTrack = localMediaStream.getVideoTracks()[0];
const constraints = { facingMode: isFrontCam ? 'user' : 'environment' };

videoTrack.applyConstraints(constraints);

// _switchCamera is deprecated as of 124.0.5
// videoTrack._switchCamera();

isFrontCam = !isFrontCam;
} catch( err ) {
Expand Down Expand Up @@ -336,6 +339,30 @@ Don't forget, the user facing camera is usually mirrored.
| objectFit | string | 'contain' | Can be `'contain'` or `'cover'` nothing more or less. |
| streamURL | string | 'streamURL' | Required to have an actual video stream rendering. |
| zOrder | number | 0 | Similar to zIndex. |
| onDimensionsChange | function | undefined | Callback fired when video dimensions change. Receives event with nativeEvent containing width and height. |

## Handling Video Dimension Changes

You can listen for changes in video dimensions using the onDimensionsChange callback.
This is useful for adapting your UI based on the video's aspect ratio or for analytics.

```javascript
import React, { useState } from 'react';

const [videoDimensions, setVideoDimensions] = useState({ width: 0, height: 0 });

<RTCView
mirror={true}
objectFit={'cover'}
streamURL={localMediaStream.toURL()}
zOrder={0}
onDimensionsChange={(event) => {
const { width, height } = event.nativeEvent;
setVideoDimensions({ width, height });
console.log(`Video dimensions changed: ${width}x${height}`);
}}
/>
```

## Controlling remote audio tracks

Expand Down
8 changes: 3 additions & 5 deletions Documentation/CallGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,9 @@ So you can now start creating an offer which then needs sending send off to the

```javascript
let sessionConstraints = {
mandatory: {
OfferToReceiveAudio: true,
OfferToReceiveVideo: true,
VoiceActivityDetection: true
}
offerToReceiveAudio: true,
offerToReceiveVideo: true,
voiceActivityDetection: true
};

try {
Expand Down
42 changes: 42 additions & 0 deletions Documentation/iOSInstallation.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,48 @@ Navigate to `<ProjectFolder>/ios/<ProjectName>/` and edit `Info.plist`, add the
<string>Microphone permission description</string>
```

## CallKit

If your app uses a CallKit integration to handle incoming calls, then your
CXProviderDelegate should call through to `RTCAudioSession.sharedInstance.audioSessionDidActivate/Deactivate` accordingly.

```
#import <WebRTC/RTCAudioSession.h>

- (void) provider:(CXProvider *) provider didActivateAudioSession:(AVAudioSession *) audioSession {
[[RTCAudioSession sharedInstance] audioSessionDidActivate:[AVAudioSession sharedInstance]];
}

- (void) provider:(CXProvider *) provider didDeactivateAudioSession:(AVAudioSession *) audioSession {
[[RTCAudioSession sharedInstance] audioSessionDidDeactivate:[AVAudioSession sharedInstance]];
}
```

Javascript methods are also provided to call these methods:

```
import { RTCAudioSession } from 'react-native-webrtc'

// Call as needed.
RTCAudioSession.audioSessionDidActivate();
RTCAudioSession.audioSessionDidDeactivate();
```

## Background Camera Access

Background camera access on supported devices can be enabled through setting the `enableMultitaskingCameraAccess` flag on WebRTCModuleOptions. This will require
the `voip` background mode capability on iOS 18 or later devices.

In your AppDelegate.m file:
```
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[WebRTCModuleOptions sharedInstance].enableMultitaskingCameraAccess = YES;

// ...
}
```

## Library not loaded/Code signature invalid

This is an issue with iOS 13.3.1.
Expand Down
8 changes: 5 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ android {
buildToolsVersion safeExtGet('buildToolsVersion', "23.0.1")

defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 24)
minSdkVersion 24
targetSdkVersion safeExtGet('targetSdkVersion', 24)
versionCode 1
versionName "1.0"
consumerProguardFiles 'consumer-rules.pro'
}

// WebRTC requires Java 8 features
Expand All @@ -29,6 +30,7 @@ android {
}

dependencies {
implementation 'com.facebook.react:react-native:+'
api 'org.jitsi:webrtc:118.+'
implementation "com.facebook.react:react-android:+"
api 'org.jitsi:webrtc:124.+'
implementation "androidx.core:core:1.7.0"
}
2 changes: 2 additions & 0 deletions android/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# WebRTC
-keep class org.webrtc.** { *; }
7 changes: 0 additions & 7 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,10 @@
package="com.oney.WebRTCModule"
xmlns:tools="http://schemas.android.com/tools"
>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<application>
<service
android:name=".MediaProjectionService"
android:foregroundServiceType="mediaProjection">
</service>
</application>
<uses-feature
android:name="android.hardware.usb.host"
android:required="false"
tools:node="replace"
/>
</manifest>
Loading