JDK-8214433 : Media is not Working, crashing whole application
  • Type: Bug
  • Component: javafx
  • Sub-Component: media
  • Affected Version: 8u192
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86_64
  • Submitted: 2018-11-26
  • Updated: 2021-05-08
  • Resolved: 2021-05-08
Related Reports
Relates :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
Fedora 27 64-bit, Java 8u192 (also tested with 191(x86) and 202(x86) and 121(x64) )
16 gb ram.

A DESCRIPTION OF THE PROBLEM :
Hi, i`m using JavaFX. When i trying to create a media - i have an error occured:

/usr/java/jdk1.8.0_192/bin/java: symbol lookup error: /usr/java/jdk1.8.0_192/jre/lib/i386/libglib-lite.so: undefined symbol: ffi_prep_cif_machdep

and application instantly crash!
application startup script: ${JAVA} ${DEBUG} ${LOGGER_OPT} ${LOCALES} ${SPLASH} -classpath ${CP} me.bogdan.Application 2>>${APPLICATION_HOME}/tmp/err.out
So this error visible only in err.out file.

Tried many flv, mp4 and mp3 files. Problem with libglib-lite.so. When i deleted this lib - error changed to FileNotFound and no crash, only exception.

Also tried to use 191 and 202(dev) builds.

And also i tried to use x64 java (build 121) - unsupported format exception. much better that crash, but i need to use x86 version to use special driver libs.

Okay, i tried -Djfxmedia.loglevel=DEBUG flag. What i got:

URL: file:/opt/pos/etc/selfcheckout/test.mp4
Debug (0:00:00:000): Logger initialized
Debug (0:00:00:005): Enabled JFXMedia platforms: 
   - com.sun.media.jfxmediaimpl.platform.java.JavaPlatform
   - com.sun.media.jfxmediaimpl.platform.gstreamer.GSTPlatform
Debug (0:00:00:005): JFXMedia supported protocols:
    file
    http
    https

Debug (0:00:00:011): Getting content types from platform: com.sun.media.jfxmediaimpl.platform.java.JavaPlatform@3bff54
Debug (0:00:00:011): Getting content types from platform: com.sun.media.jfxmediaimpl.platform.gstreamer.GSTPlatform@13a50cb
Debug (0:00:00:011): JFXMedia supported content types:
    audio/x-aiff
    audio/mp3
    audio/mpeg
    audio/x-wav
    video/x-javafx
    video/x-flv
    video/x-fxm
    video/mp4
    audio/x-m4a
    video/x-m4v
    application/vnd.apple.mpegurl
    audio/mpegurl

Debug (0:00:00:020): Initializing GSTPlatform
Debug (0:00:00:043): CLocator::CLocator()
Debug (0:00:00:043): CLocatorStream::CLocatorStream()

end. application is crashing here. 

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
use the same enviroment (Linux x64, Java8u202 x86)

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
create Media object, add it to media view as child, play
ACTUAL -
crash on media <init>

---------- BEGIN SOURCE ----------
try {
            try{
                File video = new File("/opt/app/etc/resources/test.mp3");
                String url = video.toURI().toURL().toString();
                System.out.println("URL: "+url);
                currentPlayingMedia = new Media(url);
            }catch(Exception e){
              System.err.println(e.toString());
            }
            player = new MediaPlayer(currentPlayingMedia);

    }catch (Throwable e) {
      e.printStackTrace(System.out);
    }
---------- END SOURCE ----------

FREQUENCY : always



Comments
Additional Information from Submitter: ----------------------------------------------------- Not reproduced on Ubuntu, reproduced on Fedora, not reporoduced on another Fedora. (me and my friend have the same laptops and installed the same OS from one ISO file) Also it`s reproduced on Suse Linux Can`t understand what is it. Okay, what happened. When JavaFX is initialized (i have JFXPanel on Swing APP) - i`m creating first scene (no FXML, only code) and setting this scene to JFXPanel. This scene contain mp4 video in right part of this scene. It`s playing and seems everything is okay. In some PCs it`s not reacting on click events and throws exception, in some - everything is good. I found the line where exception is throwed: https://github.com/javafxports/openjdk-jfx/blob/94b76ad311de3f2665376513a9735803c90cd251/modules/javafx.graphics/src/main/java/javafx/scene/Scene.java#L3474 The problem is, that QuantoomToolkit . getApplication - returns GTKApplication. And GTKApplication have this method: @Override protected native long staticView_getMultiClickTime(); This method is native. And while we are not adding video on scene - it`s returns my system value (350) And if MediaView is added to scene - it`s returns -1 (looks like native library exception?) And the strangest thing is: What if add MediaView on scene after scene is created and already displayed? The problem still here. What if add MediaView on scene after FIRST CLICK EVENT is delivered to this scene? THE PROBLEM IS GONE! Code: private class ClickEventHandler implements EventHandler<MouseEvent>{ boolean firstClickOnJavaFX = false; @Override public void handle(MouseEvent event) { if(firstClickOnJavaFX == false) { Timeline videoTimer = new Timeline(); videoTimer.getKeyFrames().add( new KeyFrame(Duration.millis(100), new MP4VideoStarter())); videoTimer.play(); firstClickOnJavaFX = true; } } } private class MP4VideoStarter implements EventHandler<ActionEvent>{ @Override public void handle(ActionEvent event) { try { player = new MediaPlayer(new Media(getFxResourceLoader().getMP4VideoURL("kawa.mp4"))); MediaView mv = new MediaView(player); mv.setFitWidth(400); mv.setFitHeight(screenSize.height); mv.setPreserveRatio(false); HBox playerBox = new HBox(mv); playerBox.setAlignment(Pos.TOP_RIGHT); mainView.add(playerBox, 1, 0); //it`s GridPane - root element on Scene player.setMute(true); player.play(); player.setCycleCount(MediaPlayer.INDEFINITE); } catch (Throwable e) { //todo:?? } } } and just add this to main View mainView.addEventHandler(MouseEvent.MOUSE_CLICKED, new ClickEventHandler()); Try to play with TimeLine videoTimer. start timer after scene creation and start play video - exceptions. Wait for first click and then add video and start playing it - everything is ok. Remove all handlers, add MediaView directly without any delays. - exceptions. So, the problem is in native method? Maybe it`s great idea, to check what this method is returned? If <=0 - set it to 350 (this value is default for many systems) ---------------------------------------------------------------------
07-12-2018

Looks like regression from JDK-8199527.
01-12-2018

Additional information from Submitter: --------------------------- > Okay, i missed some libraries. Just intalled this rpm ffmpeg-libs-3.3.9-1.fc27.i686 And now everything is okay, no crash, no errors. But it`s realy strange that application running 32bit Java is crashing and 64bit Java is throwing exception. >Okay, now media is working. Some of mp4 have wrong colors, but i thinks it`s installed codec problem. But new problem appears: When i have MediaView on scene - JavaFX throwing exception and not reacting on click events. I have button in left part of GridPane and Media in right part. I can hover button, focus, but i can`t click it. Without MediaView - everything is okay. Exception: Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: The time is invalid. at javafx.animation.KeyFrame.<init>(KeyFrame.java:189) at javafx.animation.KeyFrame.<init>(KeyFrame.java:226) at javafx.scene.Scene$ClickCounter.start(Scene.java:3380) at javafx.scene.Scene$ClickCounter.access$7400(Scene.java:3335) at javafx.scene.Scene$ClickGenerator.preProcess(Scene.java:3430) at javafx.scene.Scene$ClickGenerator.access$7900(Scene.java:3398) at javafx.scene.Scene$MouseHandler.process(Scene.java:3738) at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485) at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762) at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494) at com.sun.javafx.tk.quantum.EmbeddedScene.lambda$null$235(EmbeddedScene.java:256) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.tk.quantum.EmbeddedScene.lambda$mouseEvent$236(EmbeddedScene.java:244) at com.sun.javafx.application.PlatformImpl.lambda$null$403(PlatformImpl.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$404(PlatformImpl.java:294) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at com.sun.glass.ui.gtk.GtkApplication.lambda$null$142(GtkApplication.java:245) at java.lang.Thread.run(Thread.java:748) Code: GridPane mainView = new GridPane(); mainView.getColumnConstraints().add(new ColumnConstraints(600); mainView.getColumnConstraints().add(new ColumnConstraints(600); mainView.getRowConstraints().add(new RowConstraints(1000); try { player = new MediaPlayer(new Media(new File("/path/toyour/mp4/video.mp4").toURI().toURL().toString())); MediaView mv = new MediaView(player); HBox playerBox = new HBox(mv); playerBox.setAlignment(Pos.TOP_RIGHT); mainView.add(playerBox, 1, 0); player.setCycleCount(MediaPlayer.INDEFINITE); player.play(); } catch (MalformedURLException e) { e.printStackTrace(); } Button unlockBtn = new Button("unlock"); unlockBtn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { System.out.println("Hello"); } }); mainView.add(unlockBtn, 0, 0); Scene scene = new Scene(mainView, 1200, 1000, Color.WHITE); ------------------------------------------------------------------------
28-11-2018

Submitter's response: -------------------------------- Yes, seems like i don`t have libav installed, but it`s strange, that my app is crashing without throwing any exception. Also i have gstreamer1-libav.x86_64 1.12.4-1.fc27" installed this package provide video/audio codecs support (everything is working good on this pc, music player, video player (playing mp4, flv, avi, mkv, etc...)), but not for JavaFX Media class. also there is no libav packages in Fedora repos, (libavcodec and libavformat) ----------------------------------
28-11-2018

Looks something missing on Submitter's machine. Requested Submitter to provide list of installed packages matching "libav*" Marking Incomplete pending for more information.
27-11-2018