Play live HTTP stream in vlcj

I am trying to use vlcj to play internet radio stations in a project. I played several times with some sample programs, but I can’t get either the sample programs or the programs that I played to play the stream from the URL.

An example of the URL I'm trying to reproduce is: http://network.absoluteradio.co.uk/core/audio/wmp/live.asx?service=vr

Is there anything special I need to do to get vlcj to play this stream? I could not find anything to help in the API. (Assuming this is possible because it can be played through the VLC media player!)

Thank you so much

+3
source share
2 answers

Well, the MRL you provided us with http://network.absoluteradio.co.uk/core/audio/wmp/live.asx?service=vr is an MMS server that can call an ASX (XML) file metafile that can contain at least one subparagraph.

http://all-streaming-media.com/faq/streaming-media/Metafiles-ASX-Advanced-Stream-Redirector.htm

To be able to play this type of streaming media and go through each sub-element, you need to run the following code fragment:

VideoPanel.getMediaPlayer().setRepeat(true);
VideoPanel.getMediaPlayer().setPlaySubItems(true);
VideoPanel.getMediaPlayer().prepareMedia(media, options);

try {
    Thread.sleep(2000);
} catch (InterruptedException e) {
    e.printStackTrace();
}

for(String s: VideoPanel.getMediaPlayer().subItems()) System.out.println(s);
VideoPanel.getMediaPlayer().play();

In the above MRL example, it lists all the subitems as follows:

http://wms.absoluteradio.co.uk/g1/absoluteradio.co.uk/prerolls/ar_account_1310455302_hi.wma
mms://wms.absoluteradio.co.uk/absoluteradio.co.uk/vr_lo?u=
http://wms.absoluteradio.co.uk/absoluteradio.co.uk/vr_lo?u=
mmsu://wms.absoluteradio.co.uk/absoluteradio.co.uk/vr_lo?u=
mmst://wms.absoluteradio.co.uk/absoluteradio.co.uk/vr_lo?u=
mms://wms.absoluteradio.co.uk/absoluteradio.co.uk/prerolls/problems_lo.wma

To stop playing all of them, install the following code snippet:

VideoPanel.getMediaPlayer().setRepeat(false);
VideoPanel.getMediaPlayer().setPlaySubItems(false);
VideoPanel.getMediaPlayer().stop();

: http://code.google.com/p/vlcj/wiki/HowToHandleYouTubeMedia

+1

http . . , , , URL: http://my dns IP- : 8080 8080 - , .

0

Source: https://habr.com/ru/post/1777972/


All Articles