¿Hay alguna manera de reproducir medios(.mp4) en una Raspberry Pi 3 en una aplicación JavaFX
raspberry-pi raspberry-pi3 (0)
Creo que la biblioteca de medios de javafx (que reproduce archivos .mp4) no es compatible con JavaFX para Raspberry Pi. Mi aplicación está escrita en JavaFX usando FXML y necesito reproducir un archivo de video. ¿Hay alguna manera de hacer esto dentro de mi aplicación JavaFX?
Tengo una aplicación que reproduce un video aleatorio de un directorio en una pulsación de tecla en particular, y detiene el video en el lanzamiento de la tecla. Esto funciona bien en Windows usando:
javafx.scene.media.Media
javafx.scene,media.MediaPlayer
javafx.scene.media.MediaView
y el código en la función de inicialización (mv es mi instancia de 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);
pero esto no funciona cuando se ejecuta en el Pi. Obtengo el siguiente seguimiento de la pila
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)
También probé la solución recomendada con execstack y el problema sigue ahí.