RTSP support library for Javafx - java

I am new to this Javafx. I need to know rtsp supported library for Javafx I knew few of the media library GStreamer and VLCJ. I don't know which will support this features in Javafx. I have read many portals which I cant get an answer. many of them posted you cant run RTSP in Javafx. please guide me which library is best for RTSP that will support for Javafx.
File f = new File("Video.mp4");
new NativeDiscovery().discover();
EmbeddedMediaPlayerComponent playerComponent = new EmbeddedMediaPlayerComponent();
/*I dont know where to add the playerComponent as we do in swing*/
MediaPlayer mp=playerComponent.getMediaPlayer();
StackPane root = new StackPane();
Scene scene = new Scene(root, 700, 700);
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
This is the normal video player in Javafx.

This might be a late answer but I saw the quetsion while I had the same quetsion so check this site out I think it got all the things I have to say https://github.com/mhrimaz/AwesomeJavaFX/blob/master/README.md#frameworks

Related

JXBrowser - How to import BrowserView component into SceneBuilder

I am writing a JavaFX application using JXBrowser. I seem to be having some trouble however figuring out how to add the BrowserView component into Scene Builder.
I have tried importing all of the .jar's into Scene Builder and attempted to create a custom component for it but to no avail.
I have exhausted all of my google fu.
Tested on Scene Builder 8 and 10.
Tested Java Sources 8 through 10.
JxBrowser supports BrowserView import only via the code or FXML file. Import via the SceneBuilder is not supported as specific requirements should be met in order to import BrowserView using SceneBuilder.
Import via the code is performed in the following way. Please check the example below.
#Override
public void start(final Stage primaryStage) {
Browser browser = new Browser();
BrowserView view = new BrowserView(browser);
Scene scene = new Scene(new BorderPane(view), 700, 500);
primaryStage.setScene(scene);
primaryStage.show();
browser.loadURL("http://www.google.com");
}
Import via the FXML file is described in this article, please take a look at the FXML section: https://jxbrowser.support.teamdev.com/support/solutions/articles/9000013071-using-jxbrowser-in-javafx

JavaFX ImageView image not showing

I have an assets folder full of images to implement in a game I'm creating and I want to display these in the window. This is my code so far.
public class javafxtest extends Application {
public void start(Stage primaryStage) throws Exception {
Group root = new Group();
Scene scene = new Scene(root, 600, 600);
Image test = new Image("file:assets/BA.png");
ImageView piece = new ImageView(test);
piece.setX(10);
piece.setY(10);
Rectangle rct = new Rectangle(50, 150, 500, 300);
rct.setFill(Color.GRAY);
root.getChildren().addAll(rct, piece);
primaryStage.setScene(scene);
primaryStage.show();
}
}
This will be for a program to run within IntelliJ/from a jar. The assets folder is in the same directory as this file. I get no file path error so I assume it can find the image, but it doesn't appear on screen and the rectangle does.
Fair warning, I'm learning JavaFX from scratch and I'm finding there's not much explanation as to how things work, so this could be a stupid question.
Accessing the image via the filesystem is the wrong choice when the image is in fact an asset (ie it is distributed along side the .class files that make up your program) because that way you'd have to deal with the installation path (otherwise known as the home path). The correct choice is bundling your image in your JAR, so place your image in the following path:
src/main/resources/assets/BA.png
and access it with:
Image test = new Image("/assets/BA.png");
This is how the file tree should look like in your computer:

Import STL file in JavaFX

