Hi! I’m using PApplet
inside Eclipse (A college assignment requires that we use Processing IDE but I need some of Java functions to make it work the way I envision it) and everytime a video starts playing (through javafx) it takes over the whole program screen.
Even though I call a rectangle, for exemple, after I call the video to start, it still takes over the entire screen and I can’t see this rectangle. How can I solve this?
public class UsingProcessing extends PApplet {
String Dir = System.getProperty("C:\\Users\\Matheus\\eclipse-workspace\\Narraint");
Stage stage;
ZonedDateTime now = ZonedDateTime.now();
LocalDateTime startOfDay = now.toLocalDate().atStartOfDay();
java.time.Duration d = java.time.Duration.between(startOfDay,now);
javafx.util.Duration duration = new javafx.util.Duration( d.toMillis());
public static void main(String[] args) {
PApplet.main("UsingProcessing");
}
public void settings() {
size(1100, 618,FX2D);
}
public void setup() {
try {
Field field = PSurfaceFX.class.getDeclaredField("stage");
field.setAccessible(true);
stage = (Stage)field.get(surface);
File f = new File(Dir, "narrativas.mp4");
Media media = new Media(f.toURI().toURL().toString());
javafx.scene.media.MediaPlayer player = new javafx.scene.media.MediaPlayer(media);
MediaView viewer = new MediaView(player);
DoubleProperty width = viewer.fitWidthProperty();
DoubleProperty height = viewer.fitHeightProperty();
width.bind(Bindings.selectDouble(viewer.sceneProperty(), "width"));
height.bind(Bindings.selectDouble(viewer.sceneProperty(), "height"));
viewer.setPreserveRatio(true);
StackPane root = new StackPane();
root.getChildren().add(viewer);
Scene scenes = new Scene(root, 1100, 618, Color.TRANSPARENT);
stage.setScene(scenes);
stage.setTitle("OBSV.CamFeed.6°07'08.3\"S 12°23'51.5\"E");
stage.setFullScreen(false);
stage.show();
player.setStartTime(duration);
player.setCycleCount(MediaPlayer.INDEFINITE);
player.play();
}
catch(Exception e) {
e.printStackTrace();
}
}
public void draw() {
rect(30, 20, 80, 50); //Just for testing, if anything can show up in
//front of the video then my problem is solved!
}
}