-
Bug
-
Resolution: Fixed
-
P3
-
jfx11, jfx17, jfx18
-
x86_64
-
windows_10
ADDITIONAL SYSTEM INFORMATION :
Windows 10 21H1, JDK jdk-17.0.2 x64, JFX 17.0.2
A DESCRIPTION OF THE PROBLEM :
Some of the screen capture videos which we produce cannot be played in JavaFX-based players on windows. The issue appears to depend on the video size. Since we are recording screen capture, we cannot pick a "nice and clean" video size, it has to match the screen resolution.
I have tracked it down to a handler for a recoverable DirectShow error in modules/javafx.media/src/main/native/gstreamer/plugins/dshowwrapper/dshowwrapper.cpp. That handler is enabled only "if ((width < height) || (width > 1920 && height > 1080))", but we seem to require it for smaller and non-portrait videos too. I have built my own version of JavaFX module where the handler was always enabled, which has resolved the problem.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Play the video at
<link>
with any JavaFX player, eg. the simplistic one attached here.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The window opens and the video is played back inside it.
ACTUAL -
No errors, but no video either, just a blank window.
---------- BEGIN SOURCE ----------
import java.io.File;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.beans.binding.Bindings;
import javafx.beans.property.DoubleProperty;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;
public class FXPlayer extends Application {
@Override
public void start(Stage stage) {
File videoFile = new File( FXPlayer.args[0] );
MediaView mediaView = new MediaView();
DoubleProperty width = mediaView.fitWidthProperty();
DoubleProperty height = mediaView.fitHeightProperty();
width.bind( Bindings.selectDouble( mediaView.sceneProperty(), "width" ) );
height.bind( Bindings.selectDouble( mediaView.sceneProperty(), "height" ) );
mediaView.setPreserveRatio( true );
MediaPlayer mediaPlayer = new MediaPlayer( new Media( videoFile.toURI().toString() ) );
mediaPlayer.setMute( true );
mediaView.setMediaPlayer( mediaPlayer );
mediaPlayer.play();
StackPane root = new StackPane();
root.getChildren().add( mediaView );
Scene scene = new Scene(root, 640, 480);
stage.setScene(scene);
stage.show();
}
private static String[] args;
public static void main(String[] args) {
if ( args.length < 1 ) {
return;
}
FXPlayer.args = args;
launch();
}
}
---------- END SOURCE ----------
FREQUENCY : always
Windows 10 21H1, JDK jdk-17.0.2 x64, JFX 17.0.2
A DESCRIPTION OF THE PROBLEM :
Some of the screen capture videos which we produce cannot be played in JavaFX-based players on windows. The issue appears to depend on the video size. Since we are recording screen capture, we cannot pick a "nice and clean" video size, it has to match the screen resolution.
I have tracked it down to a handler for a recoverable DirectShow error in modules/javafx.media/src/main/native/gstreamer/plugins/dshowwrapper/dshowwrapper.cpp. That handler is enabled only "if ((width < height) || (width > 1920 && height > 1080))", but we seem to require it for smaller and non-portrait videos too. I have built my own version of JavaFX module where the handler was always enabled, which has resolved the problem.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Play the video at
<link>
with any JavaFX player, eg. the simplistic one attached here.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The window opens and the video is played back inside it.
ACTUAL -
No errors, but no video either, just a blank window.
---------- BEGIN SOURCE ----------
import java.io.File;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.beans.binding.Bindings;
import javafx.beans.property.DoubleProperty;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;
public class FXPlayer extends Application {
@Override
public void start(Stage stage) {
File videoFile = new File( FXPlayer.args[0] );
MediaView mediaView = new MediaView();
DoubleProperty width = mediaView.fitWidthProperty();
DoubleProperty height = mediaView.fitHeightProperty();
width.bind( Bindings.selectDouble( mediaView.sceneProperty(), "width" ) );
height.bind( Bindings.selectDouble( mediaView.sceneProperty(), "height" ) );
mediaView.setPreserveRatio( true );
MediaPlayer mediaPlayer = new MediaPlayer( new Media( videoFile.toURI().toString() ) );
mediaPlayer.setMute( true );
mediaView.setMediaPlayer( mediaPlayer );
mediaPlayer.play();
StackPane root = new StackPane();
root.getChildren().add( mediaView );
Scene scene = new Scene(root, 640, 480);
stage.setScene(scene);
stage.show();
}
private static String[] args;
public static void main(String[] args) {
if ( args.length < 1 ) {
return;
}
FXPlayer.args = args;
launch();
}
}
---------- END SOURCE ----------
FREQUENCY : always