B4A Library ExoPlayer (media3) - video player

ExoPlayer is a powerful media player created by Google: https://developer.android.com/guide/topics/media/exoplayer

This version is based on Media3 ExoPlayer v1.2. It replaces ExoPlayer 2: https://www.b4x.com/android/forum/threads/exoplayer-mediaplayer-videoview-alternative.72652/#content
The underlying SDK isn't backward compatible so calls with JavaObject may not work without modifications.

Setup:
1. Download the attached library and copy to the additional libraries folder. ExoPlayer is an internal library, starting with B4A v13.4.
2. Download the additional dependencies and copy to the additional libraries folder: https://www.b4x.com/android/files/exoplayer3_additional.zip

Usage instructions:
1. Add a SimpleExoPlayerView with the designer.
2. Declare and initialize a SimpleExoPlayer object.
3. Set the player:
Code: Copy
SimpleExoPlayerView1.Player = Player
4. Create one or more sources with the various "create" methods and call Player.Prepare to load them.

Example is attached.

1703503333084.png


Note that you can use SMM to manage and load videos: [B4X] SimpleMediaManager (SMM) - framework for images, videos and more


Updates:
v3.11 - Added missing dependency (androidx.core:core-ktx)
v3.10 - Updated dependencies. Requires B4A v13.4+ with an updated SDK. This is an internal library now.
v3.02 - Updated dependencies.
v3.01 - Fixes a compatibility issue with Firebase libraries. The dependencies package was updated as well (step #2 above).
 

Attachments

Last edited:
@Erel Sorry to insist but I was finally able to install it on my Samsung phone running Android 15 and it crash when I press the configuration button and after when I press anywhere. I join a little video to show it. I am almost sure I have followed the installation instructions correctly but maybe it's on my side. Disabling the button could be an acceptable solution since I intent to use it as a GUI for a medical device and the size and model of the tablet is fixed (not a store app).
 

Attachments

I ran the sample. It compiles and loads onto the device but when line 21 in B4xMainPage is executed the app crashes with error:
Error occurred on line: 21 (B4XMainPage)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)

if i stop execution in dubug mode on line 21 all is well.

B4A ver. 13.4

I followed the instructions in the first post to get it going.
Any ideas?
Thanks!


fixed it.
files in this post are older.

found the correct ones here: https://www.b4x.com/android/forum/threads/exoplayer-mediaplayer-videoview-alternative.72652/#content
for anyone else using older duplicate files. If you're passionate about editing and looking for an excellent video editing app, give this one a try
Capcut mod apk
Thanks for the update, and glad you figured it out! That kind of crash usually points to a mismatch in library versions or outdated files, so it makes sense. Always good to double-check you're using the latest files from the original post or repo.
 
I don't think so. Post a link to the API that you are trying to call. Might be possible with JavaObject.
Hi Erel, thanks for the quick reply!


Here’s the API I was referring to:
https://developer.android.com/reference/androidx/media3/common/audio/AudioProcessor


I’d like to use a custom AudioProcessor to modify PCM data in real time (for example to apply a channel filter or vocal remover).
Is there a way to inject or attach a custom AudioProcessor to the ExoPlayer instance through JavaObject?
 
Hi Erel,

Just a quick heads-up: Google Play's 16KB memory page size requirement flags the legacy RTMP library bundled with current Media3 packages.

The native binaries need to be updated to use the librtmp-client-for-android.aar fork to pass validation. I posted the details and the file swap steps here (Addo Media3): See this
 
"Ah, got it! It's not in the main exoplayer3_additional.zip bundle because RTMP support isn't built into core ExoPlayer/Media3 by default—developers have to add the media3-datasource-rtmp module separately.
However, because the official underlying Ant Media client (rtmp-client) bundled with Media3's RTMP package is outdated and fails Google Play's 16KB memory page size check, it triggers a warning/error on the Play Console.
Replacing that internal binary with the drop-in fork librtmp-client-for-android.aar (v3.2.0.m2) fixes the 16KB compliance issue completely while keeping the exact same functions. Just wanted to share the heads-up in case you want to roll it into an updated optional RTMP add-on for the community!"
 
Back
Top