Android Question Exoplayer v 1.30

dagodom

Member
Licensed User
Longtime User
Hello
using exoplayer library version 1.30
the instructions
B4X:
    Dim jo As JavaObject = player1
   Dim e As Object = jo.CreateEvent("com.google.android.exoplayer2.Player$EventListener", "check", False)
   jo.GetFieldJO("player").RunMethod("addListener", Array(e))
determine this error
B4X:
Cannot get methods of class: com.google.android.exoplayer2.SimpleExoPlayer, disabling cache.

what am I doing wrong ?

Thanks
 

dagodom

Member
Licensed User
Longtime User
Hello
the project is quite large and needs two apps to prove it.
I cut everything except the instructions that go wrong but I left all the libraries I use.
The error reappears, I am attaching the file and the error, I hope it is enough.
Thanks

---------------------------------------

Cannot get methods of class: com.google.android.exoplayer2.SimpleExoPlayer, disabling cache.
main_create_event (java line: 385)
java.lang.RuntimeException: Method: addListener not found in: com.google.android.exoplayer2.SimpleExoPlayer
at anywheresoftware.b4j.object.JavaObject$MethodCache.getMethod(JavaObject.java:366)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:119)
at erel.first.com.main._create_event(main.java:385)
at erel.first.com.main._activity_resume(main.java:350)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at erel.first.com.main.afterFirstLayout(main.java:110)
at erel.first.com.main.access$000(main.java:17)
at erel.first.com.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5603)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Method: addListener not found in: com.google.android.exoplayer2.SimpleExoPlayer
 

Attachments

  • erel.zip
    110.1 KB · Views: 317
Upvote 0

dagodom

Member
Licensed User
Longtime User
The version is Android 4.4.2.
About the errors in the manifest, given that something I took off on the fly, it would be useful if you told me what was wrong.
Development with B4A is a hobby that I can devote little time to, I often settle for things to work.
Thanks
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
About the errors in the manifest, given that something I took off on the fly, it would be useful if you told me what was wrong.
The runtime permissions were not handled correctly: https://www.b4x.com/android/forum/threads/67689/#content
If you are not submitting your app to Google Play then you can keep targetSdkVersion to be less than 23.

The error probably happens because of the Android version. Why do you need to add an event listener? A listener is added by the library.
 
Upvote 0

dagodom

Member
Licensed User
Longtime User
Thanks for the corrections.
As for the event, I tried to add the event capture for this reason:
I have an audio that does not trigger the complete event.
Fortunately, the ready event is activated and I have solved by activating a timer that starts at the moment of play and, once the duration of the music is read at the ready event, I close the player at the end of the duration.
But I have other strange behaviors, for example finished the first video if I launch the second I hear the audio but the image of the first video remains fixed despite having released and initialized the exoplayer element again.
It is probably just the adroid version of the tablet that I am using, among other things also some sql queries sometimes work yes and sometimes not even though they are exactly the same and with the same predicates.
Thanks anyway, I will find another solution.
Best regards
 
Upvote 0
Top