需要播放没有任何音频的rtp视频,对于音频,我必须添加一个不同的音频,该音频也是@rtp,因此需要同时播放两者 下面的代码播放@rtp流(视频),现在我也想同步播放也是rtp的音频。
public static void main( String[] args )
{
NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(),
NATIVE_LIBRARY_SEARCH_PATH);
System.out.println(LibVlc.INSTANCE.libvlc_get_version());
String media = "rtp://@239.255.255.10:5004";
MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory(args);
EmbeddedMediaPlayer mediaPlayer =
mediaPlayerFactory.newEmbeddedMediaPlayer();
Canvas canvas = new Canvas();
canvas.setBackground(Color.red);
CanvasVideoSurface videoSurface =
mediaPlayerFactory.newVideoSurface(canvas);
mediaPlayer.setVideoSurface(videoSurface);
JFrame f = new JFrame("vlcj duplicate output test");
f.add(canvas);
f.setSize(800, 600);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
mediaPlayer.playMedia(media);
// Don't exit
try {
Thread.currentThread().join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}