Search code examples
javastreaminglibvlcvlcj

vlcj libvlc streaming desktop stops after sometime


I am trying to stream desktop using vlcj. But the streaming stops after 13 or 15 seconds.

public static void main(String[] args) throws IOException, InterruptedException {


NativeLibrary.addSearchPath("libvlc", WindowsRuntimeUtil.getVlcInstallDir());

String media = "screen://";

String [] options ={ ":sout =#transcode{vcodec=h264,vb=56,fps=12,scale=0.5,width=176,height=144,acodec=mp4a,ab=24,channels=1,samplerate=44100} :rtp{sdp=rtsp://:5544/ok.mp4} :no-sout-rtp-sap :no-sout-standard-sap :ttl=1 :sout-keep"} ;  

System.out.println("Streaming '" + media + "' to '" + options + "'");

MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory();
final HeadlessMediaPlayer mediaPlayer = mediaPlayerFactory.newMediaPlayer();
mediaPlayer.playMedia(media, options);
}

I was setting the options inorder to play the streaming in android 2.2 phones.

I am using 64bit OS Windows 7, 32bit vlc and 32 bit JVM. I think the code is correct..

Can anybody give me a solution for this?

Is this a libvlc issue or vlcj issue??

Or problem for vlc with 64bit OS??

If there is any other solution to stream desktop for playing in android,help is appreciated

Please help me.


Solution

  • I found the solution for this problem.

    The problem is no more when i removed this line

    NativeLibrary.addSearchPath("libvlc", WindowsRuntimeUtil.getVlcInstallDir());
    

    I didn't understand how this got correct after removing this line.