This site requires JavaScript, please enable it in your browser!
Greenfoot back
Kordus
Kordus wrote ...

2017/12/21

Background music

Kordus Kordus

2017/12/21

#
Im trying to put background music in my main menu for a college project but it aint working
Kordus Kordus

2017/12/21

#
private GreenfootSound bgMusic = new GreenfootSound("mainmenu.m4a"); public Main_Menu() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super(1920, 1080, 1); starbutton starbutton = new starbutton(); addObject (starbutton, 960, 540); } public void started() { bgMusic.playLoop(); } public void stopped() { bgMusic.stop(); } }
Kordus Kordus

2017/12/21

#
Caused by: javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input URL at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1155) at greenfoot.sound.JavaAudioInputStream.open(JavaAudioInputStream.java:67) at greenfoot.sound.JavaAudioInputStream.<init>(JavaAudioInputStream.java:51) at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:112)
Kordus Kordus

2017/12/21

#
Top is my code and the bottom is the error message I keep recieving
Super_Hippo Super_Hippo

2017/12/21

#
The GreenfootSound class doesn't support M4A files.
nolttr21 nolttr21

2017/12/21

#
try using this site to convert your background music to mp3 https://online-audio-converter.com/
Kordus Kordus

2017/12/22

#
Thankyou Super_Hippo and nolttr21
You need to login to post a reply.