B4A Library ExoPlayer - MediaPlayer / VideoView Alternative

Status
Not open for further replies.

Rusty

Well-Known Member
Licensed User
Longtime User
oops...thanks. I was trying to pause the SimpleExoPlayerView...not the SimpleExoPlayer...
 

lymey

Active Member
Licensed User
Longtime User

Hi Erel,
do you have some examples of what can be customized - is it interface/controls too? Also are there other events, like Paused, is playing, etc?
Many thanks!
 

victormedranop

Well-Known Member
Licensed User
Longtime User
hi, i'm having some problems with fit to tv scale.
try
B4X:
SimpleExoPlayerView1.ResizeMode = "FIT"

but have no effect on.

regards,

Victor
 

Licht2002

Member
Licensed User
Longtime User
Have you copied the aar file to the additional libraries folder?
Hi Erel,

i did everything again:

Load the Libs and store them to: C:\Program Files (x86)\Anywhere Software\Basic4android\Libraries

Load new the Sample from Post #1
Load the aar and store it to: C:\Program Files (x86)\Anywhere Software\Basic4android\Libraries

Load the new Java: C:\Program Files\Java\jdk1.8.0_112\bin\javac.exe

Load the new SDK: C:\Android\platforms\android-25\android.jar


But on all my Devices from 4.1.2 over 4.4 to 6.0.... allways the same error:

B4X:
LogCat connected to: B4A-Bridge: samsung SM-G930F
--------- beginning of main
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (service1) Create **
** Service (service1) Start **
** Service (service1) Destroy **
** Service (service1) Create **
** Service (service1) Start **
Connected to B4A-Bridge (Wifi)
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:b4a.Exoplayer
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
Installing file.
PackageAdded: package:b4a.Exoplayer
Installing file.
PackageAdded: package:b4a.Exoplayer
Copying updated assets files (1)
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/exoplayer2/upstream/DefaultBandwidthMeter;
    at anywheresoftware.b4a.objects.SimpleExoPlayerWrapper.Initialize(SimpleExoPlayerWrapper.java:73)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:753)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:343)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at b4a.Exoplayer.main.afterFirstLayout(main.java:102)
    at b4a.Exoplayer.main.access$000(main.java:17)
    at b4a.Exoplayer.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:158)
    at android.app.ActivityThread.main(ActivityThread.java:7229)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.exoplayer2.upstream.DefaultBandwidthMeter" on path: DexPathList[[zip file "/data/app/b4a.Exoplayer-1/base.apk"],nativeLibraryDirectories=[/data/app/b4a.Exoplayer-1/lib/arm64, /vendor/lib64, /system/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    ... 17 more
    Suppressed: java.lang.ClassNotFoundException: com.google.android.exoplayer2.upstream.DefaultBandwidthMeter
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 18 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
** Activity (main) Resume **
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/exoplayer2/source/dash/DashMediaSource;
    at anywheresoftware.b4a.objects.SimpleExoPlayerWrapper.CreateDashSource(SimpleExoPlayerWrapper.java:174)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:708)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:337)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
    at b4a.Exoplayer.main.afterFirstLayout(main.java:108)
    at b4a.Exoplayer.main.access$000(main.java:17)
    at b4a.Exoplayer.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:158)
    at android.app.ActivityThread.main(ActivityThread.java:7229)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.exoplayer2.source.dash.DashMediaSource" on path: DexPathList[[zip file "/data/app/b4a.Exoplayer-1/base.apk"],nativeLibraryDirectories=[/data/app/b4a.Exoplayer-1/lib/arm64, /vendor/lib64, /system/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    ... 18 more
    Suppressed: java.lang.ClassNotFoundException: com.google.android.exoplayer2.source.dash.DashMediaSource
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 19 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

What does this line in the error-log mean:
B4X:
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.exoplayer2.source.dash.DashMediaSource" on path: DexPathList[[zip file "/data/app/b4a.Exoplayer-1/base.apk"],nativeLibraryDirectories=[/data/app/b4a.Exoplayer-1/lib/arm64, /vendor/lib64, /system/lib64]]





Thx Tom
 
Last edited:

Asim A Baki

