Android Question MediaBrowser library - Cannot read audio file duration

John Sparrow

Member
Licensed User
Longtime User
Hi all

I am using the following code to try to read file duration in ms of an audio file.

Having DIMed MB as mediabrowser

and assigned AudioFileToPlay


MB.Initialize("MB")

FilePath = File.DirInternal & "/"
mapdata = MB.GetAudioFileInfo(FilePath,AudioFileToPlay)
Dim sduration As Map

sduration = mapdata.Get("Duration")

sduration.Initialize

File.WriteMap(File.DirDefaultExternal, "AFDString.txt", sduration)

AFDString = File.ReadString(File.DirDefaultExternal,"AFDString.txt")

Msgbox(AFDString,"")

The message box reads "#Fri Dec 13 10:46:25 GMT 2013" not file duration.

What am I doing wrong?
 

Informatix

Expert
Licensed User
Longtime User
Hi all

I am using the following code to try to read file duration in ms of an audio file.

Having DIMed MB as mediabrowser

and assigned AudioFileToPlay


MB.Initialize("MB")

FilePath = File.DirInternal & "/"
mapdata = MB.GetAudioFileInfo(FilePath,AudioFileToPlay)
Dim sduration As Map

sduration = mapdata.Get("Duration")

sduration.Initialize

File.WriteMap(File.DirDefaultExternal, "AFDString.txt", sduration)

AFDString = File.ReadString(File.DirDefaultExternal,"AFDString.txt")

Msgbox(AFDString,"")

The message box reads "#Fri Dec 13 10:46:25 GMT 2013" not file duration.

What am I doing wrong?
0 is missing at the end of "Duration" (you want to get the duration of the first record). Look at the demo (sub Audio_Click).
 
Upvote 0

John Sparrow

Member
Licensed User
Longtime User
0 is missing at the end of "Duration" (you want to get the duration of the first record). Look at the demo (sub Audio_Click).

Thanks for the quick reply. I altered

sduration = mapdata.Get("Duration")

to read

sduration = mapdata.Get("Duration"&0)

but I still get the date and time data.

Hope you can help
 
Upvote 0
Top