B4A Library Vitamio 5 (Version 5.2.3)

moster67

Expert
Licensed User
July 29, 2016:

- added/exposed a method to take a screenshot of the video
  • CurrentFrame As Bitmap [read only]
    Returns current videoframe which can be used for screenshot.
Vitamio 5 donators will receive download link by e-mail shortly.
 
Last edited:

susu

Well-Known Member
Licensed User
Hi @moster67 , can I make Vitamio video view scale down in potrait screen then turn it to full size in landscape screen without reload video. Just like Youtube, play video in small size then click to full screen without reload video. Thank you.
 

moster67

Expert
Licensed User
Hi @moster67 , can I make Vitamio video view scale down in potrait screen then turn it to full size in landscape screen without reload video. Just like Youtube, play video in small size then click to full screen without reload video. Thank you.
Never tried it although adding the following piece of code in the manifest should permit change of screen-orientation without the video being reloaded:

B4X:
android:configChanges="orientation|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"
I will try and let you know.
 

scsjc

Well-Known Member
Licensed User
Hello Mike,
can have a event streaming "on loading, on connect, disconected" for show status ???
 

moster67

Expert
Licensed User
Hello Mike,
can have a event streaming "on loading, on connect, disconected" for show status ???
You already have many events which should help you to do what you want:
  • Buffering (Percent As Int)
  • Complete
  • Error (MEDIA_ERROR As Int))
  • Info (What As Int, Extra As Int))
  • Prepared
 

scsjc

Well-Known Member
Licensed User
You already have many events which should help you to what you want:
  • Buffering (Percent As Int)
  • Complete
  • Error (MEDIA_ERROR As Int))
  • Info (What As Int, Extra As Int))
  • Prepared
Yes, but i don't know why, when reset router on home (to force disconect radio)... the events don't works....
 

moster67

Expert
Licensed User
Well, the error (and maybe the info and in some cases also the complete) event should trigger if Vitamio is not receiving any more data. If you want, you can send me a sample-project by e-mail and I can test.
 

moster67

Expert
Licensed User
Hi @moster67 , can I make Vitamio video view scale down in potrait screen then turn it to full size in landscape screen without reload video. Just like Youtube, play video in small size then click to full screen without reload video. Thank you.
I will try and let you know.
@susu,
just checked and if you include the attribute key I wrote in my previous post, you will get partially the desired behaviour i.e. when a change of screen-orientation takes place, the video will not be reloaded but continue smoothly, bypassing onCreate, without any interruption.

However, the problem is to get the videoview to resize again and fill up the screen. By handling the configuration change by ourselves, B4A hasn't updated it's Activity width and height properties and this is the difficult part i.e. to reset the activity width and height. You can see this thread for further information. But this is not only a problem with B4A and Vitamio as you can see from this thread where users have similar issues with Android and the standard VideoView.

Now, some apps are working correctly so I guess there must be a trick. Subclassing Vitamio could be a solution to override some methods in the Vitamio videoview class but I am not sure if that will work properly. Even testing Vitamio in Android Studio is giving me the same problem. I will continue to test and see if I can come up with a solution and if necessary ask gurus such as Erel here in the forum and/or on StackOverflow. As I said, this problem is not specific only for Vitamio but also for the normal VideoView included in the Audio-library (and Android).

Another solution, hopefully a temporary one until I find a possible solution, would be to take note of the position and then use the SeekTo-method and restart the video from the saved position. To do this, you will need to remove the attribute key I mentioned earlier. However, you would notice a slight delay/interruption.

Anyway, this problem is not very common since most apps "lock" the playing of videos into landscape and you are not bypassing the onCreate method when changing orientation. If the problem was common, you would see loads of requests to fix this, even here in the B4A-forum.

Edit/Update: this problem was resolved.
 
Last edited:

susu

Well-Known Member
Licensed User
Thank you @moster67 for your time and effort. I will send you my donation in next 24 hours.
 

moster67

Expert
Licensed User
@susu
I will continue to test and see if I can come up with a solution
I managed to get it working in Android Studio and after lots of testing also in B4A. :)
It is not related to the vitamio-library itself but the solution is to add some complementary code in B4A. I will include a sample-project in Vitamio so you can see how it is done.
 

susu

Well-Known Member
Licensed User
Very nice! Please check your PM.
 

moster67

Expert
Licensed User
I have sent to all donators an e-mail with download instructions for the updated version (5.10) of the B4A wrapper of Vitamio 5.02 which I released today.
I added also a sample-project of Vitamio optimized for rotation and configuration-change.
 

moster67

Expert
Licensed User
Is possible runing the vitamio on background service ?
Currently I doubt it - Vitamio5 is wrapped as an ActivityObject. When I look at the code next time, I will try to remove it and see if it works.
However, my other project, vlcb4a should work fine as a service.
 

susu

Well-Known Member
Licensed User
Hi Mike,

Is there any way to check if the device supports HardwareDecoder or not? I set HardwareDecoder = True, it worked on new devices but on some old devices my app will crash.
 

moster67

Expert
Licensed User
There is no method built in Vitamio5 which lets you check if hardware acceleration is supported or not. Maybe I can implement one.
You can try to set a Try/Catch statement on the method SetVideoPath

Can you please post the StackTrace and/or unfiltered logs?
 
Last edited:
Top