Search code examples
javavideostreamvlcj

vlcj play video from url


need vlcj play video from url, it works with files on disk, but when it couses web - it doestn't work. Test video: http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4

In errors I have this filesystem access error: cannot open file /home/progsmile/Documents/dev/java/trying2/http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4 (No such file or directory) [0x7f9c4801ad18] main access error: File reading failed

//here is part of code
MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory();
EmbeddedMediaPlayer mediaPlayer = mediaPlayerFactory.newEmbeddedMediaPlayer();

//...

String filePath = "http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4";
mediaPlayer.playMedia(filePath);

Please, help)


Solution

  • Have you tried preparing the mrl first?

    mediaPlayer.prepareMedia(filePath);
    //mediaPlayer.setPlaySubItems(true);
    mediaPlayer.play();