codenameone / CodenameOne

Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.

Home Page:https://www.codenameone.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wav playback doesn't make a sound in the simulator

shai-almog opened this issue · comments

There were two problems with this sample. Fixing both of these problems resulted in the wav file playing as expected in my test.

Problem 1: The sound is never played. Link

InputStream is = Display.getInstance().getResourceAsStream(getClass(), "/" + fileName);
                m = MediaManager.createMedia(is, "audio/wav");

Need to add m.play(); after loading the stream.

Problem 2: The name of the Wav file is incorrect. Link

new RegularSound("playwav.wav");

Should be

new RegularSound("mywav.wav");