Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. package sample;
  2.  
  3. import javafx.application.Application;
  4. import javafx.scene.Group;
  5. import javafx.scene.Scene;
  6. import javafx.scene.media.Media;
  7. import javafx.scene.media.MediaPlayer;
  8. import javafx.scene.media.MediaView;
  9. import javafx.stage.Stage;
  10.  
  11. public class Main extends Application {
  12.  
  13. private static MediaView mv = new MediaView();
  14. private Media media;
  15.  
  16. public static void main(String[] args) {
  17. launch(args);
  18. }
  19. @Override
  20. public void start(Stage stage) throws Exception{
  21. media = new Media("http://192.168.0.18:8080/stream/video.h264");
  22. MediaPlayer mp = new MediaPlayer(media);
  23. mp.setAutoPlay(true);
  24. mv.setMediaPlayer(mp);
  25. Group root = new Group(mv);
  26. Scene scene = new Scene(root, 640, 480);
  27. stage.setTitle("Pi_Cam");
  28. stage.setScene(scene);
  29. stage.show();
  30. mp.errorProperty().addListener((observable, oldValue, newValue) -> {
  31. newValue.printStackTrace();
  32. });
  33. }
  34.  
  35.  
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement