B4A Library VitamioBundle

This library wraps the latest version of the VitamioBundle - that's currently version 4.2.0.
You can find more info on the VitamioBundle here:
https://github.com/yixia/VitamioBundle.

I'm not a user of this library, i just developed it for various other forum members.
So i'll post a basic code example and leave anyone that's interested to experiment for themselves to see what the library is capable of.

B4X:
#Region  Project Attributes 
   #ApplicationLabel: VitamioBundle4 example
   #VersionCode: 1
   #VersionName: 
   'SupportedOrientations possible values: unspecified, landscape or portrait.
   #SupportedOrientations: unspecified
   #CanInstallToExternalStorage: False
   #AdditionalRes: C:\Users\foobar\Basic4Android\VitamioBundle-4-2-0\library_files\res, io.vov.vitamio
#End Region
#Region  Activity Attributes 
   #FullScreen: True
   #IncludeTitle: True
#End Region
'Activity module
Sub Process_Globals
End Sub
Sub Globals
   Dim VitamioMediaController1 As Vitamio_MediaController
   Dim VitamioVideoView1 As Vitamio_VideoView
End Sub
Sub Activity_Create(FirstTime As Boolean)
   '   take a look at the manifest editor to see the additional entry activity required in order to use VitamioBundle
  
   '   VitamioBundle version 4.2.0 uses the new #AdditionalRes project attribute
   
   '   check if the VitamioBundle core is installed
   '   if this is the first time that the installed application has been started then the core will NOT be installed
   '   otherwise the core should be already installed
  
   '   if the core is NOT installed then CheckVitamioLibs returns False and this Activity's Finish method is called by the library
   '   the core is then installed and this Activity will be restarted
   '   CheckVitamioLibs will now return True and you can proceed to use the library
  
   If VitamioVideoView1.CheckVitamioLibs Then
  
     VitamioVideoView1.Initialize("VitamioVideoView1")
     Activity.AddView(VitamioVideoView1, 0, 0, 100%x, 100%y)
    
     VitamioMediaController1.Initialize("VitamioMediaController1")
    
     VitamioVideoView1.SetMediaController(VitamioMediaController1)
     VitamioVideoView1.SetVideoQuality(VitamioVideoView1.VIDEO_QUALITY_HIGH)
    
     VitamioVideoView1.SetVideoPath("http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8")
     '   VitamioVideoView1.SetVideoPath(File.Combine(File.DirRootExternal, "test_video.mp4"))
    
   End If
  
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
'   events raised by Vitamio_MediaController
Sub VitamioMediaController1_Hidden
   Log("VitamioMediaController1_Hidden")
End Sub
Sub VitamioMediaController1_Shown
   Log("VitamioMediaController1_Shown")
End Sub
'   events raised by Vitamio_VideoView
Sub VitamioVideoView1_BitmapSubtitleUpdated(Bitmap1() As Byte, Width As Int, Height As Int)
  
End Sub
Sub VitamioVideoView1_Buffering(Percent As Int)
   '   Log("VitamioVideoView1_Buffering: "&Percent)   '   commented out to avoid excess logging
End Sub
Sub VitamioVideoView1_Complete
   Log("VitamioVideoView1_Complete")
End Sub
Sub VitamioVideoView1_Error(MEDIA_ERROR As Int) As Boolean
   '   this event Sub must return a Boolean value to indicate whether it has handled the error or not
   '   returning True will prevent the library from taking any action such as displaying an error message
   Log("VitamioVideoView1_Error")
  
   Return True
End Sub
Sub VitamioVideoView1_Info(What As Int, Extra As Int) As Boolean
   '   what does this event mean?
   '   what do the Int parameters represent?
  
   '   Log("VitamioVideoView1_Info")   '   commented out to avoid excess logging
   Return False    '   indicates that this Sub has NOT handled the event and that the library should handle it
End Sub
Sub VitamioVideoView1_Prepared
   Log("VitamioVideoView1_Prepared")
End Sub
Sub VitamioVideoView1_SeekComplete
  
End Sub
Sub VitamioVideoView1_TextSubtitleUpdated(SubText As String)
  
End Sub

Previous versions of the VitamioBundle have already been posted (by myself) on this thread:
http://www.b4x.com/android/forum/threads/video-view-fullscreen-and-on-top-on-ouya.31034/
The old links in that thread will no longer work - i've recently changed webhosts.

But the thread is full of useful info for anyone that's trying to use the VitamioBundle.
You'll read that the VitamioBundle is far from perfect and that it has a rather obscure licensing model that you as the developer will have to handle.

The library is a 8.7MB download - far too big to attach to this post.
So the library is currently available from my webspace at:
http://b4a.martinpearman.co.uk/vitamiobundle/
You'll also find the b4a demo project at the same link.
(VitamioBundle-4-2-0-library-files.zip and VitamioBundle-4-2-0-demo.zip are the latest versions).

Martin.
 
Last edited:

warwound

Expert
Licensed User
Longtime User
VitamioBundle updated to version 4.111
(Previous version was 4.11).

This update adds a new method to the Vitamio_VideoView:

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]


Updated library files available from:
http://b4a.martinpearman.co.uk/vitamiobundle/

Note that the library files are now named VitamioBundle-4-1-1.jar and VitamioBundle-4-1-1.xml, previously they were named VitamioBundle-4.1.1.jar and VitamioBundle-4.1.1.xml.
This fixes a problem with generation of the library documentation.
If upgrading to this new version be sure to delete the old files VitamioBundle-4.1.1.jar and VitamioBundle-4.1.1.xml.


Martin.
 

warwound

