Android Question SimpleExoplayerView Help

Luis Felipe Andrade

Member
Licensed User
Hello I have a kiosco app working with 3 images jpg and a short test video mp4 in the same region of the screen, I combine images and videos depending on the duration time configured in a database, I have noticed that after a few minutes or hours simpleexoplayerview does not play the video and the next time it does, and the next time it does not and so on, I will appreciate if you can help me, thank you

Timer called dispara:
Sub dispara
    Try
        If  pimagenbreak(laban99,0)<>"" Then
            If File.Exists (File.DirDefaultExternal & "/bzmonitor/ImgBreak" , pimagenbreak(laban99,0)) Then
                timer6.Enabled=False
                If pimagenbreak(laban99,1)>0 Then 'seconds
                    timer6.Interval=pimagenbreak(laban99,1)*1000
                End If
                Dim ss1 As Int
                ss1=sf.InString(pimagenbreak(laban99,0),".mp4")
                If ss1>0 Then
                    ss1=0
                    ImageView11.Visible=False
                    SimpleExoPlayerView1.Visible= True
                    Log ("Show Video: " & "/bzmonitor/ImgBreak " & pimagenbreak(laban99,0))
                    player1.Prepare(player1.CreateFileSource(File.DirDefaultExternal & "/bzmonitor/ImgBreak" , pimagenbreak(laban99,0)))
                    SimpleExoPlayerView1.Player = player1
                    SimpleExoPlayerView1.UseController = False
                    SimpleExoPlayerView1.ResizeMode="FILL"
                    player1.Play
                
                Else
                    'if is image
                    SimpleExoPlayerView1.Visible= False
                    ImageView11.Visible=True
                    Log ("Show Image: " & pimagenbreak(laban99,0))
                    ImageView11.SetBackgroundImage (LoadBitmap(File.DirDefaultExternal & "/bzmonitor/ImgBreak" , pimagenbreak(laban99,0)))
                    'timer6.Enabled=True
                End If
                timer6.Enabled=True
            Else
            End If
        End If
    Catch
        Log("44" & LastException.Message)
        timer6.Enabled=True
    End Try
End Sub
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Tip: never use File.DirDefaultExternal. If you really need to load from the secondary storage then use RuntimePermissions.GetSafeDirDefaultExternal.

Make sure not to create a new player each time. I would have used SimpleMediaManager for such task. It will reuse the views whenever possible.
 
Upvote 0

Luis Felipe Andrade

Member
Licensed User
Tip: never use File.DirDefaultExternal. If you really need to load from the secondary storage then use RuntimePermissions.GetSafeDirDefaultExternal.

Make sure not to create a new player each time. I would have used SimpleMediaManager for such task. It will reuse the views whenever possible.
Thanks Erel, will change an check simplemediamanager, Thank you so much.
 
Upvote 0
Top