libgdx / gdx-video

A libGDX cross platform video rendering extension
Apache License 2.0
145 stars 50 forks source link

Does not work on Java 8 #88

Open Frosty-J opened 4 months ago

Frosty-J commented 4 months ago

I think there was a change to ByteBuffer sometime after 8, with or before 11. My game just repeatedly spews the below if I run it on a Java 8 JRE. Was under the impression gdx-video should be good for down to 7. I'll do some troubleshooting now, will probably just use a new JRE - jam time is running out!

Exception in thread "main" java.lang.NoSuchMethodError: java.nio.ByteBuffer.rewind()Ljava/nio/ByteBuffer;
        at com.badlogic.gdx.video.CommonVideoPlayerDesktop.readFileContents(CommonVideoPlayerDesktop.java:145)
        at com.badlogic.gdx.video.CommonVideoPlayerDesktop.access$000(CommonVideoPlayerDesktop.java:40)
        at com.badlogic.gdx.video.CommonVideoPlayerDesktop$1.fillBuffer(CommonVideoPlayerDesktop.java:106)
        at com.badlogic.gdx.video.VideoDecoder.loadStream(Native Method)
        at com.badlogic.gdx.video.CommonVideoPlayerDesktop.play(CommonVideoPlayerDesktop.java:103)
        at com.javacakegames.gbtksort.actors.VideosActor.<init>(VideosActor.java:32)
        at com.javacakegames.gbtksort.screens.GameScreen.show(GameScreen.java:406)
        at de.eskalon.commons.screen.ScreenManager.initializeScreen(ScreenManager.java:333)
        at de.eskalon.commons.screen.ScreenManager.render(ScreenManager.java:285)
        at com.javacakegames.gbtksort.GbtkGame.render(GbtkGame.java:84)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.update(Lwjgl3Window.java:387)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:193)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:167)
        at com.javacakegames.gbtksort.Lwjgl3Launcher.main(Lwjgl3Launcher.java:272)

(line numbers might be wrong since this is my own build of it)

SimonIT commented 4 months ago

I found the reason: https://stackoverflow.com/questions/61267495/exception-in-thread-main-java-lang-nosuchmethoderror-java-nio-bytebuffer-flip We have to find now where to use Buffer instead of ByteBuffer I remember we already had that error before: libgdx/libgdx#6331

mgsx-dev commented 4 months ago

best is to use the release option like it's done in libgdx https://github.com/libgdx/libgdx/blob/master/gdx/build.gradle#L19 instead of doing the same mistake we alredy discussed : https://github.com/libgdx/libgdx/pull/6331

Frosty-J commented 4 months ago

I agree. I didn't have much luck when I tried the cast... not sure why, actually.

options.release works well. I don't think we have a versions.java in gdx-video, so I hardcoded it when testing.