我需要在Raspberry Pi(RASPBIAN JESSIE)上运行JavaFX项目。该项目包括WebView和MediaView / MediaPlayer的使用。由于Oracle在ARM平台上不支持JavaFX,我尝试使用Gluon的JavaFX端口(JavaFX Embedded SDK 8.60.8)。 WebView几乎完美地工作。但是,当我想使用MediaPlayer / MediaView播放视频时,我得到了例外:
Error in GstPipelineFactory: can't find element for factory named qtdemux
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$156(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:745)
Caused by: MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player!
at javafx.scene.media.MediaException.exceptionToMediaException(MediaException.java:146)
at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:511)
at javafx.scene.media.MediaPlayer.<init>(MediaPlayer.java:414)
at zirro.App.start(App.java:21)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$163(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$176(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$174(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(PlatformImpl.java:294)
at com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:92)
at com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:51)
... 1 more
Caused by: com.sun.media.jfxmedia.MediaException: Could not create player!
at com.sun.media.jfxmediaimpl.NativeMediaManager.getPlayer(NativeMediaManager.java:224)
at com.sun.media.jfxmedia.MediaManager.getPlayer(MediaManager.java:104)
at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:467)
... 10 more
如何在Raspberry Pi上使用WebView和MediaView / MediaPlayer成功运行JavaFX应用程序?
答案 0 :(得分:5)
WebView和Media从未成为JavaFX ARM发行版的一部分,但Gluon最近将其添加到嵌入式SDK中,可以从here下载并安装最近的ARM JDK,here。
Media需要一些额外的步骤,因为它取决于通常未在常规Jessie发行版上完全安装的本机驱动程序。
首先安装这些驱动程序:
Process
现在编辑sudo apt-get install gstreamer0.10-plugins-good
sudo apt-get install gstreamer0.10-plugins-bad
并在结尾处添加:
/etc/apt/sources.list
保存文件(Ctrl + O,Ctrl + X)。
最后更新并安装驱动程序:
deb http://ftp.uk.debian.org/debian/ wheezy main
deb-src http://ftp.uk.debian.org/debian/ wheezy main
现在您可以尝试再次运行JavaFX应用程序。
如果再次找到相同的异常(sudo apt-get update
sudo apt-get install gstreamer0.10-ffmpeg
sudo apt-get install gstreamer0.10-alsa
),请检查是否显示此消息:MediaException: UNKNOWN
,注意缺少的驱动程序,然后尝试安装它。
答案 1 :(得分:0)
我想从José Pereda
更新正确的答案。
gstreamer
的存储库不是最新的。这就是我使其工作的方式。
更新/etc/apt/sources.list
deb [trusted=yes] http://archive.debian.org/debian wheezy main
deb-src [trusted=yes] http://archive.debian.org/debian/ wheezy main
然后安装依赖项。
sudo apt-get install libtag1-vanilla
sudo apt-get install libtag1-rusxmms
sudo apt-get install libtag1c2a
sudo apt-get install gstreamer0.10-plugins-good
sudo apt-get install gstreamer0.10-plugins-bad
sudo apt-get install gstreamer0.10-ffmpeg
sudo apt-get install gstreamer0.10-alsa