本文整理汇总了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...");
}
示例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();
}
}
示例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);
}
}
示例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;
}
示例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();
}
示例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);
}
}
示例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) {
}
}
示例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);
}
}
示例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();
}
}
示例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();
}
}
}
}