Android Question (Solved) SMM problem: No Video Display when Activity is Refreshed

omo

Active Member
Licensed User
Longtime User
In normal first time loading, all mixed SMM videos from local assets and remote URLs are loaded and working fine. however, when navigating from one activity to another and activity is refreshed, only local video files from asset displayed while video files from remote URLs only displayed black spots (no display). I tried different solutions found on this forum like clearing cache, re-initializing mediamanager and adjusting AddLocalMedia head but to no avail. Remote videos only show/work if application closes completely and restarted, but never works when reloaded after navigating away from current video activities. Local video works fine in all situations, only remote video shows black spots even after increasing DefaultRequestTimeout to 10 minutes as suggested to someone by Erel. Please help
Screenshot_20220502-233123.png
 

omo

Active Member
Licensed User
Longtime User
SMM was built to work with B4XPages. No reason to waste your time with activities.
Thank you, Erel, I have learnt b4xpages enough for me to migrate, but migrating fully is a function of time for me. My schedule is usually tight and I have many clients/projects still maintained via activity approach that may cause too much headache for me now if fully migrated to b4xpages at moment.

Please, help me with one more idea to resolve this first, I will migrate fully to b4xpages sooner than I expected, but permit me to do that at my own phase to avoid having troubles with my clients based on my time constraint. Just share me with one☝️ more idea to resolve this, I will be fine
 
Upvote 0

omo

Active Member
Licensed User
Longtime User
I don't recommend using SMM with activities. You will need to declare it in Globals and it means that SMM will be killed or paused whenever the activity is killed or paused. It will not work properly.

Use ExoPlayer directly instead.
Ok, no problem. I see, that's what is happening. Thank you so much, I got your clear message. If I find no escape route from new ideas I have at moment, I will move to one of your suggested plan B. Thank you! I wouldn't mind if I get your response from my other two threads raised at your convenient time in addition to what I expect from others. Thank you, remain blessed
 
Upvote 0

omo

Active Member
Licensed User
Longtime User
For SMM related activity problem as described in this context, i solved this problem in just three steps:
Step 1: I redefined player, playerview as global variables instead of local variables thus:
Sub Globals
'....
Dim player As SimpleExoPlayer
Dim playerview As SimpleExoPlayerView
'....
end sub

Step 2: Immediately after MediaManager.SetMedia(pnl1, url), hold the media view as demonstrated below, i am sure it can be better improved using wait for (pnl1) SMM_mediaready(...) and SetMediaWithExtra, though didn't work for my scenario

MediaManager.SetMedia(panel, Starter.downloadserverip & FileName)
playerview = panel.GetView(0).GetView(0)
player = playerview.Tag
playerview.Player = player
player.Play

Step3: Under activity_pause, place this code to pause video when activity is moved to background that pauses the activity

Sub Activity_Pause (UserClosed As Boolean)
If UserClosed = True Then
player.pause
player.Play
End If
End Sub

Note: It offers perfect solution to my typical challenge as defined under this context
 
Last edited:
Upvote 0
Top