Sketchware

Sketchware

  • Docs
  • Community
  • Blog

›Components

The Basics

  • Getting Started
  • Creating a New Project
  • Designing Your App
  • Programming Your App
  • Adding Components
  • Adding Resources

Firebase

  • Getting Started
  • Linking Android App
  • Project Settings
  • Setting Database Rules
  • Enabling Login Methods
  • Enabling Firebase Storage

AdMob

  • Getting Started
  • Creating Ad Unit
  • Sketchware AdMob Settings

Publishing

  • Getting Started
  • Creating a Service Account
  • First Time Publishing

Components

  • Intent
  • SharedPreference
  • Calendar
  • Vibrator
  • Timer
  • Dialog
  • MediaPlayer
  • SoundPool
  • ObjectAnimator
  • Camera
  • FilePicker
  • Gyroscope
  • Firebase DB
  • Firebase Auth
  • Firebase Storage

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
← DialogSoundPool →
  • Example
  • Blocks
    • create
    • start
    • pause
    • seek to
    • get current duration
    • get song duration
    • is playing
    • set looping
    • is looping
    • reset
    • release
Sketchware
Docs
Getting Started
Community
FacebookSlack
More
BlogMedium
Copyright © 2018 Sketchware