Advertisement
Wotan_Volsung

MediaPlayer

Jan 8th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.09 KB | None | 0 0
  1. import com.sun.jna.NativeLibrary;
  2. import javax.swing.JFrame;
  3. import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;
  4. import uk.co.caprica.vlcj.runtime.RuntimeUtil;
  5.  
  6. /*
  7.  * To change this license header, choose License Headers in Project Properties.
  8.  * To change this template file, choose Tools | Templates
  9.  * and open the template in the editor.
  10.  */
  11.  
  12. /**
  13.  *
  14.  * @author Wotan
  15.  */
  16. public class MediaPlayer {
  17.     private JFrame ourFrame = new JFrame();
  18.     private EmbeddedMediaPlayerComponent ourMediaPlayer;
  19.     private String mediaPath = "";
  20.    
  21.     MediaPlayer(String vlcPath, String mediaURL) {
  22.         this.mediaPath = mediaURL;
  23.         NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), vlcPath);
  24.         ourMediaPlayer = new EmbeddedMediaPlayerComponent();
  25.         ourFrame.setContentPane(ourMediaPlayer);
  26.         ourFrame.setSize(1280, 800);
  27.         ourFrame.setVisible(true);
  28.         ourFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  29.     }
  30.  
  31.    
  32.     public void run() {
  33.         ourMediaPlayer.getMediaPlayer().playMedia(mediaPath);
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement