B4A Library Vitamio 5 (Version 5.2.3)

VITAMIO 5

a B4A-wrapper of Vitamio5 (version 5.2.3 of January 7, 2018)

This is an update of Vitamio and wraps version 5.2.3 of Vitamio. The original java-sources can be downloaded here.

All donators will receive an e-mail with download instructions.

New:
-The text-relocations problem with ffmpeg has now been resolved. You can now target the most recent versions of Android with the included platforms. I tried SDK 26 and it works fine on x86 and Arm.
-Support for arm64-v8a was also added in addition to armeabi-v7a and x86.
-Fixed a bug in the original Vitamio java-sources where the MediaController would not show correctly on SDK 24.

Unfortunately, previous versions 5.0.0, 5.0.2 and the latest version (5.2.3) of Vitamio seem to have been developed and compiled by Vitamio in a very hasty way without double-checking if things are working or not. I wrote a sample app in Android Studio and encountered two problems:

1) subtitles do not seem to work.
2) if you have a stream containing multiple audio-tracks, then changing from one format/language to another (for instance from English to French), the audio will be muted after the change.

Said problems have not yet been fixed by the Vitamio team despite developers reporting said issues. I have therefore removed the related properties, events and methods from the B4A-wrapper. If they fix them in the future with a new release, I will of course add them back to the wrapper.

However, what regards subtitle-support, I implemented another solution and I have added it to the wrapper so you can show subtitles. You can also check which character encoding to apply to the subtitles. Various subtitle-formats are supported but I have only verified the srt-format. In the demo-project, I have included some sample code to show you how to use subtitles.

Apart from what mentioned above, all the rest should work just fine.

Previous new stuff:
- a new layout named "VIDEO_LAYOUT_FIT_PARENT" was added.
- a new method to set Hardware Acceleration was added.
- a new method which permits amplifying audio.
- the method for adding headers is now called SetVideoPathWithHeaders
- a new method which lets you set Audio and Video Options (SetAVOptions)
- the methods CanPause, CanSeekBackward and CanSeekForward were removed by Vitamio in this version for unknown reasons. Probably due to a previous reported bug.
- the platforms now supported are: armeabi-v7a and x86
- added my own implementation for subtitles
- added/exposed a method to take a screenshot of the video

So if you do not use audio-tracks, Vitamio5 (version 5.2.3) should be fine.

Some other notes:
- To use Vitamio5, you need to use the #AdditionalRes attribute in your project. Please see the sample project for usage (basically you replace the path I am using in my sample project with the path to your folder where you saved the supplied res-folders on your PC).
- You need at least B4A v3.20 or later to compile your app
- I am only providing a B4A-wrapper to let you use Vitamio. Check the Vitamio site for any licensing issues.

Here is a summary of events, properties and methods available in this Vitamio5 wrapper.

