Ali_RS
February 28, 2023, 6:26am
1
Hi there,
I late-merged these two PRs into the v3.6 branch and they will be included in the next beta release
jMonkeyEngine:master
← Ali-RS:android-ogg
opened 09:20PM - 20 Feb 23 UTC
This PR takes use of `OGGLoader` from `jme3-jogg` instead of `NativeVorbisLoader… ` for loading ogg audio. The `jme3-jogg` uses a pure java decoder and supports `streamCache`.
Solve #1960
jMonkeyEngine:master
← jMonkeyEngine:sgold/ogg-vorbis
opened 07:55PM - 21 Feb 23 UTC
The jme3-jogg library currently depends on the open-source j-ogg-all library. In… turn, j-ogg-all depends on the Java Media Framework (JMF), which is large (about 1.9 MBytes), unmaintained, not open-source, and not available for all platforms.
In fact, jme3-jogg uses just a fraction of the j-ogg-all functionality: specifically, the Ogg-container reader and the Vorbis decoder.
Version 1.0.3 of the j-ogg-all project includes a new library ("j-ogg-vorbis") without decoders for the FLAC and Theora formats. This PR substitutes "j-ogg-vorbis" for "j-ogg-all", which should result in more compact applications with fewer dependencies.
to fix
opened 03:01PM - 25 Feb 23 UTC
closed 07:15AM - 28 Feb 23 UTC
bug
Android
Android NativeVorbisLoader can not load audio files outside Android's assets dir… ectory.
```
java.lang.UnsupportedOperationException: Cannot load audio files from classpath.Place your audio files in Android's assets directory
at com.jme3.audio.plugins.NativeVorbisLoader.load(NativeVorbisLoader.java:122)
at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:260)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:374)
at com.jme3.audio.AudioNode.<init>(AudioNode.java:164)
at com.jme3.audio.AudioNode.<init>(AudioNode.java:144)
at com.scenemaxeng.projector.SceneMaxApp.loadAudioResource(SceneMaxApp.java:880)
at com.scenemaxeng.projector.SceneMaxApp.loadResource(SceneMaxApp.java:864)
at com.scenemaxeng.projector.SceneMaxApp.run(SceneMaxApp.java:719)
at com.abware.scenemax3dgamehub.JmeProjectorFragment.runScript(JmeProjectorFragment.java:63)
at com.abware.scenemax3dgamehub.ui.FullscreenGameActivity$7.run(FullscreenGameActivity.java:255)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
```
https://github.com/jMonkeyEngine/jmonkeyengine/blob/0cb5fe755582d776ddf223ce88771d958f4818cf/jme3-android/src/main/java/com/jme3/audio/plugins/NativeVorbisLoader.java#L151-L158
Related forum posts:
https://hub.jmonkeyengine.org/t/solved-cannot-load-audio-files-from-classpath-place-your-audio-files-in-androids-assets-directory/37050
https://hub.jmonkeyengine.org/t/android-assets-manager-cannot-find-audio-files/44638
So it will use OGGLoader (from jme3-jogg module) instead of using Android NativeVorbisLoader.
But by default jme3-jogg
is not included as a dependency in jme3-android
so after this change users must remember to add jme3-jogg
dependency to play ogg files (just like they do on desktop) else they will get a class not found exception at runtime.
Is this fine or should I explicitly add that dependency to jme3-android
?