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

Media Player (Core)

List of types:

MediaPlayer

MediaPlayer

The MediaPlayer can be used to play audio files.
See the media player tutorial for more information.
NOTE: The media player should be declared as a process global object.
The Complete event is raised when playback completes. It will only be raised if you initialize the object with Initialize2.

Events:

Complete

Members:


  Duration As Int [read only]

  Initialize

  Initialize2 (EventName As String)

  IsInitialized As Boolean

  IsPlaying As Boolean

  Load (Dir As String, FileName As String)

  Looping As Boolean

  Pause

  Play

  Position As Int

  Release

  SetVolume (Left As Float, Right As Float)

  Stop

Members description:

Duration As Int [read only]
Returns the total duration of the loaded file (in milliseconds).
Initialize
Initializes the object.
You should use Initialize2 if you want to handle the Complete event.
Example:
Dim MP As MediaPlayer 'should be done in Sub Process_Globals
MP.Initialize2("MP")
MP.Load(File.DirAssets, "SomeFile.mp3")
MP.Play
Initialize2 (EventName As String)
Similar to Initialize2. Complete event will be raised when play back completes.
EventName - The Sub that will handle the Complete event.
IsInitialized As Boolean
IsPlaying As Boolean
Returns true if the media player is currently playing.
Load (Dir As String, FileName As String)
Loads an audio file and prepares it for playing.
Looping As Boolean
Gets or sets whether the media player will restart playing automatically.
Pause
Pauses playback. You can resume playback from the current position by calling Play.
Play
Starts (or resumes) playing the loaded audio file.
Position As Int
Gets or sets the current position (in milliseconds).
Release
Releases all resources allocated by the media player.
SetVolume (Left As Float, Right As Float)
Sets the playing volume for each channel. The value should be between 0 to 1.
Stop
Stops playing. You must call Load before trying to play again.
Top