Vlcj-java Write a player

Source: Internet
Author: User

Have to sigh Java is the best source of Open-source spirit, in the arduous struggle still cannot compile run LIBVLC (based on VC), the internet found VLCJ English articles, is VLC Java-oriented API, a little bit of a sledgehammer.

1. Please download and install VLC Media Player 2.0.7 on the Internet.

2. Create a new Java project and download the Java package you need to use.


3. Paste the following code under one of the packet below your SRC

Package com.xing;
Import Javax.swing.JFrame;

Import javax.swing.SwingUtilities;

    Import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;

        public class Tutorial2b {private final embeddedmediaplayercomponent mediaplayercomponent; 
                public static void Main (string[] args) {Swingutilities.invokelater (new Runnable () {@Override
                public void Run () {new tutorial2b ();
        }
            });

            Private tutorial2b () {JFrame frame = new JFrame ("VLCJ Tutorial");

            Mediaplayercomponent = new Embeddedmediaplayercomponent ();

            Frame.setcontentpane (mediaplayercomponent);
Frame.setlocation (100, 100);
            Frame.setsize (600, 400);
            frame.setdefaultcloseoperation (jframe.exit_on_close);

            frame.setvisible (true); &nbsP           Mediaplayercomponent.getmediaplayer () PlayMedia ("D:\\a.mp4");/
 An existed media file}}
4. Run, because VLCJ is based on JNA, to invoke the VLC-related DLL file, you need to configure the run parameters:


Run around and enjoy the player you wrote.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.