mars

MediaPlayer

 

MediaPlayer

MediaPlayer is used to load and play long sound files.

Example

Creating a MediaPlayer and playing a sound file on a loop.

example



Blocks

create

Create a MediaPlayer with a certain sound file.

create

TYPEEXPLANATIONREQUIRED
MediaPlayerMediaPlayer ComponentYes
SoundSound file to loadYes

start

Play the loaded MediaPlayer.

start

TYPEEXPLANATIONREQUIRED
MediaPlayerMediaPlayer ComponentYes

pause

Pause the playing MediaPlayer.

pause

TYPEEXPLANATIONREQUIRED
MediaPlayerMediaPlayer ComponentYes

seek to

Change the position of the MediaPlayer.

seek to

TYPEEXPLANATIONREQUIRED
MediaPlayerMediaPlayer ComponentYes
NumberTime to seek to, in millisecondsYes

get current duration

Get the current position of the MediaPlayer, in milliseconds.

get current duration

TYPEEXPLANATIONREQUIRED
MediaPlayerMediaPlayer ComponentYes

get song duration

Get the entire length of the sound file, in milliseconds.

get song duration

TYPEEXPLANATIONREQUIRED
MediaPlayerMediaPlayer ComponentYes

is playing

Check if the media player is currently playing.

is playing

TYPEEXPLANATIONREQUIRED
MediaPlayerMediaPlayer ComponentYes

set looping

Loop the MediaPlayer if true.

set looping

TYPEEXPLANATIONREQUIRED
MediaPlayerMediaPlayer ComponentYes
Booleantrue or false valueYes

is looping

Check if the MediaPlayer is currently in a looping state.

is looping

TYPEEXPLANATIONREQUIRED
MediaPlayerMediaPlayer ComponentYes

reset

Reset the current position to 0.

reset

TYPEEXPLANATIONREQUIRED
MediaPlayerMediaPlayer ComponentYes

release

Release the connected sound file to the MediaPlayer. If released, you have to recreate the MediaPlayer.

release

TYPEEXPLANATIONREQUIRED
MediaPlayerMediaPlayer ComponentYes

Post a Comment

0 Comments