0
wowza服務器我最近在做一個項目,發佈視頻wowza服務器。我能夠使用JUV rtmp客戶端API從文件發佈視頻。但我需要直接從我的筆記本電腦攝像頭髮布視頻。我怎麼能這樣做?請用示例或演示來解釋。流的筆記本電腦的攝像頭,與JUV RTMP客戶
我的代碼的視頻流文件主要部分是在這裏:
final NetConnection connection = new NetConnection();
connection.configuration().put(NetConnection.Configuration.INACTIVITY_TIMEOUT, -1);
connection.configuration().put(NetConnection.Configuration.IO_TIMEOUT, 20 /*milliseconds*/);
connection.addEventListener(new NetConnectionListener());
connection.connect("rtmp://localhost:1935/live");
try
{
Thread.sleep(2000);
}
catch (Exception e) {/*ignore*/}
// wait till connected
System.out.println("then connection: "+connection.connected());
final MediaStreamController controller = new MediaStreamController();
final String streamFile = "C://media/JUV.FLV";
controller.addListener(new IMediaStreamController.ListenerAdapter()
{
@Override
public void onStart(final long timestamp, final IMediaStream stream)
{
System.out.println("onStart: " + timestamp + " " + stream);
}
@Override
public void onStop(final long timestamp, final IMediaStream stream)
{
System.out.println("onStop: " + timestamp + " " + stream);
if (stream != null)
{
stream.release();
}
try
{
controller.play(new FlvFileMediaStream(streamFile), -1 /*play the whole file*/);
}
catch (Exception e)
{
e.printStackTrace();
}
}
@Override
public void onRelease(final long timestamp)
{
System.out.println("onRelease: " + timestamp);
}
});
if (!disconnected)
{
NetStream stream = new NetStream(connection);
stream.addEventListener(new NetStream.ListenerAdapter()
{
@Override
public void onNetStatus(final INetStream source, final Map<String, Object> info)
{
System.out.println("NetStream#onNetStatus: " + info);
final Object code = info.get("code");
if (NetStream.PUBLISH_START.equals(code))
{
try
{ System.out.println("playing: ");
controller.play(new FlvFileMediaStream(streamFile), -1 /*play the whole file*/);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
});
stream.attachAudio(new MediaStreamMicrophone(controller));
stream.attachCamera(new MediaStreamCamera(controller), -1);
stream.publish("stream", NetStream.LIVE);
}
while (!disconnected)
{
try
{
Thread.sleep(100);
}
catch (Exception e) {/*ignore*/}
}
connection.close();
}
。@沃德,其實我應該預先指出,我需要做的是programmatically.A的Java PROGRAMM會做整個事情。我已經發布存儲在我的disk.but我需要捕捉攝像頭和發送的FLV視頻文件捕獲的視頻wowza server.can你幫我plz? – 2014-09-06 04:41:56