Advertisement
Wotan_Volsung

StartVLC

Jan 8th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.42 KB | None | 0 0
  1. import java.io.File;
  2. import javax.swing.JFileChooser;
  3.  
  4. /*
  5.  * To change this license header, choose License Headers in Project Properties.
  6.  * To change this template file, choose Tools | Templates
  7.  * and open the template in the editor.
  8.  */
  9.  
  10. /**
  11.  *
  12.  * @author Wotan
  13.  */
  14. public class Start {
  15.     private static JFileChooser ourFileSelector = new JFileChooser();
  16.  
  17.     public static void main(String[] args) {
  18.         String vlcPath="",mediaPath="";
  19.         File ourFile;
  20.        
  21.        
  22.         //Analisa qual sistema operacional utilizado:
  23.         String OS = System.getProperty("os.name").toLowerCase();
  24.         if(OS.contains("win")) {
  25.             vlcPath = "VLC/VLCWindows/";  
  26.         } else if ((OS.contains("nix") || OS.contains("nux") || OS.contains("aix"))) {
  27.             vlcPath = "/usr/include/vlc";
  28. //            ourFileSelector.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
  29. //            ourFileSelector.showSaveDialog(null);
  30. //            ourFile = ourFileSelector.getSelectedFile();
  31. //            vlcPath = ourFile.getAbsolutePath();
  32.         }
  33.        
  34.        
  35.         //Seleciona arquivo a ser reproduzido
  36.         ourFileSelector.setFileSelectionMode(JFileChooser.FILES_ONLY);
  37.         ourFileSelector.showSaveDialog(null);
  38.         ourFile = ourFileSelector.getSelectedFile();
  39.         mediaPath = ourFile.getAbsolutePath();
  40.        
  41.         new MediaPlayer(vlcPath, mediaPath).run();
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement