Android Programming Press on the image to return to the main documentation page.

MediaBrowser

Written by Edward Smith and Frederic Leneuf-Magaud

List of types:

MediaBrowser

MediaBrowser


Events:

None

Members:


  GetAudioFileInfo (Path As String, File As String) As Map

  GetAudioFileInfoByID (External As Boolean, ID As Long) As Map

  GetExtImageFileInfo (Location As String) As Map

  GetExtVideoFileInfo (Location As String) As Map

  GetImageDimensions (Location As String) As Map

  GetImgThumbnailByID (ID As Long, Mini As Boolean) As android.graphics.Bitmap

  GetMediaAudioList (External As Boolean, SortCol As String) As Map

  GetMediaImageList (External As Boolean, SortCol As String) As Map

  GetMediaVideoList (External As Boolean, SortCol As String) As Map

  GetVideoThumbnailByID (ID As Long, Mini As Boolean) As android.graphics.Bitmap

  Initialize (EventName As String)

  MediaAudioPlay (External As Boolean, ID As Int)

  MediaIsLooping As Boolean

  MediaIsPlaying As Boolean

  MediaLength As Int

  MediaPause

  MediaPosition As Int

  MediaResume

  MediaSeek (position As Int)

  MediaSetLooping (Looping As Boolean)

  MediaSetVolume (leftVolume As Float, rightVolume As Float)

  MediaStop

  Tag As Object

Members description:

GetAudioFileInfo (Path As String, File As String) As Map
Returns a Map containing info from the MediaStore about an audio file.

The fields that are returned are:
"ID"
"Title"
"Album"
"Artist"
"Track"
"Year"
"Location"
"DisplayName"
"Duration" (in ms)
GetAudioFileInfoByID (External As Boolean, ID As Long) As Map
Returns a Map containing info from the MediaStore about an audio file.

The fields that are returned are:
"ID"
"Title"
"Album"
"Artist"
"Track"
"Year"
"Location"
"DisplayName"
"Duration" (in ms)
GetExtImageFileInfo (Location As String) As Map
Returns a Map containing info from the MediaStore about an external image file.
Location = complete path name for the file.

The fields that are returned are:
"ID"
"Location"
"DisplayName"
"DateTaken" (in ticks from 1970)
"Height" (with Android 3.0+)
"Width" (with Android 3.0+)
"Size" (in bytes)
GetExtVideoFileInfo (Location As String) As Map
Returns a Map containing info from the MediaStore about an external video file.
Location = complete path name for the file.

The fields that are returned are:
"ID"
"Location"
"DisplayName"
"DateTaken" (in ticks from 1970)
"Resolution" (can be Null for some files)
"Size" (in bytes)
GetImageDimensions (Location As String) As Map
Returns a map containing width and height of the specified file.
Location = complete path name for the file.
GetImgThumbnailByID (ID As Long, Mini As Boolean) As android.graphics.Bitmap
Returns the micro thumbnail (96x96) or mini thumbnail (512x384) of an image file (it is generated if it doesn't exist).
GetMediaAudioList (External As Boolean, SortCol As String) As Map
Returns a Map containing a list of all Audio files in the MediaStore which can be sorted.

The allowed fields for sorting are:
Null (if Null is used, it will sort on the ID)
"title"
"album"
"artist"
"track"
"year"
"_data" (location)
"_display_name"
"duration"

The fields that are returned are:
"ID"
"Title"
"Album"
"Artist"
"Track"
"Year"
"Location"
"DisplayName"
"Duration" (in ms)
GetMediaImageList (External As Boolean, SortCol As String) As Map
Returns a Map containing a list of all Image files in the MediaStore which can be sorted.

The allowed fields for sorting are:
Null (if Null is used, it will sort on the ID)
"_data" (location)
"_display_name"
"datetaken"
"size"

The fields that are returned are:
"ID"
"Location"
"DisplayName"
"DateTaken" (in ticks from 1970)
"Height" (with Android 3.0+)
"Width" (with Android 3.0+)
"Size" (in bytes)
GetMediaVideoList (External As Boolean, SortCol As String) As Map
Returns a Map containing a list of all Video files in the MediaStore which can be sorted.

The allowed fields for sorting are:
Null (if Null is used, it will sort on the ID)
"_data" (location)
"_display_name"
"datetaken"
"_size"

The fields that are returned are:
"ID"
"Location"
"DisplayName"
"DateTaken" (in ticks from 1970)
"Resolution" (can be Null for some files)
"Size" (in bytes)
GetVideoThumbnailByID (ID As Long, Mini As Boolean) As android.graphics.Bitmap
Returns the micro thumbnail (96x96) or mini thumbnail (512x384) of a video file (it is generated if it doesn't exist).
There's a known bug on some Android versions with micro thumbnails:
If the micro thumbnail can't be generated (e.g. video file format not recognized), the result is either null or a random thumbnail. Thus, for video files, it is strongly recommended to check if the mini thumbnail is initialized before trying to get the micro thumbnail.
Initialize (EventName As String)
MediaAudioPlay (External As Boolean, ID As Int)
Plays an audio file.
Raises the event "MediaCompleted" when the file end is reached.
MediaIsLooping As Boolean
Checks whether the player is looping or non-looping.
MediaIsPlaying As Boolean
MediaLength As Int
Returns the duration in ms.
MediaPause
MediaPosition As Int
Gets the current playback position.
MediaResume
MediaSeek (position As Int)
Seeks to specified time position (in ms).
Raises the event "SeekCompleted" when the position change has been completed.
MediaSetLooping (Looping As Boolean)
Sets the player to be looping or non-looping.
MediaSetVolume (leftVolume As Float, rightVolume As Float)
Sets the volume on this player (and this player only).
Note that the passed volume values are raw scalars. UI controls should be scaled logarithmically.
This function must be called AFTER MediaAudioPlay.
MediaStop
Tag As Object

Top