本人准备做一个PPT播放器(提取PPT中的图片,解说文字,录音,目录等,制作一个播放器),但不知道JAVA能不能支持,如果支持,应该要用到那些插件支持,请高手指教!!!如果JAVA不支持,那么用什么语言可以开发?谢谢!

解决方案 »

  1.   

    可以的啊,,用awt.image,javax.sound.sampled 这个是主要的吧,,我用这个开发了一个播放器,注意一下缓存方面的大小,具体的代码可以看一下,,
    import javax.sound.sampled.*;
    import java.io.*;
    import java.util.*;
    public class DataPlay extends Thread implements LineListener
    {
    private byte[] databyte;
    private int datasize,con=1,listener=1;
    private AudioInputStream soundStream;
    private SourceDataLine soundline;
    private AudioFormat soundformat;
    PlayEvent pe1;
    PlayListener pl;
    private String playevent1="END";
    PlayThread pt=new PlayThread();
    public void DataPlay()
    {}
    public void dataclose()
            {
              if(listener==1)
              {
                soundline.stop();
              }
              if(listener==2)
              {
                listener=1;
                soundline.removeLineListener(this);
                soundline.stop();
                soundline.close();
                //soundline=null;
              }
    soundStream=null;
    soundformat=null;
    con=2;
    }
    public void play(AudioInputStream soundStream,AudioFormat soundformat,SourceDataLine soundline)
    {
    this.soundStream=soundStream;
    this.soundline=soundline;
    soundline.addLineListener(this);
                    listener=2;
    databyte=new byte[204800];
    try
    {
    if(soundStream.Supported())
    {
    soundStream.(0);
                                    soundStream.reset();
    }
    }
    catch (Exception e)
    {
    } try
    {
    soundline.open(soundformat,20480);//通知音频线将要放入音频数据的格式,并设置缓存!
    }
    catch(LineUnavailableException elua1)
    {
    System.out.println("line open:存得不到控制!\n"+elua1);
    System.exit(0);
    }
    catch(IllegalArgumentException eia1)
    {
    System.out.println("line open:缓冲不能放入数据!\n"+eia1);
    System.exit(0);
    }
    catch(IllegalStateException eis)
    {
    System.out.println("line open:以被打开了!\n"+eis);
    System.exit(0);
    }
    catch(SecurityException es1)
    {
    System.out.println("line opne:数据不安全!\n"+es1);
    System.exit(0);
    }
    if(soundline.isOpen())
    {
    soundline.start();
    this.start();
    }
    else
    {
    System.out.println("it can not open!");
    System.exit(0);
    }
    }
    public void run()
    {
    pt.start();
    do
    {
    playback();//读完soundbyte的数据后,再到playback()方法里再进行读取数据!
    soundline.write(databyte,0,datasize);//往缓存里写入数据!
                            if(con==2)
                            {
                              soundline.stop();
                            }
    }while(con==1);
    }
    private void playback()
    {
    try
    {
    if(soundStream.available()>102400)
    {
    datasize=soundStream.read(databyte);
    }
    else if(soundStream.available()<=0)
    {
    soundline.stop();
    con=2;
    }
    else
    {
    soundStream.read(databyte,0,soundStream.available());
    datasize=soundStream.available();
    datasize-=datasize%4;
    con=2;
    }
    }
    catch (IOException eio7)
    {
    System.out.println("data->byte:I/O出现异常!\n"+eio7);
    System.exit(0);
    }
    }
    class PlayThread extends Thread
    {
    public PlayThread()
    {}
    public void run()
    {
    int position,old=0;
    for (;listener==2 ; )
    {
    try
    {
     position=soundline.getFramePosition();
    }
    catch(NullPointerException enp)
    {
                                      position=old;
     System.out.println("position is null!\n"+enp);
    }
    if(position-old==0 && position>0 && old>0)
    {
    con=2;
    old=0;
                                            System.out.println("3");
    break;
    }
    else
    {
    old=position;
    }
    try
    {
    this.sleep(1000);
    }
    catch (InterruptedException eipt)
    {
    System.out.println("sleep:不能转为睡眠!\n"+eipt);
    }
    }
                            if(listener==2)
                            {
                              soundline.close();
                            } }
    };
    public void update(LineEvent event)
    {
    if(event.getType()==LineEvent.Type.CLOSE)
    {
    this.yield();
    pt.yield();
    soundline=null;
    pe1=new PlayEvent(playevent1);//开始发生事件!
                            System.out.println("1");
    firePlayEvent(pe1);
    soundline.removeLineListener(this);
                            listener=1;
    System.gc();
    }
    }
    public void firePlayEvent(PlayEvent pe)
    {
    pl.validatePlay(pe);
    }
    public void addPlayListener(PlayListener pl)
    {
    this.pl=pl;
    }
    };
    这里最后是事件!
      

  2.   

    好像找不到下面两个类:
    PlayEvent pe1;
    PlayListener pl;
      

  3.   

    我做的是一个一个的BEAN啊,那些都必须是自已做的BEAN,这个是播放数据的BEAN,前面还有数据流,数据类型之类的转换,就不在这个BEAN里面,