MediaPlayer
MediaPlayer is used to load and play long sound files.
Example
Creating a MediaPlayer and playing a sound file on a loop.
Blocks
create
Create a MediaPlayer with a certain sound file.
TYPE | EXPLANATION | REQUIRED |
---|---|---|
MediaPlayer | MediaPlayer Component | Yes |
Sound | Sound file to load | Yes |
start
Play the loaded MediaPlayer.
TYPE | EXPLANATION | REQUIRED |
---|---|---|
MediaPlayer | MediaPlayer Component | Yes |
pause
Pause the playing MediaPlayer.
TYPE | EXPLANATION | REQUIRED |
---|---|---|
MediaPlayer | MediaPlayer Component | Yes |
seek to
Change the position of the MediaPlayer.
TYPE | EXPLANATION | REQUIRED |
---|---|---|
MediaPlayer | MediaPlayer Component | Yes |
Number | Time to seek to, in milliseconds | Yes |
get current duration
Get the current position of the MediaPlayer, in milliseconds.
TYPE | EXPLANATION | REQUIRED |
---|---|---|
MediaPlayer | MediaPlayer Component | Yes |
get song duration
Get the entire length of the sound file, in milliseconds.
TYPE | EXPLANATION | REQUIRED |
---|---|---|
MediaPlayer | MediaPlayer Component | Yes |
is playing
Check if the media player is currently playing.
TYPE | EXPLANATION | REQUIRED |
---|---|---|
MediaPlayer | MediaPlayer Component | Yes |
set looping
Loop the MediaPlayer if true.
TYPE | EXPLANATION | REQUIRED |
---|---|---|
MediaPlayer | MediaPlayer Component | Yes |
Boolean | true or false value | Yes |
is looping
Check if the MediaPlayer is currently in a looping state.
TYPE | EXPLANATION | REQUIRED |
---|---|---|
MediaPlayer | MediaPlayer Component | Yes |
reset
Reset the current position to 0.
TYPE | EXPLANATION | REQUIRED |
---|---|---|
MediaPlayer | MediaPlayer Component | Yes |
release
Release the connected sound file to the MediaPlayer. If released, you have to recreate the MediaPlayer.
TYPE | EXPLANATION | REQUIRED |
---|---|---|
MediaPlayer | MediaPlayer Component | Yes |
0 Comments