-2
public class VlcTest extends VlcjTest {
public static void main(String[] args) throws Exception {
if(args.length != 1) {
System.out.println("Specify a single MRL to stream");
System.exit(1);
}
NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), "C:\\Program Files\\VideoLAN\\VLC");
Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
String media = args[0];
String [] options = formatHttpStream("127.0.0.1", 5080);
System.out.println("Streaming '" + media + "' to '" + options + "'");
MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory(args);
HeadlessMediaPlayer mediaPlayer = mediaPlayerFactory.newHeadlessMediaPlayer();
mediaPlayer.playMedia(media, options);
// Don't exit
Thread.currentThread().join();
}
private static String [] formatHttpStream(String serverAddress, int serverPort) {
String [] sb={":sout = #duplicate{dst=std{access=http,mux=ts,dst=127.0.0.1:5080}}"};
return sb;
}
}
我想確認,可以在這個代碼能夠流從視頻服務器到客戶端。我想實現的流程是:
- 客戶端發送請求到服務器的流
- Server創建連接到客戶端發送的視頻在基於客戶端的IP地址和端口號的報文。
昨天你不是問這個問題嗎? [視頻流在vlcj](http://stackoverflow.com/questions/11343523/video-streaming-in-vlcj) – 2012-07-06 21:28:34