jsp中嵌入APPLET 使用jmf 刷新页面时会出现java.io.IOException: Capture device in use
请问有什么方法可以解决 谢谢
错误如下:
MediaNode event thread java.lang.InterruptedException
MediaNode event thread java.lang.InterruptedException
java.io.IOException: Capture device in use
java.io.IOException: Capture device in use
javax.media.NoPlayerException: Error instantiating class: com.sun.media.protocol.vfw.DataSource : java.io.IOException: Capture device in use
at javax.media.Manager.createPlayerForContent(Manager.java:1362)
at javax.media.Manager.createPlayer(Manager.java:417)
at javax.media.Manager.createRealizedPlayer(Manager.java:553)
at AppletTest.AppletTest.getJContentPane(AppletTest.java:106)
at AppletTest.AppletTest.init(AppletTest.java:64)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.awt.IllegalComponentStateException: contentPane cannot be set to null.
at javax.swing.JRootPane.setContentPane(Unknown Source)
at javax.swing.JApplet.setContentPane(Unknown Source)
at AppletTest.AppletTest.init(AppletTest.java:64)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.ThreadDeath
at java.lang.Thread.stop(Unknown Source)
at java.lang.ThreadGroup.stopOrSuspend(Unknown Source)
at java.lang.ThreadGroup.stop(Unknown Source)
at sun.awt.AppContext.dispose(Unknown Source)
at sun.applet.AppletClassLoader.release(Unknown Source)
at sun.plugin.security.PluginClassLoader.release(Unknown Source)
at sun.applet.AppletPanel.release(Unknown Source)
at sun.applet.AppletPanel.sendEvent(Unknown Source)
at sun.plugin.AppletViewer.onPrivateClose(Unknown Source)
at sun.plugin.AppletViewer$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
代码如下:
private CaptureDeviceInfo[] getDevices() { //得到所有驱动
Vector devices = CaptureDeviceManager.getDeviceList(null);
CaptureDeviceInfo[] info = new CaptureDeviceInfo[devices.size()];
for (int i = 0; i < devices.size(); i++) {
info[i] = (CaptureDeviceInfo) devices.get(i);
}
return info;
}
private CaptureDeviceInfo[] getVideoDevices() { //筛选视屏驱动
CaptureDeviceInfo[] info = getDevices();
CaptureDeviceInfo[] videoDevInfo;
Vector vc = new Vector();
for (int i = 0; i < info.length; i++) {
Format[] fmt = info[i].getFormats();
for (int j = 0; j < fmt.length; j++) {
if (fmt[j] instanceof VideoFormat) {
vc.add(info[i]);
}
break;
}
}
videoDevInfo = new CaptureDeviceInfo[vc.size()];
for (int i = 0; i < vc.size(); i++) {
videoDevInfo[i] = (CaptureDeviceInfo) vc.get(i);
}
return videoDevInfo;
}
private JPanel getJContentPane() { //把驱动加载到player中
DataSource videoDataSource=null;
if (jContentPane == null) {
BorderLayout borderLayout = new BorderLayout();
jContentPane = new JPanel();
jContentPane.setLayout(borderLayout);
MediaLocator ml = null;
try{
if (getVideoDevices()[0] != null) {
ml = getVideoDevices()[0].getLocator();
player = Manager.createRealizedPlayer(ml);
player.start();
Component comp = player.getVisualComponent();
if (comp != null){
jContentPane.add(comp, BorderLayout.CENTER);
}
else
{
message="111";
return null;
}
}
else
{
message="222";
return null;
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
return jContentPane;
}
相关推荐
通信行业基于MongoDB的安全合规与性能优化:5G时序数据处理、可查询加密及窗口函数应用
内容概要:本文围绕MongoDB在通信行业的深度应用,系统讲解了可查询加密、时间序列集合、窗口函数与性能诊断四大核心技术。通过详实的代码案例,展示了如何利用可查询加密实现敏感数据合规存储与查询,使用时序集合高效处理5G网络KPI等高频写入场景,借助窗口函数进行经营指标的趋势分析,并结合explain()与查询分析器完成性能调优。文章还涵盖分片一致性检查、索引优化等运维实践,全面覆盖通信系统对安全、性能与扩展性的严苛要求。; 适合人群:具备一定数据库基础,从事通信行业研发、架构或运维工作1-3年的技术人员,尤其是参与5G网络监控、客户数据管理或大数据平台建设的相关人员。; 使用场景及目标:① 实现用户手机号、身份证等敏感信息的加密存储与等值查询,满足安全合规要求;② 构建高吞吐、低延迟的5G基站KPI时序数据存储与分析系统;③ 在数据库层直接完成滑动平均、累计求和等经营分析,减少应用层计算负担;④ 诊断慢查询、验证索引有效性,保障系统高性能运行。; 阅读建议:此资源强调理论与实战结合,建议读者在本地或测试环境部署MongoDB 7.0+版本,动手复现文中代码,重点关注schemaMap配置、时序集合参数选择与窗口函数语法细节,并结合explain执行计划理解底层优化机制,从而真正掌握通信级数据架构的设计精髓。
国央企创新负责人如何借助平台实现技术成果的高价值转化与资源精准配置?.docx
科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。
产业园区运营负责人如何在平台建设中科学配置创新资源,提升园区内技术对接效率?.docx
产业园区运营负责人如何在平台建设中科学配置创新资源,提升园区内技术对接效率?
产业园区运营负责人如何提升园区内技术供需匹配的精准度?.docx
科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。
高校技术转移办公室人员如何提升科技成果推介的效率与质量?.docx
科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。


