Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6791481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:51:06+00:00 2026-05-26T17:51:06+00:00

public void Stream(String FOLDER_PATH, int port){ File myDir = new File(FOLDER_PATH); File[] files =

  • 0
    public void Stream(String FOLDER_PATH, int port){        

    File myDir = new File(FOLDER_PATH);
    File[] files = myDir.listFiles(); 

    if( myDir.exists() && myDir.isDirectory()){               
       do {                  
          System.out.println(files[i]+" ...");
          //File myFile = new File(files[i].getPath());                  
          mediaPlayer.playMedia(files[i].getPath(), 
          ":sout=#rtp{dst=127.0.0.1,port="+String.valueOf(port) +",mux=ts}",
          ":no-sout-rtp-sap", 
          ":no-sout-standard-sap", 
          ":sout-all", 
          ":sout-keep"
          ); 

          i++;

          }while(i< files.length && mediaPlayer.isMediaParsed());
      }    
}

How can I modify this code to make vlcj play(stream) the next file in folder after the current one ends?

I tried different methods but it stops after the first file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:51:06+00:00Added an answer on May 26, 2026 at 5:51 pm

    If you refer to VLC sample uk.co.caprica.vlcj.test.list.TestMediaListEmbeddedPlayer from vlcj-1.2.0-test.jar distribution, this is how it is done:

    /**
     * Example showing how to combine a media list player with an embedded media
     * player.
     */
    public class TestMediaListEmbeddedPlayer extends VlcjTest {
    
        public static void main(String[] args) throws Exception {
            MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory();
    
            Canvas canvas = new Canvas();
            canvas.setBackground(Color.black);
            CanvasVideoSurface videoSurface = mediaPlayerFactory.newVideoSurface(canvas);
    
            EmbeddedMediaPlayer mediaPlayer = mediaPlayerFactory.newEmbeddedMediaPlayer();
            mediaPlayer.setVideoSurface(videoSurface);
    
            MediaListPlayer mediaListPlayer = mediaPlayerFactory.newMediaListPlayer();
    
            mediaListPlayer.addMediaListPlayerEventListener(new MediaListPlayerEventAdapter() {
                @Override
                public void nextItem(MediaListPlayer mediaListPlayer, libvlc_media_t item, String itemMrl) {
                    System.out.println("nextItem()");
                }
            });
    
            mediaListPlayer.setMediaPlayer(mediaPlayer); // <--- Important, associate the media player with the media list player
    
            JPanel cp = new JPanel();
            cp.setBackground(Color.black);
            cp.setLayout(new BorderLayout());
            cp.add(canvas, BorderLayout.CENTER);
    
            JFrame f = new JFrame("vlcj embedded media list player test");
            f.setIconImage(new ImageIcon(TestMediaListEmbeddedPlayer.class.getResource("/icons/vlcj-logo.png")).getImage());
            f.setContentPane(cp);
            f.setSize(800, 600);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setVisible(true);
    
            MediaList mediaList = mediaPlayerFactory.newMediaList();
            String[] options = {};
            mediaList.addMedia("C:\\Documents and Settings\\DEVELOPER\\Desktop\\videoplayback1.mp4", options);
            mediaList.addMedia("C:\\Documents and Settings\\DEVELOPER\\Desktop\\videoplayback2.mp4", options);
    
            mediaListPlayer.setMediaList(mediaList);
            mediaListPlayer.setMode(MediaListPlayerMode.LOOP);
    
            mediaListPlayer.play();
    
            // This looping is just for purposes of demonstration, ordinarily you would
            // not do this of course
            for(;;) {
                Thread.sleep(500);
                mediaPlayer.setChapter(3);
    
                Thread.sleep(5000);
                mediaListPlayer.playNext();
            }
    
            //    mediaList.release();
            //    mediaListPlayer.release();
            //    mediaPlayer.release();
            //    mediaPlayerFactory.release();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following method: public void PutFile(string ID, Stream content) { try {
public void test() { List<int> list = new List<int>(); list.Add(1); list.Add(2); list.Add(3); for (int
public static void ReadWholeArray (Stream stream, byte[] data) { int offset=0; int remaining =
public static void ListFolders() { HomeFolderListing = new List<string>(); ReportingServiceSoapClient rs = new ReportingServiceSoapClient();
public void Save() { XmlSerializer Serializer = new XmlSerializer(typeof(DatabaseInformation)); /* A first chance exception
public void EatDinner(string appetizer, string mainCourse, string dessert) { try { // Code }
[TestMethod] public void Memory() { var wr = new WeakReference(aaabbb); Assert.IsTrue(wr.IsAlive); GC.Collect(); GC.Collect(); GC.Collect();
[TestInitialize()] public void MyTestInitialize() { XmlTextWriter writer = new XmlTextWriter(DataFile.xml, Encoding.UTF8); writer.Formatting = Formatting.Indented;
ImageView connect = (ImageView) findViewById(R.id.fconnect); connect.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { facebook.authorize(SignIn.this,
Here's my WCF REST endpoint: [WebInvoke(Method = POST, UriTemplate = _test/upload)] public void UploadImage(Stream

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.