Active Member
Licensed User
Longtime User
You cannot. However you can create a layout file with only the SimpleExoPlayerView and load this layout one or more times and do whatever you like with the view.

how to do that? I need to add videoview at runtime
 

almontgreen

Active Member
Licensed User
Longtime User
 

almontgreen

Active Member
Licensed User
Longtime User
Is there a new version of the ExoPlayer library?

There is new commentary/features here: https://github.com/yangwuan55/ExoPlayer/tree/playbackSpeed

I have offered to pay for mods and for a while had somed3v3loper working on it but there never was any progress and there were many problems I guess? Video playback control is so integral to almost any application that I am at a loss to understand why more work is not being done??? I wish I had the expertise to understand it as I would jump on this... perhaps offering $$thousands instead of $$hundreds would help? I'm about ready to do that as I have several projects in the works that really need a better solution with more features like: position seeking based on frame rate of the encoded file, buffer management, speed control, reverse playback, play to a frame and stop, etc... Am I the only one?
 

biometrics

Active Member
Licensed User
Longtime User
UPDATE: Installed latest API and it's working. Guess I always misunderstood the API numbers, I thought you had to match it with the Android version you're targeting, latest API seems to run fine on Android 4.4.


I'm trying to get ExoPlayer working to replace VideoView.

I have the following installed on Windows 7 64 bit.

B4A 7.01
Java SE Development Kit 8u131
Android SDK r24.4.1
ExoPlayer.jar, ExoPlayer.xml and exoplayer.aar are in this directory: C:\Program Files (x86)\Anywhere Software\Basic4android\Additional Libraries

Android SDK Manager looks as follows (Android Support Repository and Google Repository is also installed):


Tools/Configure Paths looks as follows:


Compiling the sample in the first post in either debug or release mode produces this error (I have replaced our company and product name in the directories with xxx\yyy):

B4X:
B4A version: 7.01
Parsing code.  (0.00s)
Compiling code.  (0.06s)
Compiling layouts code.  (0.00s)
Organizing libraries.  (0.00s)
Generating R file.  Error
C:\Root\xxx\yyy\Player\Android\ExoPlayer\Objects\bin\extra\res1\res\layout\exo_playback_control_view.xml:16: error: No resource identifier found for attribute 'layoutDirection' in package 'android'
C:\Root\xxx\yyy\Player\Android\ExoPlayer\Objects\bin\extra\res1\res\layout\exo_playback_control_view.xml:57: error: No resource identifier found for attribute 'paddingStart' in package 'android'
C:\Root\xxx\yyy\Player\Android\ExoPlayer\Objects\bin\extra\res1\res\layout\exo_playback_control_view.xml:57: error: No resource identifier found for attribute 'paddingEnd' in package 'android'
C:\Root\xxx\yyy\Player\Android\ExoPlayer\Objects\bin\extra\res1\res\layout\exo_playback_control_view.xml:74: error: No resource identifier found for attribute 'paddingEnd' in package 'android'
C:\Root\xxx\yyy\Player\Android\ExoPlayer\Objects\bin\extra\res1\res\layout\exo_playback_control_view.xml:74: error: No resource identifier found for attribute 'paddingStart' in package 'android'

Any ideas why this isn't compiling? Is it perhaps because of the API version?

I've been using API 15 as the devices we used had Android 4.0.3. I understand that ExoPlayer requires API 16. The current devices we use run Android 4.4. Will our app work on Android 4.4 if I replace API 16 it with the latest API if that is required to make ExoPlayer run?
 
Last edited:

biometrics

Active Member
Licensed User
Longtime User
Use the newest android.jar, it has nothing to do with the android version of your device. Install api 25 in sdk manager and remove api 16 tools.
Thanks, I did that a few days ago and it appears to have made the volume setting of VideoView more reliable. Turns out ExoPlayer is too slow, we can't use it. So I've misunderstood the API level for a long time .
 

Almora

Well-Known Member
Licensed User
Longtime User
hi..
We can check the previous and next buttons as code?
 

Attachments

  • Screenshot_2017-07-18-20-10-35.jpg
    207.3 KB · Views: 436
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…