Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ runs:
PROFILES: ${{ inputs.profiles }}
SKIP_UPLOAD: ${{ inputs.skip-upload }}
run: >
mvn -B deploy -pl .,webrtc,webrtc-media,webrtc-javafx -DskipTests
mvn -B deploy -pl .,webrtc,webrtc-media,webrtc-swing,webrtc-javafx -DskipTests
-Dmaven.repository.credentialScope=id
${PROFILES:+-P$PROFILES}
-Dnatives.dir="$PWD/natives"
Expand Down
16 changes: 13 additions & 3 deletions .github/actions/test-natives/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,27 @@ runs:
"$JAVA_HOME/bin/jar" xf "$WEBRTC_JAR"
rm -rf META-INF
ls -l
cd - > /dev/null

# The Swing module's tests need only webrtc-java's natives, and read
# them from a directory of the same name for the same reason.
mkdir -p webrtc-swing/target/natives
cd webrtc-swing/target/natives
"$JAVA_HOME/bin/jar" xf "$WEBRTC_JAR"
rm -rf META-INF
ls -l
shell: bash

# One reactor for both, so that webrtc-java-media resolves webrtc-java
# from it. Testing rather than installing: webrtc attaches the host
# One reactor for all, so that webrtc-java-media and webrtc-java-swing
# resolve webrtc-java from it. The Swing view paints into images, which
# needs no display. Testing rather than installing: webrtc attaches the host
# natives from webrtc-jni/target during its package phase, and on a runner
# that only downloaded them there is no such directory.
#
# The native build is off: these natives were cross compiled by another
# job, and this runner is here to run them, not to build them again.
- name: Test
run: mvn -B -pl webrtc,webrtc-media test -DskipNativeBuild -P${{ inputs.profile }} -Dsurefire.timeout=1800
run: mvn -B -pl webrtc,webrtc-media,webrtc-swing test -DskipNativeBuild -P${{ inputs.profile }} -Dsurefire.timeout=1800
shell: bash

