小程序大小(15 兆字节)太重而无法加载? [英] Applet size (15 megabytes) too heavy to load?

查看:23
本文介绍了小程序大小(15 兆字节)太重而无法加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道 15 mega 加载小程序是否很重?
我的主要问题是两个声音文件(.Au),其重量约为 9 兆字节.
有人对如何使用 mp3 或其他减轻体重的想法有建议吗?
谢谢

I would like to know whether 15 mega is quite heavy applet to load?
My main problem are two sound files(.Au) that its weight is about 9 mega bytes.
Anybody has suggestion of how to use mp3 maybe instead or other ideas of reducing weight?
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 来代替 ..

Anybody has suggestion of how to use mp3 maybe instead ..

添加mp3plugin.jar 添加到小程序的运行时类路径(在存档元素中),Java Sound 将能够像打开 wav 或 au 一样打开 MP3.

Add the mp3plugin.jar of the JMF to the run-time class-path of the applet (in the archive element) and Java Sound will be able to open the MP3s as though they were a wav or au.

MP3 插件将无法解析一些更现代的 MP3,这些 MP3 执行非标准操作,例如在 MP3 中包含封面艺术,但使用标准 MP3 格式对其进行编码,并且可以正常处理.

The MP3 plugin will not be able to parse some of the more modern MP3s that do non-standard things like including cover art in the MP3, but encode them using a standard MP3 format and it will handle them OK.

..将 mp3plugin.jar 添加到小程序的运行时类路径(在存档元素中)是什么意思?

..what did you mean to add the mp3plugin.jar to the run time class path of the applet (in the archive element)?

<HTML> 
<BODY> 
<APPLET 
    archive="MyGame.jar,mp3plugin.jar" 
    code="GUI.JPanelGameApplet" 
    width=800 
    height=580>
</APPLET> 
</P> 
</BODY> 
</HTML>

请注意,我还将 Archive 更改为 archive(只是为了保持一致)和

Note that I also changed Archive to archive (just to keep things consistent) and

code="GUI/JPanelGameApplet.class"

(通常可以容忍,但不正确)

(generally tolerated, but not correct) to

code="GUI.JPanelGameApplet" 

(假定小程序在 GUI 包中).如果小程序在 GUI 包中,元素应该以不同的方式编写.

(which presumes the applet is in the GUI package). If the applet is not in the GUI package, the element should be written differently.

我下载了exe格式的MP3插件..

I've downloaded the MP3 plugin in the exe format ..

忽略 EXE 链接并下载 Zip!

Ignore the EXE link and download the Zip!

..我安装了它"

不要费心运行/安装 EXE(EXE 对 Mac 或 Unix/Linux 上的最终用户没有用处).只需展开 Zip 并将 Jar 添加到运行时类路径

Don't bother to run/install the EXE (an EXE is no use to end users on Mac. or Unix/Linux). Just expand the Zip and add the Jar to the run-time class-path

我肯定会在 HTML 中更改代码..

I'll definitely do that code changes in the HTML..

这将解决问题"(对于嵌入式小程序).

That will be 'problem solved' (for the embedded applet).

这篇关于小程序大小(15 兆字节)太重而无法加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