0
package battleship;

import sun.audio.*;
import java.io.*;

public class Sound // Holds one audio file
{
    public void playIntro()
    {

        AudioStream bGM;


        try{
        bGM = new AudioStream(new FileInputStream("intro.wav"));

        AudioPlayer.player.start(bGM);

        } catch (IOException error){}

    }

}

I have that on one of my games and the music doesnt run, any help? If I place AudioPlayer.player.run(); after the first autoplayer I get the music to run, but the rest of my program won't continue after that method call.

2
Contributors
1
Reply
13
Views
3 Years
Discussion Span
Last Post by stultuske
0

did you already solve the question, or was that an error on your part?
anyway, doing this: catch (IOException error){} is always a good way not to find out what's going wrong in your application.
if it's not working yet, have you tried by using a thread? let the sound run in the background instead of it holding your application?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.