MediaBrowser
MediaBrowser
Events:
- MediaCompleted
- ScanCompleted (Path As String)
- SeekCompleted
Fields:
- FIELD_ALBUM As String
- FIELD_ARTIST As String
- FIELD_COMPOSER As String
- FIELD_DATA As String
- FIELD_DATE_ADDED As String
- FIELD_DATE_MODIFIED As String
- FIELD_DATE_TAKEN As String
- FIELD_DESCRIPTION As String
- FIELD_DISPLAY_NAME As String
- FIELD_DURATION As String
- FIELD_HEIGHT As String
- FIELD_ID As String
- FIELD_MIME_TYPE As String
- FIELD_ORIENTATION As String
- FIELD_RESOLUTION As String
- FIELD_SIZE As String
- FIELD_TITLE As String
- FIELD_TRACK As String
- FIELD_WIDTH As String
- FIELD_YEAR As String
- Tag As Object
Functions:
- GetAudioFieldByID (External As Boolean, ID As Long, Field As String) As String
Returns a field from the MediaStore about the specified audio file.
Examples of field: FIELD_COMPOSER, FIELD_DATE_MODIFIED, FIELD_MIME_TYPE, FIELD_SIZE...
- 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)
- GetExifAttribute (Location As String, Attribute As String) As String
Returns the requested attribute from the Exif data of the specified image.
Location = complete path name for the file.
The complete list of attributes can be found here: https://developer.android.com/reference/android/media/ExifInterface
- GetExifLatLong (Location As String, LatLong As Float()) As Boolean
Stores the latitude and longitude value of the specified image in a float array. Returns False if these Exif data are not available.
Location = complete path name for the file.
- 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.
- GetImageFieldByID (External As Boolean, ID As Long, Field As String) As String
Returns a field from the MediaStore about the specified image file.
Examples of field: FIELD_DATE_MODIFIED, FIELD_MIME_TYPE, FIELD_ORIENTATION...
- GetImageFileInfoByID (External As Boolean, ID As Long) As Map
Returns a Map containing info from the MediaStore about an image 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)
- 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 (= FIELD_ID)
FIELD_ALBUM
FIELD_ARTIST
FIELD_COMPOSER
FIELD_DATA (location)
FIELD_DATE_ADDED
FIELD_DATE_MODIFIED
FIELD_DISPLAY_NAME
FIELD_DURATION
FIELD_MIME_TYPE
FIELD_SIZE
FIELD_TITLE
FIELD_TRACK
FIELD_YEAR
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 (= FIELD_ID)
FIELD_DATA (location)
FIELD_DATE_ADDED
FIELD_DATE_MODIFIED
FIELD_DATE_TAKEN
FIELD_DISPLAY_NAME
FIELD_HEIGHT
FIELD_MIME_TYPE
FIELD_ORIENTATION
FIELD_SIZE
FIELD_TITLE
FIELD_WIDTH
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 (= FIELD_ID)
FIELD_DATA (location)
FIELD_DATE_ADDED
FIELD_DATE_MODIFIED
FIELD_DATE_TAKEN
FIELD_DISPLAY_NAME
FIELD_MIME_TYPE
FIELD_RESOLUTION
FIELD_SIZE
FIELD_TITLE
The fields that are returned are:
"ID"
"Location"
"DisplayName"
"DateTaken" (in ticks from 1970)
"Resolution" (can be Null for some files)
"Size" (in bytes)
- GetVideoFieldByID (External As Boolean, ID As Long, Field As String) As String
Returns a field from the MediaStore about the specified video file.
Examples of field: FIELD_DATE_ADDED, FIELD_DATE_MODIFIED, FIELD_MIME_TYPE...
- GetVideoFileInfoByID (External As Boolean, ID As Long) As Map
Returns a Map containing info from the MediaStore about a video 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)
- 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 "MediaCompleted" event 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
Stops the playback and releases the allocated resources.
- ScanNewMedia (Paths As String())
Requests the media scanner to scan the given files and add them to the MediaStore.
Raises the "ScanCompleted" event after each file is scanned.