JMF 视频程序写入文件错误
Exception in thread "AWT-EventQueue-1" java.lang.RuntimeException: No permission to write files from applets
at com.sun.media.JMFSecurityManager.checkFileSave(JMFSecurityManager.java:250)
at com.sun.media.datasink.file.Handler.open(Handler.java:219)
at applet.net.servlet.VideoPlay.getStartVideo(VideoPlay.java:106)
at applet.net.servlet.AppletText.actionPerformed(AppletText.java:70)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6216)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5981)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4583)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4413)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4556)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4220)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4150)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Component.dispatchEvent(Component.java:4413)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
public void getStartVideo(AudioPlay audioPlay) {
try {
// 处理克隆过的数据
DataSource[] ds = new DataSource[2];
ds[0] = cloneVideoSource;
ds[1] = audioPlay.getCloneAudioSource();
DataSource source = Manager.createMergingDataSource(ds);
pro = Manager.createProcessor(source);
// 监听
pro.addControllerListener(this);
// 我的理解就是程序延时 以获得数据
if (!conf(10000)) {
System.exit(1);// 终止程序
}
pro.setContentDescriptor(new FileTypeDescriptor(
FileTypeDescriptor.QUICKTIME));
// 我的理解就是程序延时 以获得数据
if (!real(10000)) {
System.exit(1);// 终止程序
}
DataSource outSource = pro.getDataOutput();
// 定位文件 此值应该读取配置文件中的值 方便更改路径
MediaLocator m = new MediaLocator(new java.lang.String(
"file:///E:/lx/abc.QUICKTIME"));
// 开启数据
pro.start();
videoSink = Manager.createDataSink(outSource, m);
videoSink.open();//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>定位在这错误
videoSink.start();
} catch (NoProcessorException e) {
// TODO Auto-generated catch block
e.printStackTrace();
JOptionPane.showMessageDialog(this, e.getMessage());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
JOptionPane.showMessageDialog(this, e.getMessage());
} catch (NoDataSinkException e) {
// TODO Auto-generated catch block
e.printStackTrace();
JOptionPane.showMessageDialog(this, e.getMessage());
} catch (IncompatibleSourceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
/**
* Dispatch an uncaught exception to the handler. This method is
* intended to be called only by the JVM.
*/
private void dispatchUncaughtException(Throwable e) {
getUncaughtExceptionHandler().uncaughtException(this, e);
}
MediaPlayer mp = new MediaPlayer();
this.add(mp, BorderLayout.CENTER);
mp.setMediaLocation(new String("file:///E:/lx/abc.QUICKTIME"));
mp.start();