当前位置: 首页>>代码示例>>Java>>正文


Java Player.play方法代码示例

本文整理汇总了Java中javazoom.jl.player.Player.play方法的典型用法代码示例。如果您正苦于以下问题:Java Player.play方法的具体用法?Java Player.play怎么用?Java Player.play使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javazoom.jl.player.Player的用法示例。


在下文中一共展示了Player.play方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import javazoom.jl.player.Player; //导入方法依赖的package包/类
@Override
public void run() {

    Synthesiser synthesiser = new Synthesiser();

    try {
        Player player = new Player(synthesiser.getMP3Data(synthText.getText()));
        player.play();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    setSynthStatus("Waiting...");
}
 
开发者ID:freedomotic,项目名称:freedomotic,代码行数:14,代码来源:MainGUI.java

示例2: playAudio

import javazoom.jl.player.Player; //导入方法依赖的package包/类
/**
 * 播放音频文件<br>
 * 可以播放MP3
 * @author nan.li
 * @param audioFile
 */
public static void playAudio(File audioFile)
{
    try
    {
        BufferedInputStream buffer = new BufferedInputStream(new FileInputStream(audioFile));
        Player player = new Player(buffer);
        player.play();
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:lnwazg,项目名称:kit,代码行数:20,代码来源:AudioMgr.java

示例3: play

import javazoom.jl.player.Player; //导入方法依赖的package包/类
public void play() {
    try {
        BufferedInputStream buffer = new BufferedInputStream(new FileInputStream(filename));
        player = new Player(buffer);
        player.play();
    } catch (Exception e) {
        System.out.println(e);
    }
}
 
开发者ID:IzzelAliz,项目名称:LCL,代码行数:10,代码来源:GameMusic.java

示例4: playMusic

import javazoom.jl.player.Player; //导入方法依赖的package包/类
public void playMusic()
        throws FileNotFoundException, JavaLayerException, IOException
{
    if( dataModel.getOnPlaylist() == -1 ||
        dataModel.getCurrentPlaylist().getNames().isEmpty())
    {
        throw new IOException();
    }
    if(isPlaying) return;
    
    fis = new FileInputStream(dataModel.getCurrentPlaylist().getCurrentPath());
    bis = new BufferedInputStream(fis);

    player = new Player(bis);
    totalFrames = fis.available();

    thread_music = new Thread()
    {
        @Override
        public void run()
        {
            try
            {
                player.play();
                if(isPlaying == true)
                {
                    autoNextMusic();
                }
            }
            catch (JavaLayerException | IOException ex) { }
        }
    };
    thread_music.start();
    isPlaying = true;
}
 
开发者ID:obernardovieira,项目名称:vucor,代码行数:36,代码来源:Model.java

示例5: play

import javazoom.jl.player.Player; //导入方法依赖的package包/类
public void play() throws FileNotFoundException, JavaLayerException {

            BufferedInputStream buffer =
                    new BufferedInputStream(new FileInputStream(music));
            player = new Player(buffer);
            player.play();
    }
 
开发者ID:xiaomin0322,项目名称:alimama,代码行数:8,代码来源:AudioPlayer.java

示例6: play

import javazoom.jl.player.Player; //导入方法依赖的package包/类
public void play(File file, Callback<Exception> onError) throws FileNotFoundException {
    try {
        stop();
        player = new Player(new FileInputStream(file));
        player.play();
    } catch(JavaLayerException e) {
        onError.callback(e);
    }
}
 
开发者ID:Martin-Dames,项目名称:Tingeltangel,代码行数:10,代码来源:MP3Player.java

示例7: run

import javazoom.jl.player.Player; //导入方法依赖的package包/类
@Override
public void run() {
    try {
        Thread.sleep(100);
        for (String audioPath : audioPaths) {
            player = new Player(getClass().getResourceAsStream(audioPath));
            while (player.play(1))
                if (paused.get())
                    LockSupport.park();
        }
    } catch (JavaLayerException e) {
        e.printStackTrace();
    } catch (InterruptedException ignored) {
    }
}
 
开发者ID:MitchTalmadge,项目名称:TheAmericanLife,代码行数:16,代码来源:AudioThread.java

示例8: play

import javazoom.jl.player.Player; //导入方法依赖的package包/类
public void play() {
    try {
        BufferedInputStream buffer = new BufferedInputStream(new FileInputStream(filename));
        player = new Player(buffer);
        player.play();
    } catch (Exception e) {

        System.out.println(e);
    }

}
 
开发者ID:xNovax,项目名称:Multiplication_Dungeon,代码行数:12,代码来源:Mp3Player.java

示例9: run

import javazoom.jl.player.Player; //导入方法依赖的package包/类
@Override
public void run() {
    Synthesiser synthesiser = new Synthesiser(LANGUAGE_CODE);
    try {
        InputStream is = synthesiser.getMP3Data(message);
        //InputStreamToMP3File(is);
        Player player = new Player(is);
        player.play();

    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:freedomotic,项目名称:freedomotic,代码行数:14,代码来源:GoogleSpeech.java

示例10: play

import javazoom.jl.player.Player; //导入方法依赖的package包/类
/**
 * Plays the song contained within this player.
 */
public void play() {
	if (!locked) {
		if ((filename != null) && (filename != "")) {
			try {
				setBis(setFis(MP3.class.getResourceAsStream(filename)));
				player = new Player(bis);

				mp3Thread = new Thread() {
					@Override
					public void run() {
						try {
							idle = false;
							Debug.out(Type.INFO, "Music", "Played " + filename + "!");
							player.play();
							Debug.out(Type.INFO, "Music", "Song finished!");
							idle = true;
							return;
						} catch (final Exception e) {
							e.printStackTrace();
						}
					}
				};

				mp3Thread.start();
			} catch (final Exception e) {
				e.printStackTrace();
			}
		}
	}
}
 
开发者ID:RedInquisitive,项目名称:Project-Tanks,代码行数:34,代码来源:MP3.java


注:本文中的javazoom.jl.player.Player.play方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。