Special character vlcj mlr

I have been chasing this wonderful site for ages. Today, I finally decided to create an account when I ran into a problem.

My problem is a pretty simple launch of vlcj. I have a program that works as an audio player. This is all done, except for one problem that I cannot understand.

When someone tried to play a song with "é" (e with a sharp) in the file path, it seems to be incorrectly translated to the vlcj system.

Example: I ran:

mediaPlayerComponent.getMediaPlayer().playMedia("file:///C:\\test.mp3"); //(where mediaPlayerComponentis my is my local instantiated // EmbeddedMediaPlayerComponent) 

And that is wonderful. But if I run:

 mediaPlayerComponent.getMediaPlayer().playMedia("file:///C:\\é.mp3"); 

He does not start anything.

  • If I call startMedia instead of playMedia, the boolean return value is false.

  • I also tried it without the "file: ///" in front of it, it does not change anything functionally, except when I kill the program, then I get "libdvdread" error messages, such as:

     libdvdread: Could not open C:\?.mp3 with libdvdcss. 

So that the question is short and sweet: how do I put the correct "mrl" to make vlcj play my ".m.mp3". And / or which MediaOptions are needed to parse the correct encoding (I assume my error is here?)

A proactive apology for not providing SSCCE, I do not think this will be relevant. Thank you for your time.

+4
source share
3 answers

After some interlude, I finally found out what went wrong. Furiously, under the windows the international characters arent really understood very well in VLCJ. By adding:

 <jvmarg value="-Dvlcj.log=DEBUG> 

to my ANT -run script, I can suddenly play files with e-sharp. Initially, JVM decoding ends upon initialization.

Hope this helps someone :-)

0
source

This is transparently handled in vlcj 2.4.0, detecting local file names that contain Unicode characters and converting these names to URLs encoded in percent.

So, with current versions of vlcj, you just have to pass your file name containing international characters directly to mediaPlayer.playMedia (...).

0
source

I found a solution here:

https://github.com/caprica/vlcj/issues/415

This work for me on Mac and on windows (vlcj-3.7.0):

  public void play(String mrlPathFile) { // URI encode for avoid non ascii character problem in windows!!! mrlPathFile = new File(mrlPathFile).toURI().toASCIIString().replace("file:/", "file:///"); mediaPlayer.playMedia(mrlPathFile); } 

It would help me anyone :)

0
source

All Articles