vitamio5
Author:
Martin Pearman / Mikael Osterhed
Version: 5.23

  • Methods:
    • deSync
      Stop syncing the subtitle object with the VideoView
    • sync (textObject As TimedTextObject)
      Start syncing a subtitle object with the VideoView
      textObject: The subtitle to load
    Properties:
    • Delay As Int
      Get how often in milliseconds to refresh the subtitles
    • SubView As TextView
      Get the TextView to display subtitles on.
    • View As VideoView [read only]
      Get the VideoView to sync the subtitles with

  • Methods:
    • cancel As Boolean
    • run
    • scheduledExecutionTime As Long

  • Methods:
    • runOnUiThread (r As Runnable)
  • Vitamio_MediaController
    Events:
    • Hidden
    • Shown
    Fields:
    • ba As BA
    Methods:
    • BringToFront
    • Hide
    • Initialize (EventName As String)
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • IsShowing As Boolean
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetAnchorView (View1 As View)
      Set the View that acts as the anchor for the controller view.
      This can for example be a VideoView, or your Activity's main view.
    • SetAnimationStyle (AnimationStyle As Int)
      Set the animation style resource for this controller.
      If the controller is showing, calling this method will take effect only the next time the controller is shown.
      Set to -1 for the default animation, 0 for no animation, or a resource identifier for an explicit animation.
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetFileName (FileName As String)
      Set the content of the TextView that displays the filename of the playing video.
    • SetInfoView (OutlineTextView1 As OutlineTextView)
      Set the View to hold some information when interact with the MediaController.
      This method is currently of little use, the Vitamio OutlineTextView needs to be wrapped into this library in order to use this method.
      Wrapping OutlineTextView into this library is planned as a future update.
    • SetInstantSeeking (SeekWhenDragging As Boolean)
      Control the action when the seekbar is dragged by user.
      If True the media will seek periodically when the seekbar is dragged.
      Default value is True.
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • Show
      Show the controller on screen.
      It will go away automatically after a default 3000 milliseconds of inactivity.
    • Show2 (Timeout As Int)
      Show the controller on screen.
      It will go away automatically after 'Timeout' milliseconds of inactivity.
      Use 0 to show the controller until hide() is called.
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Parent As Object [read only]
    • Tag As Object
    • Visible As Boolean
  • Vitamio_OutlineTextView
    Fields:
    • ba As BA
    Methods:
    • BringToFront
    • Initialize
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetShadowLayer (Radius As Float, DX As Float, DY As Float, Color As Int)
    • SetText (Text As String)
    • SetTextColor (Color As Int)
    • SetTextSize (Size As Float)
    • SetTypeface (Typeface1 As Typeface)
    • SetTypeface2 (Typeface1 As Typeface, Style As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • Parent As Object [read only]
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int
  • Vitamio_Subtitles
    Methods:
    • Initialize (view As VideoView, subView As TextView)
    • IsInitialized As Boolean
    • deSyncSubtitles
      Stop syncing the subtitle object with the VideoView
    • guessEncodingFromFile (subtitlePath As String) As String
      Get/Guess character-encoding format from subitle file.
      example:
      guessEncodingFromFile(File.Combine(File.DirRootExternal, "subfile.srt"))
    • setSubtitleFile (SubtitlePath As String, encoding As String)
      Set the subtitle-file to use. Supported formats are:
      .srt, .ass, .ssa, .stl, .xml (only .srt format has been tested)
      example:
      setSubtitleFile(File.Combine(File.DirRootExternal,"subfile.srt"),"Windows-1252")
      Tip: use the included method guessEncodingFromFile() to get the encoding.
    • syncSubtitles
      Start syncing a subtitle object with the VideoView
      param textObject: The subtitle to load
    Properties:
    • SubView As TextView [read only]
    • SubtitleDelay As Int
      Get how often in milliseconds to refresh the subtitles
  • Vitamio_VideoView
    Events:
    • Buffering (Percent As Int)
    • Complete
    • Error (MEDIA_ERROR As Int))
    • Info (What As Int, Extra As Int))
    • Prepared
    • SeekComplete
    Fields:
    • MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK As Int
    • MEDIA_ERROR_UNKNOWN As Int
    • VIDEO_LAYOUT_FIT_PARENT As Int
    • VIDEO_LAYOUT_ORIGIN As Int
    • VIDEO_LAYOUT_SCALE As Int
    • VIDEO_LAYOUT_STRETCH As Int
    • VIDEO_LAYOUT_ZOOM As Int
    • VIDEO_QUALITY_HIGH As Int
    • VIDEO_QUALITY_LOW As Int
    • VIDEO_QUALITY_MEDIUM As Int
    • ba As BA
    Methods:
    • BringToFront
    • CheckVitamioLibs As Boolean
      Returns whether the core Vitamio library files have been installed.
      If these files have not been installed, this method returns False and launches the Vitamio installer Activity.
      Your Activity's Finish method will be called and your Activity restarted once the files are installed.
      The installer will typically only run when your installed application is first run.
      //pBA:
    • GetBufferPercentage As Int
      Returns currently used buffer percentage.
    • GetCurrentPosition As Long
      Returns the current playback position in units of milliseconds.
    • GetDuration As Long
      Returns the video duration in milliseconds.
    • GetVideoAspectRatio As Float
      Returns the aspect ratio of the video. Result: the aspect ratio of the video, or 0 if there is no video, or the width and height if not available.
    • GetVideoHeight As Int
      Returns the height of the video.
    • GetVideoLayout As Int
      Returns current VideoLayout.
      Layout parameters: VIDEO_LAYOUT_ORIGIN or 0, VIDEO_LAYOUT_SCALE or 1, VIDEO_LAYOUT_STRETCH or 2, VIDEO_LAYOUT_ZOOM or 3, VIDEO_LAYOUT_FIT_PARENT or 4.
    • GetVideoWidth As Int
      Returns the width of the video.
    • Initialize (EventName As String)
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsBuffering As Boolean
      Checks whether the buffer is filled or not.
      Returns False if buffer is filled
    • IsInitialized As Boolean
    • IsPlaying As Boolean
      Tests whether the video is currently playing.
    • IsValid As Boolean
    • Pause
      Pauses the playback.
    • RemoveView
    • RequestFocus As Boolean
    • Resume
      Resumes the playback.
    • SeekTo (Milliseconds As Long)
      Seeks to specified time position.
      Parameters: Milliseconds - the offset in milliseconds from the start to seek to.
    • SendToBack
    • SetAVOptions (avOptions As Map)
      Sets Audio and Video (AV) options. Create a Map in B4A and pass on the Map within this method.
      You need to pass on AV options before starting the stream.
      The following Map key/values will always be included in the AV Options:
      ("rtsp_transport", "tcp")
      ("analyzeduration", "1000000")
      You will probably find other AV Options you can add by googling for FFMpeg and AV Options
      although if they will work or not is hard to say without trying them.
    • SetAdaptiveStream (Adaptive As Boolean)
      Adaptive streaming support, default is false
      set param adaptive to true if you want to enable adaptive stream
    • SetBackgroundImage (arg0 As Bitmap)
    • SetBufferSize (BufferSize As Int)
      Set the buffer size to fill before playback starts.
      Default is 1024KB.
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetLayout (Top As Int, Left As Int, Width As Int, Height As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetMediaController (MediaController1 As MediaController)
    • SetPlaybackSpeed (Speed As Float)
      Set video and audio playback speed
      Speed e.g. 0.8 or 2.0, default to 1.0, range in [0.5-2]
    • SetVideoChroma (Chroma As Int)
      Set the Video Chroma quality when playing video, default is VIDEOCHROMA_RGB565.
      Must be set before calling SetVideoPath/SetVideoUri.
    • SetVideoLayout (VIDEO_LAYOUT As Int, AspectRatio As Float)
      Set the display options.
      Default is VIDEO_LAYOUT_SCALE or 1.
      Layout parameters: VIDEO_LAYOUT_ORIGIN or 0, VIDEO_LAYOUT_SCALE or 1, VIDEO_LAYOUT_STRETCH or 2,
      VIDEO_LAYOUT_ZOOM or 3, VIDEO_LAYOUT_FIT_PARENT or 4.
      AspectRatio - video aspect ratio, will auto detect if 0.
    • SetVideoPath (VideoPath As String)
      Set the URI of the video to play.
      Pass either a URL or a file system path, an example: SetVideoPath(File.Combine(File.DirRootExternal, "test_video.mp4"))
    • SetVideoPathWithHeaders (VideoPath As String, Headers As Map)
      Sets the URL of the video together with headers associated
      with the http request for the stream you want to play
    • SetVideoQuality (VIDEO_QUALITY As Int)
      Set the quality when playing video.
      If there is too much lag, try VIDEOQUALITY_LOW.
      If there is too much pixeling, set the value to VIDEOQUALITY_HIGH.
      Suggestion: use VIDEOQUALITY_HIGH or VIDEOQUALITY_MEDIUM (most modern android-devices can cope with higher settings).
      Default value is VIDEOQUALITY_LOW.
      Quality-Parameters: VIDEOQUALITY_HIGH or 16, VIDEOQUALITY_MEDIUM or 0, VIDEOQUALITY_LOW or -16
    • SetVideoUri (Uri1 As Uri)
      This method may be of limited use as the Uri object is not yet supported in B4A.
      The method is included though for future compatibility.
      You can use B4A's ContentResolver library if you want to pass on an URI object.
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • SetVolume (LeftVolume As Float, RightVolume As Float)
      Sets the volume.
      Unknown ranges to use (perhaps 1 to 15).
      Might be better to use Phone-library in B4A.
    • Start
      Starts or resumes playing.
    • StopPlayback
      Stops the playback.
    • Suspend
    Permissions:
    • android.permission.ACCESS_NETWORK_STATE
    • android.permission.INTERNET
    • android.permission.WAKE_LOCK
    Properties:
    • AudioAmplify As Float [write only]
      Amplify audio
      param ratio e.g. 3.5
    • Background As Drawable
    • Color As Int [write only]
    • CurrentFrame As Bitmap [read only]
      Returns current videoframe which can be used for screenshot.
    • Enabled As Boolean
    • HardwareDecoder As Boolean [write only]
      Set whether to use Hardware acceleration or not.
      Default is false.
    • Height As Int
    • Left As Int
    • Parent As Object [read only]
    • Position As Long
      Gets or sets the playing position (in milliseconds).
      Not an official Vitamio API method, used for compatibility with B4A's VideoView.
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int
Final notes:
I made available some years ago the very first wrapper of Vitamio here in the forum. Later @warwound wrapped subsequent versions of Vitamio.
I am now making Vitamio5 available here in the forum but this time as Donation ware. I have spoken with @warwound and he is fine with it.

I feel that a lot of efforts have been put into wrapping and testing Vitamio5 and that a small donation, to obtain it, is justified. The price is EUR 10,00 but of course you can donate more if you wish. You can donate using PayPal by clicking on my PayPal.Me link here:

https://PayPal.Me/moster67/EUR10

or you can use the Donation link in my signature.

After donating, please send me a PM (do not post here in this thread) and let me know your e-mail address that you used when donating with PayPal, the amount donated and the purpose (for instance Vitamio5). I prefer receiving a PM with this information so I can take note of your B4A licensed username. If you send this information by e-mail, please then include your B4A licensed username. Having your licensed B4A licensed username is important/required so I know if you are a donator or not if you ask for support here in this thread. I am sorry to say that if I receive a donation for less than EUR 10,00 and the purpose was for the Vitamio5 wrapper, I will not accept the donation. This may sound pompous but this is just to assure that the minimum price requested is received.

After receiving your donation and your PM, I will send you by e-mail (to the e-mail address you sent me in PM) a link from where you can download the wrapper along with a demo-app and instructions. The e-mail will have "Vitamio5 wrapper" as subject. If you do not receive an e-mail from me within a reasonable time (20-24 hours), please first check your spam-folder in your e-mail program. If you cannot find my e-mail, please then contact me by PM.

By donating, you are also motivating me to wrap future versions of Vitamio when they are made available. If and when they are released, I will wrap them to the best of my efforts and send all donators updated versions for free.
 
Last edited:

Almora

Active Member
Licensed User
Longtime User
hi..
my app on google Play I installed it as aab the videos didn't open. I uploaded the videos again as apk opened. vitamio doesn't support aab?
sdk=29
 

moster67

Expert
Licensed User
Longtime User
hi..
my app on google Play I installed it as aab the videos didn't open. I uploaded the videos again as apk opened. vitamio doesn't support aab?
sdk=29
I presume with abb you mean App Bundle?
Unfortunately, I am not able to test uploading an app using App Bundle but it seems strange there would be problems.
Make sure to use the provided ARM-library (i.e. the library without x86 binaries which are not 64bit compatible) as already mentioned in the email you received from me.
 

Almora

Active Member
Licensed User
Longtime User
I presume with abb you mean App Bundle?
Unfortunately, I am not able to test uploading an app using App Bundle but it seems strange there would be problems.
Make sure to use the provided ARM-library (i.e. the library without x86 binaries which are not 64bit compatible) as already mentioned in the email you received from me.


The library I'm using is new. v5.23

I tested it on sdk30 and it doesn't work. the page is closing.
converting the app to App Bundle(.aab) does not work.
It works in apk.

In the application I converted to App Bundle(.aab), videos are working in the videoview library. but videos working with vitamio library do not open.
 

Attachments

  • SharedScreenshot.jpg
    SharedScreenshot.jpg
    7 KB · Views: 166

moster67

Expert
Licensed User
Longtime User
No idea, sorry.
I have never used App Bundle. When I find some time, I will have a look.
 

Almora

Active Member
Licensed User
Longtime User
No idea, sorry.
I have never used App Bundle. When I find some time, I will have a look.
thanks..

screenshots in the application error log. maybe it can help.
 

Attachments

  • Screenshot_1631986514.png
    Screenshot_1631986514.png
    69.9 KB · Views: 194
  • Screenshot_1631986605.png
    Screenshot_1631986605.png
    74.2 KB · Views: 176
  • Screenshot_1631986611.png
    Screenshot_1631986611.png
    63.3 KB · Views: 182

moster67

Expert
Licensed User
Longtime User
It works for me.
This was my test procedure:
1) Changed the included demo app to use SDK 30 as target version
2) set the library to be used: Vitamio5_23OnlyArm and cleaned the project
3) Built the project using "Build App Bundle under Project Menu in B4A IDE. Here is the output:
B4A Version: 11.00
Parsing code. (0.00s)
Java Version: 11
Building folders structure. (0.03s)
Compiling code. (0.01s)

ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Compiling resources (0.20s)
Linking resources (0.56s)
Compiling generated Java code. (1.37s)
Convert byte code - optimized dex. (0.66s)
Copying libraries resources (2.60s)
Building app bundle (2.52s)
Signing AAB file (5.90s)
Algorithm: -digestalg SHA1 -sigalg SHA256withRSA
Output file: C:\test1\Vitamio5_23_b4a_latest\Demo\Vitamio5_Sample\testvitamio5\Objects\testvitamio5.aab
Completed successfully.

To test the app on the phone (in my case Samsung Note 9 running Android 10):
1) I currently don't have any app on Google Play Store which I can update so I copied the "testvitamio5.aab" directly to my phone. Here is a useful link for testing abb-files by sideloading: https://beebom.com/how-install-android-app-bundles/
2) I used/installed a free app from the PlayStore called "App Bundle Installer" which is useful for testing.
3) Used above mentioned "App Bundle Installer" app and installed the Vitamio demo app on my phone and it worked just fine.

I made sure to use the latest B4A version (11.0 at the time of writing this post)
I installed the SDK and the tools as suggested from the download page of B4A.
I am using OpenJDK 11. Not tested with Oracle Java 8.

Maybe you need to use OpenJDK 11?

If you still have errors, then I have probably not understood your procedure/steps of getting the error. If so, please explain step by step your procedure.
 
Last edited:

Addo

Well-Known Member
Licensed User
It works for me.
This was my test procedure:
1) Changed the included demo app to use SDK 30 as target version
2) set the library to be used: Vitamio5_23OnlyArm and cleaned the project
3) Built the project using "Build App Bundle under Project Menu in B4A IDE. Here is the output:


To test the app on the phone (in my case Samsung Note 9 running Android 10):
1) I currently don't have any app on Google Play Store which I can update so I copied the "testvitamio5.aab" directly to my phone. Here is a useful link for testing abb-files by sideloading: https://beebom.com/how-install-android-app-bundles/
2) I used/installed a free app from the PlayStore called "App Bundle Installer" which is useful for testing.
3) Used above mentioned "App Bundle Installer" app and installed the Vitamio demo app on my phone and it worked just fine.

I made sure to use the latest B4A version (11.0 at the time of writing this post)
I installed the SDK and the tools as suggested from the download page of B4A.
I am using OpenJDK 11. Not tested with Oracle Java 8.

Maybe you need to use OpenJDK 11?

If you still have errors, then I have probably not understood your procedure/steps of getting the error. If so, please explain step by step your procedure.
Will change my jdk and test
 

Almora

Active Member
Licensed User
Longtime User
It works for me.
This was my test procedure:
1) Changed the included demo app to use SDK 30 as target version
2) set the library to be used: Vitamio5_23OnlyArm and cleaned the project
3) Built the project using "Build App Bundle under Project Menu in B4A IDE. Here is the output:


To test the app on the phone (in my case Samsung Note 9 running Android 10):
1) I currently don't have any app on Google Play Store which I can update so I copied the "testvitamio5.aab" directly to my phone. Here is a useful link for testing abb-files by sideloading: https://beebom.com/how-install-android-app-bundles/
2) I used/installed a free app from the PlayStore called "App Bundle Installer" which is useful for testing.
3) Used above mentioned "App Bundle Installer" app and installed the Vitamio demo app on my phone and it worked just fine.

I made sure to use the latest B4A version (11.0 at the time of writing this post)
I installed the SDK and the tools as suggested from the download page of B4A.
I am using OpenJDK 11. Not tested with Oracle Java 8.

Maybe you need to use OpenJDK 11?

If you still have errors, then I have probably not understood your procedure/steps of getting the error. If so, please explain step by step your procedure.
yes it works that way. I used the application at the link below to find out the cause of the problem. a conversion is being made and is working here. but it does not work when you install the application on google play and then download it from google play and install the application.

 
Last edited:

Addo

Well-Known Member
Licensed User
yes it works that way. I used the application at the link below to find out the cause of the problem. a conversion is being made and is working here. but it does not work when you install the application on google play and then download it from google play and install the application.

I couldn't test yet to upload in playstore at new version at the moment. but you can send your playstore apk so it can help to debug the issue
 

moster67

Expert
Licensed User
Longtime User
I had a better look. While the procedure I showed works, and which @Almora also confirmed to work, it does not work and will make the app crash when the app is downloaded from the Play Store.

I can confirm this since I made a demo app and uploaded it for internal testing using the Play Console and the app downloaded from the testing account did indeed crash on the phone. Just to be 100% sure, and exclude any problems with B4A and the wrapper, I also compiled the original demo project, written in Java, with Android Studio, uploaded the abb-file using the Play Console, and then tested it on my phone and also in this case, the same crash happens. I also tried setting "enableSplit = false" for "abi", which can be done in the app build.gradle file, in Android Studio and tested the generated App Bundle file but it crashed too.
So it is not related to B4A and my wrapper.

Since the APK-file works fine but the App Bundle does not, it means that the Abb Bundle, which is a publishing format, does some changes. This probably happens in the file structure since the error indicates that the library cannot be found.

I don't recall if the code for opening the library is available in the sources or not but if it is, maybe I can adapt it so the native libraries can be loaded. I have also made a post on SO to see if anyone can help and if there is a quick fix.

I will let you know later if this can be resolved or not.
 

moster67

Expert
Licensed User
Longtime User
OK, after further looking into this problem, the "problem" is that the APKs generated from the App Bundle leave native libraries uncompressed in the APK so they're not extracted at installation on the device, thus saving space on the device. Apparently, Vitamio is not using the Android standard way of loading native libraries, or else this exception probably would not happen. I had a look into the original Vitamio jars and I am unsure if I can change the behavior of loading the native libraries.

However, there is one easy fix, at least when using Android Studio. If I add the following line in the gradle.property file in Android Studio:
android.bundle.enableUncompressedNativeLibs = false
and then generate the App Bundle with AS, then the demo app I wrote when downloaded from the PlayStore will install and work properly on the device. This is of course defeating the purpose of Android Bundles, which is to save space, but since Vitamio is probably loading the native libraries not in a standard way, it is the only way to get it working.

As far as I am aware, B4A (and its IDE) is not using Gradle so that is a bummer (but also a lifesafer). I think B4A is using the BundleTool when generating App Bundles. It seems it should be possible to use the same option with BundleTool by setting the ApkOptimizations to use "setUncompressNativeLibraries(false). I found this snippet:
ApkOptimizations.builder()
.setSplitDimensions(ImmutableSet.of(ABI, SCREEN_DENSITY, LANGUAGE))
.setUncompressNativeLibraries(true) //should probably be "false"
.build());
The problem is that I don't know how to generate an App Bundle using the BundleTool and which parameters are needed.

There are MANY users of Vitamio and it still works very well and has some options required by users, such as rich codec support, RTMP, which are not found in other video libraries such as VideoView, ExoPlayer. It would be a pity if the life cycle of Vitamio came to an end.

I don't know if @Erel can help us?
 
Last edited:

moster67

Expert
Licensed User
Longtime User
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Try this:
Find bundleconfig.json in the installation folder and edit it (you need elevated permissions for this).

Something like:
B4X:
{
  "compression": {
    "uncompressedGlob": [
      "**/*.3g2",
      "**/*.3gp",
      "**/*.3gpp",
      "**/*.3gpp2",
      "**/*.aac",
      "**/*.amr",
      "**/*.awb",
      "**/*.gif",
      "**/*.imy",
      "**/*.jet",
      "**/*.jpeg",
      "**/*.jpg",
      "**/*.m4a",
      "**/*.m4v",
      "**/*.mid",
      "**/*.midi",
      "**/*.mkv",
      "**/*.mp2",
      "**/*.mp3",
      "**/*.mp4",
      "**/*.mpeg",
      "**/*.mpg",
      "**/*.ogg",
      "**/*.png",
      "**/*.rtttl",
      "**/*.smf",
      "**/*.wav",
      "**/*.webm",
      "**/*.wma",
      "**/*.wmv",
      "**/*.xmf"
    ]
  }
  ,"uncompressNativeLibraries": {
      "enabled": false
    }
}
 
Top