Ciao a tutti, sto realizzando una app per la riproduzione di contenuti video.mp4 con exoplayer e fin qui ci sono riuscito ma solamente caricando i file video nella dirasset e quindi interno al dispositivo android, come da titolo ho bisogno di far riprodurre dei file video.mp4 non dalla memoria interna ma da una chiavetta usb collegata al dispositivo android, qualcuno può aiutarmi, posto il codice che ho realizzato ancora da ultimare, faccio presente che ho impostato i percorsi in dirrootexternal ma come da titolo voglio richiamarli dalla 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