jmf播放媒体文件

import java.io.File;
import java.io.IOException;

import javax.media.CannotRealizeException;
import javax.media.Manager;
import javax.media.NoPlayerException;
import javax.media.Player;

public class Player {
	private static String path = "e:/temp/startup.wav";

	public static void main(String[] args) {
		File f1 = new File(path);
		try {
			Player player = Manager.createRealizedPlayer(f1.toURI().toURL());
			player.prefetch();
			player.start();
		} catch (CannotRealizeException ex) {
		} catch (NoPlayerException ex) {
		} catch (IOException ex) {
		}
	}
}



不知道为什么,即使安装了mp3的插件,还是不能正确的播放mp3。

你可能感兴趣的:(java,swing)