Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package sample;
- import javafx.application.Application;
- import javafx.scene.Group;
- import javafx.scene.Scene;
- import javafx.scene.media.Media;
- import javafx.scene.media.MediaPlayer;
- import javafx.scene.media.MediaView;
- import javafx.stage.Stage;
- public class Main extends Application {
- private static MediaView mv = new MediaView();
- private Media media;
- public static void main(String[] args) {
- launch(args);
- }
- @Override
- public void start(Stage stage) throws Exception{
- media = new Media("http://192.168.0.18:8080/stream/video.h264");
- MediaPlayer mp = new MediaPlayer(media);
- mp.setAutoPlay(true);
- mv.setMediaPlayer(mp);
- Group root = new Group(mv);
- Scene scene = new Scene(root, 640, 480);
- stage.setTitle("Pi_Cam");
- stage.setScene(scene);
- stage.show();
- mp.errorProperty().addListener((observable, oldValue, newValue) -> {
- newValue.printStackTrace();
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement