SL4A API Help -MediaPlayerFacade

index
This facade exposes basic mediaPlayer functionality.

Usage Notes:
mediaPlayerFacade maintains a list of media streams, identified by a user supplied tag. If the tag is null or blank, this tag defaults to "default"
Basic operation is: mediaPlayOpen("file:///sdcard/MP3/sample.mp3","mytag",true)
This will look for a media file at /sdcard/MP3/sample.mp3. Other urls should work. If the file exists and is playable, this will return a true otherwise it will return a false.
If play=true, then the media file will play immediately, otherwise it will wait for a mediaPlayerStart command.
When done with the resource, use mediaPlayClose
You can get information about the loaded media with mediaPlayInfo This returns a map with the following elements:
You can use mediaPlayList to get a list of the loaded tags.
mediaIsPlaying will return true if the media is playing.
Events:
A playing media will throw a "media" event on completion. NB: In remote mode, a media file will continue playing after the script has finished unless an explicit mediaPlayClose event is called.
@author Robbie Matthews (rjmatthews62@gmail.com)
mediaIsPlayingChecks if media file is playing.
tag (String) string identifying resource (default=default)
returns: (boolean) true if playing
mediaPlayOpen a media file
url (String) url of media resource
tag (String) string identifying resource (default=default)
play (Boolean) start playing immediately (default=true)
returns: (boolean) true if play successful
mediaPlayCloseClose media file
tag (String) string identifying resource (default=default)
returns: (boolean) true if successful
mediaPlayInfoInformation on current media
tag (String) string identifying resource (default=default)
returns: (Map) Media Information
mediaPlayListLists currently loaded media
returns: (Set) List of Media Tags
mediaPlayPausepause playing media file
tag (String) string identifying resource (default=default)
returns: (boolean) true if successful
mediaPlaySeekSeek To Position
msec (Integer) Position in millseconds
tag (String) string identifying resource (default=default)
returns: (int) New Position (in ms)
mediaPlaySetLoopingSet Looping
enabled (Boolean) (default=true)
tag (String) string identifying resource (default=default)
returns: (boolean) True if successful
mediaPlayStartstart playing media file
tag (String) string identifying resource (default=default)
returns: (boolean) true if successful

index