# What failed, for runners that cannot be reproduced locally.
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ jobs:
echo '```'
ls -1 webrtc/target/*.jar webrtc/target/*.asc \
webrtc-media/target/*.jar webrtc-media/target/*.asc \
webrtc-swing/target/*.jar webrtc-swing/target/*.asc \
webrtc-javafx/target/*.jar webrtc-javafx/target/*.asc \
natives/*.asc 2>/dev/null || true
echo '```'
Expand All @@ -241,6 +242,9 @@ jobs:
webrtc-media/target/central-*/**
webrtc-media/target/*.jar
webrtc-media/target/*.asc
webrtc-swing/target/central-*/**
webrtc-swing/target/*.jar
webrtc-swing/target/*.asc
webrtc-javafx/target/central-*/**
webrtc-javafx/target/*.jar
webrtc-javafx/target/*.asc
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The library provides a comprehensive set of Java classes that map to the WebRTC
- **[Cameras and microphones](https://jrtc.dev/guide/media/media-devices)** - Capture from any local device
- **[Screen sharing](https://jrtc.dev/guide/video/desktop-capture)** - Share the full desktop or single application windows
- **[Video processing](https://jrtc.dev/guide/video/camera-capture#changing-frames-before-they-are-sent)** - Blur a background, draw an overlay or blank out part of the screen before frames are sent
- **[Video views](https://jrtc.dev/guide/client-api#handlers-on-the-ui-thread)** - Ready-made components that show video in Swing, or in JavaFX with the `webrtc-java-javafx` module
- **[Video views](https://jrtc.dev/guide/client-api#handlers-on-the-ui-thread)** - Ready-made components that show video in Swing with the `webrtc-java-swing` module, or in JavaFX with the `webrtc-java-javafx` module

**Codecs and encoded media**

Expand Down
2 changes: 2 additions & 0 deletions design/client-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,8 @@ Next:
- `VideoView` for JavaFX lives in the `webrtc-java-javafx` module, package
`dev.onvoid.webrtc.client.javafx`, compiled for Java 11 since OpenJFX is; JavaFX is an optional
dependency the application brings. `JavaFxCameraExample` in `webrtc-examples` uses it.
- `VideoView` for Swing lives in the `webrtc-java-swing` module, package
`dev.onvoid.webrtc.client.swing`, so that the core module does not need `java.desktop`.
- phase 2 is done: `Whip.to(...).publish(rtc)` and
`Whep.from(...).play(rtc)` return sessions over `java.net.http.HttpClient`, and `VideoView` is in
`dev.onvoid.webrtc.client.swing`;
Expand Down
12 changes: 11 additions & 1 deletion docs/guide/client-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,17 @@ hangUpButton.addActionListener(event -> peer.close()); // never blocks the EDT

The order of each peer's events is kept with any executor, including a thread pool. Frame handlers stay on their own threads even then, since frames come far too often for a UI thread.

`VideoView` in `dev.onvoid.webrtc.client.swing` shows video in a Swing window. It converts each frame on the frame's own thread and leaves only the painting to the EDT. It keeps the picture's aspect ratio and rotation, and can mirror a local camera preview:
The `webrtc-java-swing` module has a `VideoView` in `dev.onvoid.webrtc.client.swing` that shows video in a Swing window. The core `webrtc-java` module does not depend on `java.desktop`, so headless applications and trimmed runtime images need neither AWT nor Swing:

```xml
<dependency>
<groupId>dev.onvoid.webrtc</groupId>
<artifactId>webrtc-java-swing</artifactId>
<version>{{ VERSION }}</version>
</dependency>
```

The view converts each frame on the frame's own thread and leaves only the painting to the EDT. It keeps the picture's aspect ratio and rotation, and can mirror a local camera preview:

```java
import dev.onvoid.webrtc.client.swing.VideoView;
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ The [`MediaFilePlayerExample`](https://github.com/devopvoid/webrtc-java/blob/mas
- Running the peers' handlers on the Swing event dispatch thread
- Keeping audio and video in sync by sending both tracks in the same media stream
- Raising the video sender's maximum bitrate once it is connected, so a high-resolution file is not held to a fraction of its size
- Rendering received video in the Swing `VideoView`
- Rendering received video in the Swing `VideoView` of the `webrtc-java-swing` module
- Showing the source's format, the playback position, and live receive metrics (codec, resolution, frame rate, bitrate, packet loss, jitter, audio level) read from `onStats`
- Recording the received tracks into a Matroska file with `MediaRecorder`
- Closing the peers, then the tracks, then the source on Stop
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<module>webrtc-jni</module>
<module>webrtc</module>
<module>webrtc-media</module>
<module>webrtc-swing</module>
<module>webrtc-javafx</module>
<module>webrtc-examples</module>
</modules>
Expand Down
5 changes: 5 additions & 0 deletions webrtc-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@
<artifactId>webrtc-java-media</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>webrtc-java-swing</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>webrtc-java-javafx</artifactId>
Expand Down
1 change: 1 addition & 0 deletions webrtc-examples/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
requires org.eclipse.jetty.websocket.server;
requires webrtc.java;
requires webrtc.java.javafx;
requires webrtc.java.swing;
requires webrtc.java.media;

exports dev.onvoid.webrtc.examples.web.client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ target_sources(${PROJECT_NAME}
include/JavaClassLoader.h
include/JavaClassUtils.h
include/JavaContext.h
include/JavaDimension.h
include/JavaEnum.h
include/JavaEnums.h
include/JavaError.h
Expand All @@ -29,7 +28,6 @@ target_sources(${PROJECT_NAME}
include/JavaNullPointerException.h
include/JavaObject.h
include/JavaPrimitive.h
include/JavaRectangle.h
include/JavaRef.h
include/JavaRuntimeException.h
include/JavaString.h
Expand All @@ -44,13 +42,11 @@ target_sources(${PROJECT_NAME}
src/JavaClassLoader.cpp
src/JavaClassUtils.cpp
src/JavaContext.cpp
src/JavaDimension.cpp
src/JavaHashMap.cpp
src/JavaIterable.cpp
src/JavaList.cpp
src/JavaMapIterator.cpp
src/JavaObject.cpp
src/JavaRectangle.cpp
src/JavaString.cpp
src/JavaThreadEnv.cpp
src/JavaThrowable.cpp
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

#include "media/video/desktop/DesktopCaptureCallback.h"
#include "media/video/desktop/DesktopFrame.h"
#include "api/WebRTCUtils.h"
#include "JavaClasses.h"
#include "JavaEnums.h"
Expand Down
57 changes: 0 additions & 57 deletions webrtc-jni/src/main/cpp/src/media/video/desktop/DesktopFrame.cpp

This file was deleted.

Loading
Loading