Android Question problem with phoneIntents.playaudio

王安邦

Member
Licensed User
Longtime User
Hi, everybody !
when I use PhoneIntents.PlayAudio method to play a audio file, I got a error message :"The player didn't support the type of audio file."
The code is as follow:

Dim phInt As PhoneIntents
StartActivity(phInt.PlayAudio(File.DirAssets, "cherry.mp3"))
 

mangojack

Well-Known Member
Licensed User
Longtime User
Cannot you use MediaPlayer ..

B4X:
Sub Process_Globals
  Dim MP As MediaPlayer
End Sub

'play sound
 MP.Initialize
 MP.Load(File.DirAssets, "cherry.mp3")
 MP.Play
 
Upvote 0

王安邦

Member
Licensed User
Longtime User
Hi, everybody !
when I use PhoneIntents.PlayAudio method to play a audio file, I got a error message :"The player didn't support the type of audio file."
The code is as follow:

Dim phInt As PhoneIntents
StartActivity(phInt.PlayAudio(File.DirAssets, "cherry.mp3"))

Cannot you use MediaPlayer ..

B4X:
Sub Process_Globals
  Dim MP As MediaPlayer
End Sub
 
'play sound
MP.Initialize
MP.Load(File.DirAssets, "cherry.mp3")
MP.Play
 
Upvote 0

王安邦

Member
Licensed User
Longtime User
Hi, Mangojack !
Very appreciated for your reply !
I know your solution, but I want to use PhoneIntents.PlayAudio method to play a audio file.
 
Upvote 0

王安邦

Member
Licensed User
Longtime User
The problem is already solved. PhoneIntents.PlayAudio can't play audio file in File.DirAssets, the audio file must be copied to RootExternal or DefaultExternal or Internal.
 
Upvote 0
Top