Expert
Licensed User
Longtime User
@androh I'll look at updating the library to version 4.2.0 but will be busy for a few days.
It'll probably be the weekend before i have time to look at it.

Martin.
 

warwound

Expert
Licensed User
Longtime User
VitamioBundle updated to version 4.2.0

@androh
I've updated the library to now wrap version 4.2.0 of the VitamioBundle and would like you to test it before i 'properly' upload it to this thread as a new version.

There's a couple of changes to note:
  • There is now just a single libarm.so library file, looks like we no longer have the option to choose either libarm_full.so or libarm_online.so.
    The VitamioBundle changelog makes no mention.
  • I've made use of the new B4A #AdditionalRes project attribute to define where the VitamioBundle android resources folder res is found.
    You no longer have to copy the VitamioBundle android resources to the Objects folder of any project that uses the VitamioBundle.
    This requires B4A version 3.20+.
    Any existing project that already contains the (old version) android resources will need those resources manually deleted from the project's Objects/res folder.
    Not deleting those android resources will not cause a problem BUT your compiled APK will be bloated with many MBs of unused resources.

Version 4.2.0 library files and demo project can be downloaded from: http://b4a.martinpearman.co.uk/vitamiobundle/.
VitamioBundle-4-2-0-library-files.zip and VitamioBundle-4-2-0-demo.zip are the files you want to download.

Let me have some feedback on this update and if it works ok i'll upload it as an 'official' update.

Martin.
 
Last edited:

charmander

New Member
Licensed User
Longtime User
can you addvitamiobundle's VideoView.setVideoHeaders function to your library? i want to send cookies for video streams.

because my online streams can only be watched if required cookies set. otherwise 403 code returns.
 

warwound

Expert
Licensed User
Longtime User
can you addvitamiobundle's VideoView.setVideoHeaders function to your library? i want to send cookies for video streams.

because my online streams can only be watched if required cookies set. otherwise 403 code returns.

Can you try this update and post again to let me know if it works?
I've wrapped the new VideoView method:

SetVideoHeaders(Headers As Map)

So you pass a Map containing string keys and values as the Headers parameter.

Martin.
 

jazzzzzzz

Active Member
Licensed User
Longtime User
Can you try this update and post again to let me know if it works?
I've wrapped the new VideoView method:

SetVideoHeaders(Headers As Map)

So you pass a Map containing string keys and values as the Headers parameter.

Martin.

i cant play any rtsp videos using your wrapper...but i can with this old library.

http://www.b4x.com/android/forum/th...gin-advanced-videoview-library.19329/#content

could u check that please...For checking it you can use vlc to make video streaming...or can use any tv channel links available in internet
 

warwound

Expert
Licensed User
Longtime User
i cant play any rtsp videos using your wrapper...but i can with this old library.

http://www.b4x.com/android/forum/th...gin-advanced-videoview-library.19329/#content

could u check that please...For checking it you can use vlc to make video streaming...or can use any tv channel links available in internet

Can you provide a bit more detail:
  • What happens when you use VitamioBundle to play an RTSP stream?
    Does your application crash?
    If so look here: https://github.com/yixia/VitamioBundle/issues/53
    Does this seem to be the problem?
  • Your post quoted a post of mine where i've added methods to set request headers so that VitamioBundle can access protected content - content that requires some form of authentication.
    Are you trying to play streams that have access restricted?
 

jazzzzzzz

Active Member
Licensed User
Longtime User
access is not restricted...app is force closing saying unfortunately vitamiobundle4 example has stopped

rtsp://cdn.m.yupptv.tv/liveorigin/people9001

this is the link am using with other vitamio library and video works good...
 

warwound

Expert
Licensed User
Longtime User

jazzzzzzz

Active Member
Licensed User
Longtime User
Can u update this to vitamio sdk 4.2.2?
may be some issues will be solved i dont know....if you r free you can try...it will be so helpfull to me because i have to play multiple videos in same window but vitamio does not support that,so i will play video using videoview but the audio codec of my foscam ipcamera is some damn raw audio so the whole video will not work ,so i will rencode the stream and removed the audio and it will work in native videoview,then i can gave 4 audio chanels in your wrapper along with native video view......

but with old library i mentioned we cant use nnative videoview .
once we added vitamio one video will work but multiple will not...but i hope multiple audio chanels will be supported...
 

warwound

Expert
Licensed User
Longtime User
@jazzzzzzz

I've downloaded the source code for version 4.2.2 and will look at it when i have time - that's likely to be the weekend.

Martin.
 

jazzzzzzz

Active Member
Licensed User
Longtime User
@jazzzzzzz

I've downloaded the source code for version 4.2.2 and will look at it when i have time - that's likely to be the weekend.

Martin.
Did you know about any library with support for multiple video (RTSP) with option to control buffer size so as to make it live...????

some sort of ffmpeg based players?

unfortunately vitamio does not support multiple video in same screen even with 4.2.2 i think
 

andrewj

Active Member
Licensed User
Longtime User
Hi Martin,
I think there may be a bug in the Controller SetFileName method. I have the following code to load my video:
B4X:
oVideo.SetVideoPath(File.Combine(VideoPath, VideoFileName))
Log(VideoFileNameDecrypted)
oVideoController.SetFileName(VideoFileNameDecrypted)

The videoview loads and plays the right file, and the Log shows the right decrypted filename, but the controller doesn't.

I'm using the latest libraries you put on your website last week.
Thanks
Andrew
 

andrewj

Active Member
Licensed User
Longtime User
Hi Martin,
Is there any way to adjust the position of the video window within the control when I'm using a layout such as SCALE which does not fill the screen? It would be much better if I could centre the window in this case.
Thanks
Andrew
 
Top