Hi everyone, I'm creating an app for playing video.mp4 content with exoplayer and so far I've succeeded but only by loading the video files into the dirasset and therefore inside the Android device, as per the title I need to play some video files .mp4 not from the internal memory but from a USB stick connected to the Android device, can anyone help me, I post the code that I have created yet to be completed, I would like to point out that I have set the paths in dirrootexternal but as per the title I want to recall them from the USB.
B4X:
#Region Project Attributes
#ApplicationLabel: InfoPoint-V1.0
#VersionCode: 1
#VersionName: 1.0
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: landscape
#CanInstallToExternalStorage: False
#BridgeLogger:True
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
Private player1 As SimpleExoPlayer
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
Private SimpleExoPlayerView1 As SimpleExoPlayerView
Private imgplay1 As ImageView
Private imgplay2 As ImageView
Private imgplay3 As ImageView
Private imgplay4 As ImageView
Private imgplay5 As ImageView
Private imgplay6 As ImageView
Private pnlbase As Panel
Private imgplay7 As ImageView
Private imgplay8 As ImageView
Private imgplay9 As ImageView
Private imgqrocode As ImageView
Private imgplay10 As ImageView
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
player1.Initialize("player")
End If
Activity.LoadLayout("InfoPoint")
imgplay1.SetLayout(1%x,1%y,15%x,22%y)
imgplay2.SetLayout(18%x,1%y,15%x,22%y)
imgplay3.SetLayout(1%x,28%y,15%x,22%y)
imgplay4.SetLayout(18%x,28%y,15%x,22%y)
imgplay5.SetLayout(1%x,56%y,15%x,22%y)
imgplay6.SetLayout(18%x,56%y,15%x,22%y)
imgplay7.SetLayout(1%x,85%y,15%x,22%y)
imgplay8.SetLayout(18%x,85%y,15%x,22%y)
'imgplay9.SetLayout(1%x,68%y,18%x,19%y)
'imgplay10.SetLayout(20%x,68%y,10%x,19%y)
SimpleExoPlayerView1.SetLayout(35%x,1%y,64%x,60%y)
imgqrocode.SetLayout(78%x,65%y,20%x,30%y)
If File.Exists(File.DirRootExternal, "1.jpg") = True Then
imgplay1.Bitmap= LoadBitmap(File.DirAssets,"1.jpg")
Else
imgplay1.Bitmap= LoadBitmap(File.DirAssets,"banner1.jpg")
End If
If File.Exists(File.DirRootExternal, "2.jpg") = True Then
imgplay2.Bitmap= LoadBitmap(File.DirRootExternal,"2.jpg")
Else
imgplay2.Bitmap= LoadBitmap(File.DirAssets,"banner1.jpg")
End If
If File.Exists(File.DirRootExternal, "3.jpg") = True Then
imgplay3.Bitmap= LoadBitmap(File.DirRootExternal,"3.jpg")
Else
imgplay3.Bitmap= LoadBitmap(File.DirAssets,"banner1.jpg")
End If
If File.Exists(File.DirRootExternal, "4.jpg") = True Then
imgplay4.Bitmap= LoadBitmap(File.DirRootExternal,"4.jpg")
Else
imgplay4.Bitmap= LoadBitmap(File.DirAssets,"banner1.jpg")
End If
If File.Exists(File.DirRootExternal, "5.jpg")= True Then
imgplay5.Bitmap= LoadBitmap(File.DirRootExternal,"5.jpg")
Else
imgplay5.Bitmap= LoadBitmap(File.DirAssets,"banner1.jpg")
End If
If File.Exists(File.DirRootExternal, "6.jpg")= True Then
imgplay6.Bitmap= LoadBitmap(File.DirRootExternal,"6.jpg")
Else
imgplay6.Bitmap= LoadBitmap(File.DirAssets,"banner1.jpg")
End If
If File.Exists(File.DirRootExternal, "7.jpg")= True Then
imgplay7.Bitmap= LoadBitmap(File.DirRootExternal,"7.jpg")
Else
imgplay7.Bitmap= LoadBitmap(File.DirAssets,"banner1.jpg")
End If
If File.Exists(File.DirRootExternal, "8.jpg")= True Then
imgplay8.Bitmap= LoadBitmap(File.DirRootExternal,"8.jpg")
Else
imgplay8.Bitmap= LoadBitmap(File.DirAssets,"banner1.jpg")
End If
If File.Exists(File.DirRootExternal, "9.jpg")= True Then
imgplay9.Bitmap= LoadBitmap(File.DirRootExternal,"9.jpg")
Else
imgplay9.Bitmap= LoadBitmap(File.DirAssets,"banner1.jpg")
End If
If File.Exists(File.DirRootExternal, "10.jpg")= True Then
imgplay10.Bitmap= LoadBitmap(File.DirRootExternal,"10.jpg")
Else
imgplay10.Bitmap= LoadBitmap(File.DirAssets,"banner1.jpg")
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Private Sub imgplay1_Click
player1.Prepare(player1.CreateFileSource(File.DirAssets, "1.mp4"))
SimpleExoPlayerView1.Player = player1
End Sub
Private Sub imgplay2_Click
player1.Prepare(player1.CreateFileSource(File.DirAssets, "2.mp4"))
SimpleExoPlayerView1.Player = player1
End Sub
Private Sub imgplay3_Click
player1.Prepare(player1.CreateFileSource(File.DirRootExternal, "3.mp4"))
SimpleExoPlayerView1.Player = player1
End Sub
Private Sub imgplay4_Click
player1.Prepare(player1.CreateFileSource(File.DirRootExternal, "4.mp4"))
SimpleExoPlayerView1.Player = player1
End Sub
Private Sub imgplay5_Click
player1.Prepare(player1.CreateFileSource(File.DirRootExternal, "5.mp4"))
SimpleExoPlayerView1.Player = player1
End Sub
Private Sub imgplay6_Click
player1.Prepare(player1.CreateFileSource(File.DirRootExternal, "6.mp4"))
SimpleExoPlayerView1.Player = player1
End Sub
Private Sub imgplay7_Click
player1.Prepare(player1.CreateFileSource(File.DirRootExternal, "7.mp4"))
SimpleExoPlayerView1.Player = player1
End Sub
Private Sub imgplay8_Click
player1.Prepare(player1.CreateFileSource(File.DirRootExternal, "8.mp4"))
SimpleExoPlayerView1.Player = player1
End Sub
Private Sub imgplay9_Click
player1.Prepare(player1.CreateFileSource(File.DirRootExternal, "9.mp4"))
SimpleExoPlayerView1.Player = player1
End Sub
Private Sub imgplay10_Click
player1.Prepare(player1.CreateFileSource(File.DirRootExternal, "10.mp4"))
SimpleExoPlayerView1.Player = player1
End Sub