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
21 changes: 11 additions & 10 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ jobs:
run: ./gradlew :gdx-video-desktop:FFmpeg:buildFFmpegMacosAll :gdx-video-desktop:jnigenBuildMacosAll

- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: desktop-natives
name: natives-macos
path: gdx-video-desktop/libs/**/*.dylib
if-no-files-found: error

Expand Down Expand Up @@ -65,9 +65,9 @@ jobs:
run: ./gradlew :gdx-video-desktop:FFmpeg:buildFFmpegLinuxAll :gdx-video-desktop:jnigenBuildLinuxAll

- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: desktop-natives
name: natives-linux
path: gdx-video-desktop/libs/**/*.so
if-no-files-found: error

Expand Down Expand Up @@ -98,9 +98,9 @@ jobs:
run: ./gradlew :gdx-video-desktop:FFmpeg:buildFFmpegWindowsAll :gdx-video-desktop:jnigenBuildWindowsAll

- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: desktop-natives
name: natives-windows
path: gdx-video-desktop/libs/**/*.dll
if-no-files-found: error

Expand Down Expand Up @@ -128,11 +128,12 @@ jobs:
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Download desktop-natives artifact
uses: actions/download-artifact@v3
- name: Download individual natives artifacts
uses: actions/download-artifact@v4
with:
name: desktop-natives
pattern: natives-*
path: gdx-video-desktop/libs
merge-multiple: true

- name: Create JAR with natives for desktop
run: ./gradlew jnigenJarNativesDesktop --info
Expand All @@ -148,7 +149,7 @@ jobs:

- name: Upload all output libs
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: output-libs
path: '**/build/libs/'
19 changes: 10 additions & 9 deletions .github/workflows/publish_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ jobs:
run: ./gradlew :gdx-video-desktop:FFmpeg:buildFFmpegMacosAll :gdx-video-desktop:jnigenBuildMacosAll

- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: desktop-natives
name: natives-macos
path: gdx-video-desktop/libs/**/*.dylib
if-no-files-found: error

Expand Down Expand Up @@ -71,9 +71,9 @@ jobs:
run: ./gradlew :gdx-video-desktop:FFmpeg:buildFFmpegLinuxAll :gdx-video-desktop:jnigenBuildLinuxAll

- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: desktop-natives
name: natives-linux
path: gdx-video-desktop/libs/**/*.so
if-no-files-found: error

Expand Down Expand Up @@ -104,9 +104,9 @@ jobs:
run: ./gradlew :gdx-video-desktop:FFmpeg:buildFFmpegWindowsAll :gdx-video-desktop:jnigenBuildWindowsAll

- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: desktop-natives
name: natives-windows
path: gdx-video-desktop/libs/**/*.dll
if-no-files-found: error

Expand Down Expand Up @@ -134,11 +134,12 @@ jobs:
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Download desktop-natives artifact
uses: actions/download-artifact@v3
- name: Download individual natives artifacts
uses: actions/download-artifact@v4
with:
name: desktop-natives
pattern: natives-*
path: gdx-video-desktop/libs
merge-multiple: true

- name: Create JAR with natives for desktop
run: ./gradlew jnigenJarNativesDesktop --info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ public void run () {

VideoSizeListener sizeListener;
CompletionListener completionListener;

private boolean currentLooping = false;
private float currentVolume = 1.0f;

/** Used for sending mediaplayer tasks to the Main Looper */
Expand Down Expand Up @@ -182,6 +184,8 @@ public void run () {
fbo = new FrameBuffer(Pixmap.Format.RGB888, player.getVideoWidth(), player.getVideoHeight(), false);
}
prepared = true;
player.setVolume(currentVolume, currentVolume);
player.setLooping(currentLooping);
if (playRequested) {
player.start();
}
Expand Down Expand Up @@ -299,7 +303,7 @@ public boolean isBuffered () {

@Override
public void stop () {
if (player != null && player.isPlaying()) {
if (player != null && isPlaying()) {
player.stop();
player.reset();
}
Expand All @@ -315,7 +319,7 @@ public void onFrameAvailable (SurfaceTexture surfaceTexture) {
@Override
public void pause () {
// If it is running
if (prepared) {
if (isPlaying()) {
player.pause();
}
playRequested = false;
Expand Down Expand Up @@ -364,23 +368,34 @@ public void setOnCompletionListener (CompletionListener listener) {

@Override
public int getVideoWidth () {
if (!prepared) {
return 0;
}
return player.getVideoWidth();
}

@Override
public int getVideoHeight () {
if (!prepared) {
return 0;
}
return player.getVideoHeight();
}

@Override
public boolean isPlaying () {
if (!prepared) {
return false;
}
return player.isPlaying();
}

@Override
public void setVolume (float volume) {
currentVolume = volume;
player.setVolume(volume, volume);
if (prepared) {
player.setVolume(volume, volume);
}
}

@Override
Expand All @@ -390,16 +405,22 @@ public float getVolume () {

@Override
public void setLooping (boolean looping) {
player.setLooping(looping);
currentLooping = looping;
if (prepared) {
player.setLooping(looping);
}
}

@Override
public boolean isLooping () {
return player.isLooping();
return currentLooping;
}

@Override
public int getCurrentTimestamp () {
if (!prepared) {
return 0;
}
return player.getCurrentPosition();
}
}