My problem is that I am trying to import a 3D model from an STL file to a JavaFX application. I followed the code in this link How to create 3d shape from STL in JavaFX 8? and it's only working with the jewel file mentioned there, but I've tried with other STL files and it's not working!
I can't see why it's not working with the other files. Can anyone explain this?
Any help please, as soon as possible!
As you are already using an STL importer from this site, you will find in the same web a 3D model browser you can use to preview your models before importing them to your JavaFX application.
If they can't be imported with this browser, the problem may be related to a non valid STL format in your files.
If they are imported, then the problem may be in your application. Embed the call in a try-catch and post the exception you may enconter.
StlMeshImporter stlImporter = new StlMeshImporter();
try {
stlImporter.read(this.getClass().getResource("<STLfile>.stl"));
}
catch (ImportException e) {
e.printStackTrace();
return;
}
EDIT
If no exception is thrown while reading the model, the next step would be inserting the returned mesh into a MeshView and show it on our scene:
TriangleMesh mesh = stlImporter.getImport();
stlImporter.close();
MeshView mesh=new MeshView(cylinderHeadMesh);
Group root = new Group(mesh);
Scene scene = new Scene(root, 1024, 800, true);
Camera camera = new PerspectiveCamera();
scene.setCamera(camera);
primaryStage.setScene(scene);
primaryStage.show();
Since the model could be too small or too big for our scene (related to the camera and the point of view we are using), we should print the bounding box of our model, and then scale it up or down accordingly:
System.out.println("mesh: "+mesh.getBoundsInLocal().toString());
mesh.setScaleX(1d);
mesh.setScaleY(1d);
mesh.setScaleZ(1d);
Or we could change the camera parameters:
double max = Math.max(mesh.getBoundsInLocal().getWidth(),
Math.max(mesh.getBoundsInLocal().getHeight(),
mesh.getBoundsInLocal().getDepth()));
camera.setTranslateZ(-3*max);

Creating a control seems to break transparent stages on JFX8

The above program should create a transparent stage with some text, but the stage appears opaque:
public class Test extends Application {
#Override
public void start(Stage primaryStage) {
new TextArea(); //Comment this out to enable transparency
Stage stage = new Stage();
stage.initStyle(StageStyle.TRANSPARENT);
Text text = new Text("Is this transparent?");
VBox box = new VBox();
box.getChildren().add(text);
final Scene scene = new Scene(box, 300, 250);
scene.setFill(null);
stage.setScene(scene);
stage.show();
}
}
The new TextArea() line is what breaks things - comment that out and it all works.
Creating any subclass of control (even via new Control() {};) breaks things - a Region or above does not.
This doesn't occur in Java 7 / JFX2.x.
I've created a JIRA for this since it seems a very obvious regression (https://javafx-jira.kenai.com/browse/RT-38938), but is anyone aware why this happens and thus how to work around it until a fix is provided? I've tried replicating this issue by copying the code in Control's constructor, but this seems to be fine - it's just instantiating Control itself that seems to break things.
I remember some forum discussion on this. I think the general gist is that creating a control forces css to be applied to the layout pane, and the layout pane is getting the opaque background.
As a workaround, make the background of the layout pane transparent:
box.setStyle("-fx-background-color: transparent;");

Java Fx whole Application in fullscreen

I want to create an Fullscreen Application on an RasperryPI.
But now i have a problem with the fullscreen mode, because everytime if I switch sites I must set the FullSreen property false and then true otherwise the window won't get fullscreen.
But if I switch the site the window is shortly not fullscreen and the it is fullscreen.
SplitPane splitPane = new SplitPane();
splitPane.setOrientation(Orientation.VERTICAL);
splitPane.getItems().addAll(table,vbLayout);
Scene scene = SceneBuilder.create().root(splitPane). build();
primaryStage.setScene(scene);
primaryStage.show();
primaryStage.sizeToScene();
primaryStage.setFullScreen(false);
primaryStage.setFullScreen(true);
I hope you understand what i mean.
Best wishes
Johannes
You should not be able to switch sites when you are in fullscreen mode. If you are able to, you must first stop it. The user must come back to normal mode before doing anything else or you must force the normal mode. It's just like playing a video on fullscreen mode on youtube.
You Can Use Follwing Code:-
I Have Use Rectangle 2D Class
SplitPane splitPane = new SplitPane();
splitPane.setOrientation(Orientation.VERTICAL);
splitPane.getItems().addAll(table,vbLayout);
Rectangle2D primScreenBounds = Screen.getPrimary().getVisualBounds();
Scene scene = SceneBuilder.create().root(splitPane). build();
scence.setWidth(primScreenBounds.getWidth());
scence.setHeight(primScreenBounds.getHeight())
primaryStage.setScene(scene);
primaryStage.show();

Categories

Resources