Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Unable to play video in JPanel using vlcj in ubuntu 13.04

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Unable to play video in JPanel using vlcj in ubuntu 13.04

    I am trying to play video in JPanel using vlcj in ubuntu, there is no error. My project builts successfully. but do not plays video. when i run code JFrame comes for a while. when i use same code in windows. it plays video and works successfully, but not in ubuntu.

    In output window , it show following

    A fatal error has occured in java runtime enviournment.
    (and so many things.)




    Following is my code : (i am using vlcj-3.0.1)

     
    import com.sun.jna.NativeLibrary;
    import java.awt.BorderLayout;
    import java.io.File;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;
    import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer;
     
     
     
     
         class PlayerPanel extends JPanel {
     
         private File vlcInstallPath = new File("---------------Path of vlc player (installed) --------------");
         private EmbeddedMediaPlayer player;
     
         public PlayerPanel() {
     
     
            NativeLibrary.addSearchPath("libvlc", vlcInstallPath.getAbsolutePath()); 
             EmbeddedMediaPlayerComponent videoCanvas = new EmbeddedMediaPlayerComponent();
             this.setLayout(new BorderLayout());
             this.add(videoCanvas, BorderLayout.CENTER);
             this.player = videoCanvas.getMediaPlayer();
         }
     
         public void play(String media) {
             player.prepareMedia(media);
             player.parseMedia();
             player.play();
         }
     }
     
     class VideoPlayer extends JFrame {
     
         public VideoPlayer() {
              PlayerPanel player = new PlayerPanel();
              this.setTitle("Swing Video Player");
              this.setDefaultCloseOperation(EXIT_ON_CLOSE);
              this.setLayout(new BorderLayout());
              this.setSize(640, 480);
              this.setLocationRelativeTo(null);
              this.add(player, BorderLayout.CENTER);
              this.validate();
              this.setVisible(true);
     
             player.play("---------------Path of video we want to play ----------------------");
         }
     
          public static void main(String[] args) {
              new VideoPlayer();
          }
     }


    And plz tell me which path to give for vlc player in ubuntu. there are more than 5 folders with name vlc. one is in /usr/share/ and other is in /etc/ and so on.


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 697 Times in 679 Posts

    Default Re: Unable to play video in JPanel using vlcj in ubuntu 13.04

    elcome to the forum! Thanks for taking the time to learn how to post code correctly. If you haven't already, please read this topic to learn other useful info for new members.

    The "and many things" might be important. Post 10 to 20 lines of that.

Similar Threads

  1. unable to get idle time using JNA for ubuntu 11.10 onwards
    By raaz_0123 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 22nd, 2013, 02:37 AM
  2. Problem is trying to play a video from Webcam using JMF
    By srinithegr8 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 13th, 2013, 10:42 AM
  3. embed yotube video into JPanel
    By gammaman in forum AWT / Java Swing
    Replies: 0
    Last Post: May 7th, 2012, 09:46 AM
  4. Unable to add JPanel to JScrollPane
    By nenay in forum AWT / Java Swing
    Replies: 8
    Last Post: February 25th, 2012, 02:10 PM
  5. Unable to render printing the complete JPanel
    By Stephen Douglas in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 13th, 2010, 10:48 AM

Tags for this Thread