javazoom.jl.player.Player Java Examples

The following examples show how to use javazoom.jl.player.Player. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SoundPlayer.java    From Rails with GNU General Public License v2.0 6 votes vote down vote up
public void play() {
    try {
        //stop prior BGM music
        if (previousLoopPlayerThread != null) {
            previousLoopPlayerThread.interrupt();
        }

        while (!isStopped) {
            player = new Player(soundFileBuffer.getFileInputStream(fileName));
            player.play();
            player.close();
        }
    }
    catch (Exception e) {
        //if anything goes wrong, don't play anything
    }
}
 
Example #2
Source File: SoundTools.java    From MyBox with Apache License 2.0 5 votes vote down vote up
public static Player getMp3Player(File file) {
        try {
            BufferedInputStream buffer = new BufferedInputStream(new FileInputStream(file));
            Player player = new Player(buffer);
//            player.play();
            return player;
        } catch (Exception e) {
            return null;
        }
    }
 
Example #3
Source File: SoundPlayer.java    From Rails with GNU General Public License v2.0 5 votes vote down vote up
public void play() {
    try {
        Player player = new Player(soundFileBuffer.getFileInputStream(fileName));
        player.play();
        player.close();
    }
    catch (Exception e) {
        //if anything goes wrong, don't play anything
    }
}
 
Example #4
Source File: MP3Play.java    From xnx3 with Apache License 2.0 5 votes vote down vote up
/**
 * @param filePath	MP3文件的绝对路径,如 E:/xnx3/test.mp3
 * @throws JavaLayerException 
 * @throws FileNotFoundException 
 */
public MP3Play(String filePath) throws JavaLayerException, FileNotFoundException {
	if(FileUtil.exists(filePath)){
		BufferedInputStream buffer = new BufferedInputStream(new FileInputStream(filePath));
        player = new Player(buffer);
	}else{
		throw new FileNotFoundException(filePath+" is not exists");
	}
}