有没有办法在JavaFX应用程序中的Raspberry Pi 3上播放媒体(.mp4)

时间:2016-07-14 14:22:10

标签: javafx raspberry-pi raspberry-pi3 javafxports

我相信JavaFX for Raspberry Pi不支持javafx媒体库(播放.mp4文件)。我的应用程序使用FXML用JavaFX编写,我需要播放视频文件。有没有办法在我的JavaFX应用程序中执行此操作?

我有一个应用程序,可以从特定按键上的目录播放随机视频,并在按键释放时停止视频。我在Windows中使用以下工作正常:

javafx.scene.media.Media
javafx.scene,media.MediaPlayer
javafx.scene.media.MediaView

和初始化函数中的代码(mv是我的MediaView实例):

mv.setVisible(true);
m = new Media(new File("test.mp4").toURI().toString());
mediaPlayer = new MediaPlayer(m);
mediaPlayer.setAutoPlay(true);
final DoubleProperty width = mv.fitWidthProperty();
final DoubleProperty height = mv.fitHeightProperty();
width.bind(Bindings.selectDouble(mv.sceneProperty(), "width"));
height.bind(Bindings.selectDouble(mv.sceneProperty(), "height"));
mv.setPreserveRatio(true);
mv.setMediaPlayer(mediaPlayer);

但是在Pi上运行时这不起作用。我得到以下堆栈跟踪

Java HotSpot(TM) Client VM warning: 
You have loaded library /home/pi/jdk1.8.0_91/jre/lib/arm/libjfxmedia.so which    might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
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:498)
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:498)
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$76(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.UnsatisfiedLinkError: /home/pi/jdk1.8.0_91/jre/lib/arm/libjfxmedia.so: /home/pi/jdk1.8.0_91/jre/lib/arm/libjfxmedia.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.sun.glass.utils.NativeLibLoader.loadLibraryFullPath(NativeLibLoader.java:201)
at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:94)
at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:39)
at com.sun.media.jfxmediaimpl.NativeMediaManager.lambda$new$8(NativeMediaManager.java:115)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.media.jfxmediaimpl.NativeMediaManager.<init>(NativeMediaManager.java:106)
at com.sun.media.jfxmediaimpl.NativeMediaManager$NativeMediaManagerInitializer.<clinit>(NativeMediaManager.java:77)
at com.sun.media.jfxmediaimpl.NativeMediaManager.getDefaultInstance(NativeMediaManager.java:89)
at com.sun.media.jfxmedia.MediaManager.canPlayProtocol(MediaManager.java:78)
at com.sun.media.jfxmedia.locator.Locator.<init>(Locator.java:232)
at javafx.scene.media.Media.<init>(Media.java:393)
at simpleplayer.FXMLDocumentController.initialize(FXMLDocumentController.java:46)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at simpleplayer.SimplePlayer.start(SimplePlayer.java:22)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$83(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$61(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$59(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$60(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
Exception running application simpleplayer.SimplePlayer
C:\Users\Brendan\Documents\NetBeansProjects\SimplePlayer\nbproject\remote-platform-impl.xml:105: The following error occurred while executing this line:
C:\Users\Brendan\Documents\NetBeansProjects\SimplePlayer\nbproject\remote-platform-impl.xml:63: Remote command failed with exit status 1
BUILD FAILED (total time: 5 seconds)

我也尝试过使用execstack推荐的修复程序,问题仍然存在。

0 个答案:

没有答案