在Raspberry Pi上使用JavaFX播放视频

Fer*_*roG 4 javafx raspberry-pi javafxports gluon

我需要在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
Run Code Online (Sandbox Code Playgroud)

有关如何在Raspberry Pi上使用WebView和MediaView/MediaPlayer成功运行JavaFX应用程序的任何想法?

Jos*_*eda 5

WebView和Media从未成为JavaFX ARM发行版的一部分,但Gluon最近将其添加到嵌入式SDK中,可以从这里下载并安装最近的ARM JDK,可在此处获得.

媒体需要一些额外的步骤,因为它依赖于通常未在常规Jessie发行版上完全安装的本机驱动程序.

先安装这些驱动程序:

sudo apt-get install gstreamer0.10-plugins-good
sudo apt-get install gstreamer0.10-plugins-bad 
Run Code Online (Sandbox Code Playgroud)

现在编辑/etc/apt/sources.list并添加到最后:

deb http://ftp.uk.debian.org/debian/ wheezy main
deb-src http://ftp.uk.debian.org/debian/ wheezy main
Run Code Online (Sandbox Code Playgroud)

保存文件(Ctrl + O,Ctrl + X).

最后更新并安装驱动程序:

sudo apt-get update
sudo apt-get install gstreamer0.10-ffmpeg
sudo apt-get install gstreamer0.10-alsa
Run Code Online (Sandbox Code Playgroud)

现在您可以尝试再次运行JavaFX应用程序.

如果再次找到相同的异常(MediaException: UNKNOWN),请检查它是否显示此消息:Error in GstPipelineFactory,注意缺少的驱动程序,并尝试安装它.