devgianlu / librespot-android

A demo app that runs librespot-java on Android
33 stars 13 forks source link

Add UI to example activity #4

Closed devgianlu closed 3 years ago

devgianlu commented 3 years ago
mitschwimmer commented 3 years ago

Hey @devgianlu, amazing to see what you are achieving here! Still, there seems to be an issue left with tremolo on the master branch. Once I see the player UI I can't actually play a track. I get this error:

2021-05-01 07:28:25.826 9374-9420/xyz.gianlu.librespot.android E/brespot.androi: No implementation found for long xyz.gianlu.librespot.player.decoders.tremolo.OggDecodingInputStream.initDecoder(java.nio.ByteBuffer) (tried Java_xyz_gianlu_librespot_player_decoders_tremolo_OggDecodingInputStream_initDecoder and Java_xyz_gianlu_librespot_player_decoders_tremolo_OggDecodingInputStream_initDecoder__Ljava_nio_ByteBuffer_2)
2021-05-01 07:28:25.827 9374-9420/xyz.gianlu.librespot.android E/x.g.l.a.d.Decoders: Failed initializing Codec instance for VORBIS
    java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
        at xyz.gianlu.librespot.audio.decoders.Decoders.initDecoder(Decoders.java:54)
        at xyz.gianlu.librespot.player.playback.PlayerQueueEntry.load(PlayerQueueEntry.java:140)
        at xyz.gianlu.librespot.player.playback.PlayerQueueEntry.run(PlayerQueueEntry.java:271)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
     Caused by: java.lang.UnsatisfiedLinkError: No implementation found for long xyz.gianlu.librespot.player.decoders.tremolo.OggDecodingInputStream.initDecoder(java.nio.ByteBuffer) (tried Java_xyz_gianlu_librespot_player_decoders_tremolo_OggDecodingInputStream_initDecoder and Java_xyz_gianlu_librespot_player_decoders_tremolo_OggDecodingInputStream_initDecoder__Ljava_nio_ByteBuffer_2)
        at xyz.gianlu.librespot.player.decoders.tremolo.OggDecodingInputStream.initDecoder(Native Method)
        at xyz.gianlu.librespot.player.decoders.tremolo.OggDecodingInputStream.<init>(OggDecodingInputStream.java:36)
        at xyz.gianlu.librespot.player.decoders.TremoloVorbisCodec.<init>(TremoloVorbisCodec.java:20)
        at java.lang.reflect.Constructor.newInstance0(Native Method) 
        at java.lang.reflect.Constructor.newInstance(Constructor.java:343) 
        at xyz.gianlu.librespot.audio.decoders.Decoders.initDecoder(Decoders.java:54) 
        at xyz.gianlu.librespot.player.playback.PlayerQueueEntry.load(PlayerQueueEntry.java:140) 
        at xyz.gianlu.librespot.player.playback.PlayerQueueEntry.run(PlayerQueueEntry.java:271) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:923) 
2021-05-01 07:28:25.827 9374-9420/xyz.gianlu.librespot.android E/x.g.l.p.Player: Failed loading track.
    java.io.UnsupportedEncodingException: VORBIS
        at xyz.gianlu.librespot.player.playback.PlayerQueueEntry.load(PlayerQueueEntry.java:142)
        at xyz.gianlu.librespot.player.playback.PlayerQueueEntry.run(PlayerQueueEntry.java:271)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)

I am testing on a Pixel 3aXL with Android 11. What do you think, should I open a new issue for that?

devgianlu commented 3 years ago

That's strange, it's complaining about a missing native method, but it's there.

Maybe @funtax knows more

funtax commented 3 years ago

This happens because the package of the decoder has changed. The native code is still targeting the old package/class Java_xyz_gianlu_librespot_player_codecs_tremolo_OggDecodingInputStream.

I will try to fix this later and provide a new compiled version.

devgianlu commented 3 years ago

Oh right, I renamed it because the terminology codec was wrong (and it has been for way too long) and this was the right time to change it.

Thank you for looking into it

funtax commented 3 years ago

@devgianlu Could you give me write-access to this repo? Then I don't have to open a PR for such minor changes.

devgianlu commented 3 years ago

@funtax Invited you

funtax commented 3 years ago

Perfect, thank you @devgianlu . @mitschwimmer I have updated the native library but not tested it yet. Feel free to update and give it another try.

mitschwimmer commented 3 years ago

@funtax, @devgianlu just tried it. Works great :man_dancing: