我想知道15兆的小程序加载是否很重?
我的主要问题是两个声音文件(.Au),其重量约为 9 兆字节。
有人建议如何使用 mp3 或者其他减肥方法吗?
Thanks
相关代码:
public class DJ
{
private ArrayList<Clip> m_Records = new ArrayList<Clip>();
private int m_CurrentRecored = 0;
private Thread m_MusicThread = null;
private AppletContext m_AppletContext;
//java.net.URL m_CodeBase;
//AppletContext ac;
public DJ()
{
try
{
createClip(getClass().getResourceAsStream("/Music/train.mp3"));
createClip(getClass().getResourceAsStream("/Music/machine.mp3"));
}
catch (Exception ex)
{
Logger.getLogger(DJ.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void createClip(java.io.InputStream i_SoundFileStream) throws Exception
{
InputStream i = new AudioStream(i_SoundFileStream);
AudioInputStream sound = AudioSystem.getAudioInputStream(i);
// load the sound into memory (a Clip)
DataLine.Info info = new DataLine.Info(Clip.class, sound.getFormat());
Clip clip = (Clip) AudioSystem.getLine(info);
clip.open(sound);
m_Records.add(clip);
}
任何人都可以建议如何使用 mp3 代替..
Add the 将 JMF 添加到小程序的运行时类路径(在存档元素中),Java Sound 将能够打开 MP3,就好像它们是 wav 或 au 一样。
MP3 插件将无法解析一些更现代的 MP3,这些 MP3 会执行非标准操作,例如在 MP3 中包含封面艺术,但使用标准 MP3 格式对它们进行编码,并且可以正常处理它们。
..将 mp3plugin.jar 添加到小程序的运行时类路径(在存档元素中)是什么意思?
<HTML>
<BODY>
<APPLET
archive="MyGame.jar,mp3plugin.jar"
code="GUI.JPanelGameApplet"
width=800
height=580>
</APPLET>
</P>
</BODY>
</HTML>
请注意,我也改变了Archive
to archive
(只是为了保持一致)和
code="GUI/JPanelGameApplet.class"
(通常可以容忍,但不正确)
code="GUI.JPanelGameApplet"
(假设小程序位于GUI
包裹)。如果小程序是not在 GUI 包中,该元素应该以不同的方式编写。
我已经下载了exe格式的MP3插件..
忽略 EXE 链接并下载 Zip!
..我安装了它”
不必费心运行/安装 EXE(EXE 对于 Mac 或 Unix/Linux 上的最终用户来说没有用)。只需展开 Zip 并将 Jar 添加到运行时类路径即可
我肯定会在 HTML 中更改代码..
这将是“问题解决”(对于嵌入式小程序)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)