B4A Library [B4X][XUI] xImageSliderIG - Instagram style image and video slider

Biswajit

Active Member
Licensed User
Longtime User

MarcoRome

Expert
Licensed User
Longtime User
Hi @Biswajit
if you try with same movie example this:
sc.items.Add(CreateMap("data":"Item 1-"&j, "video":"https://www.xxxxx.com/caricafile/bosa/bosa.mp4", "type":"uri"))
The App crash with this error: "
ximagesliderig_vplayer_ready (java line: 1675)
java.lang.ClassCastException: anywheresoftware.b4a.BALayout cannot be cast to android.widget.ProgressBar"

Any idea ??
Thank you and have a nice Merry Christmas
Marco
 
Last edited:

Biswajit

Active Member
Licensed User
Longtime User
Working fine here. Did you change any library code?
 

Biswajit

Active Member
Licensed User
Longtime User

lucasheer

Active Member
Licensed User
Longtime User
Hello!

For some reason, the videos are super crisp, but the images are getting blurred after being displayed. I'm thinking this is from resize?

Any suggestions on going about fixing this?

Thank you!
 

lucasheer

Active Member
Licensed User
Longtime User
I fixed the blurry issue on iOS for my case.

Changed
B4X:
iv.Bitmap = img.Resize(ImgCont.Width,ImgCont.Height,True)

to
B4X:
iv.Bitmap = img

Was going to convert ImageView to B4XImageView, but this worked for me. I compress/crop images to be relatively close to the view size on the backend.

thank you!
 

Biswajit

Active Member
Licensed User
Longtime User

MarcoRome

Expert
Licensed User
Longtime User
Hi @Biswajit
I noticed a problem that maybe you can give me the solution.
If the library is used on a second activity, the first time the activity is opened everything works fine, but when you switch to another activity and try to reopen the activity with the videos, they are not more loaded and give the following error.


The project test is here:
 

Biswajit

Active Member
Licensed User
Longtime User
If you check the log you will see this is happening due to limited numbers of hardware accelerated video decoders. Some devices have a limited number of hardware accelerated video decoders available. In my device its 12. If I create more than 12 exoplayers then its throwing the decoder initialization failed issue. The video players needs to be recycled when its off-screen. But for that a lots of changes needs to be done and I am busy until next week. After that I will try to fix it.

For now use the attached library and change the Activity_pause event to,
B4X:
Sub Activity_Pause (UserClosed As Boolean)
    For Each sc As SliderContainer In sliders
        sc.slider.PauseCurrentVideo
        If UserClosed Then sc.slider.ReleaseVideoPlayers ''<- add this line
    Next
End Sub

Also when you are using too many video players its better to add the following code to your manifest to avoid OOM issue.
B4X:
SetApplicationAttribute(android:largeHeap, "true")
 

Attachments

  • xImageSliderIG.b4xlib
    9 KB · Views: 243

MarcoRome

Expert
Licensed User
Longtime User
This i had already added

Yes, that's exactly the problem.
With the method you added, the problem was solved


Thanks i sent you a donation for your valuable support !!
 

MarcoRome

Expert
Licensed User
Longtime User
It would be very useful, in the new version to also add the Complete event (when the movie ends)
Thank you again
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…