How do i use the VLC to auto replay as loop?
Question
VLC how can i apply auto loop of the given content while using with options? Following did not work to loop.
private void start() {
frame.setVisible(true);
String mrl = "file:///home/sun/Downloads/t1.avi";
// fails
// String[] options = {
// "--loops",
// "--repeat",};
///Applications/VLC.app/Contents/MacOS/VLC -vv qtcapture:// --sout='#transcode{vcodec=h264,vb=768,fps=25.0,scale=1}:standard{access=udp,mux=ts{dts-delay=9000},dst=239.0.0.5}'
//mediaPlayer.playMedia(mrl, options);
//String[] options = {"--loops"};
// no luck fails too
mediaPlayer.playMedia(mrl,
":sout ':standard{loop}'");
}
Solution
If you use VLCJ
, I suggest that you to call mediaPlayer.setRepeat(true);
It works in my VLCJ project as follows:
mediaPlayer.setRepeat(true);
mediaPlayer.setPlaySubItems(true);
mediaPlayer.playMedia(mrl, options);
Tested with with JRE 1.6 32-bit
:
VLCJ 1.2.0
+ VLC enginelibVLC 1.1.11
(Windows 32-bit)VLCJ 2.1.0-SNAPSHOT
+ nightly build VLC enginelibVLC 2.1.0
(Windows 32-bit)
OTHER TIPS
I believe you had a typo; the documented option is "--loop".
The following is all that is needed:
vlc --loop video.mp4
To do this from Java, you could:
public class Player {
public static final void main(String args[]) {
try {
Runtime.getRuntime().exec("vlc --loop "+args[0]);
} catch (Exception e) {
System.out.println(e.toString());
}
}
}
and then:
java Player filename.mp4
In the latest version, no need for complex scripting. Click on TOOLS > PREFERENCES. Look bottom left of interface, "Show settings" radio button should be set to "ALL". Look at left Panel, click on "Playlist". Check/Tick "Repeat All" CHECKBOX.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow