3

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)

Denys Klymenko
  • 394
  • 5
  • 18
  • 1
    Clearly from the errors you quote, the http URL is being treated as a local file. This is probably a bug in the version of vlcj you are using, but I think you are using an ancient version. Try it with the latest version. – caprica Nov 04 '15 at 17:19

1 Answers1

4

Have you tried preparing the mrl first?

mediaPlayer.prepareMedia(filePath);
//mediaPlayer.setPlaySubItems(true);
mediaPlayer.play();
Stefan
  • 12,108
  • 5
  • 47
  • 66
  • thanks, just tried - this not works( Here is full code in [gist](https://gist.github.com/progsmile/df048999b24b54d7083e) – Denys Klymenko Nov 04 '15 at 13:21
  • 1
    An example of my version can be found [in this question](http://stackoverflow.com/questions/16962013/play-an-avi-video-file-in-java-swing/16962305#16962305). Its using vlcj 3.7.0 and the latest [vlc](http://download.videolan.org/pub/videolan/vlc/last/) (in my case 64bit, according to the jvm version). – Stefan Nov 04 '15 at 14:33
  • I have such jars in the project, thay are: jna-3.0.4.jar, platform-3.4.0.jar, vlcj-2.1.0.jar. What packages do you use? – Denys Klymenko Nov 04 '15 at 14:42
  • 1
    I use: [vlcj 3.7](http://mvnrepository.com/artifact/uk.co.caprica/vlcj), [jna 3.5.2](http://mvnrepository.com/artifact/net.java.dev.jna/jna) and [platform 3.5.2](http://mvnrepository.com/artifact/net.java.dev.jna/platform). You Vlcj looks like an old one ;) – Stefan Nov 04 '15 at 15:22
  • 2
    Playing sub-items is not needed for an HTTP stream. Preparing the media then playing it is essentially the same thing too. – caprica Nov 04 '15 at 17:17