B4J Question Media Player Question

LarryK

Member
Trying to use the Media Player in B4J. Getting a Error occurred on line: 103 (Main) java.lang.IllegalArgumentException: java.net.URISyntaxException: Illegal character in path at index 4: 1105 Yakima Street Disc 1.mp3
This is coming from not knowing exactly how to Initialize the Media Player with a file from a directory other than DirAssets.
This works:
B4X:
Sub btnStart_Action
    mp.Initialize("mp", File.GetUri(File.DirAssets, "1105 Yakima Street Disc 1.mp3"))
  
End Sub

This doesn't:
B4X:
Sub cmbVolumes_ValueChanged(strVolume As String)
  
    strVolumePath = strVolume
  
    Log("SVP = " & strVolume) 'SVP = C:\\Users\larry\Music\Tiff_MP3s\1105 Yakima Street\1105 Yakima Street Disc 1.mp3
  
    strVolumeFile = File.GetName(strVolume)
  
    Log("SVF = " & strVolumeFile)'SVF = 1105 Yakima Street Disc 1.mp3
  
  
  
End Sub

Sub btnStart_Action
    mp.Initialize("mp" , strVolumeFile)  'This is the line that causes the error
  
  
End Sub
 
Last edited:

LarryK

Member
Create the uri with xui.FileUri.

Thank you Erel,
but I must be missing something?
says xui is an undeclared variable used before assigned any value ???


Added the following to Sub Process_Globals and all is well !

B4X:
Private xui As XUI
 
Last edited:
Upvote 0
Top