我是felx和FMS(AMS)的新手。我想在用户允许访问该程序并将其保存在Flash Media Server上后录制网络摄像头视频。这是我正在使用的代码:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
private var camLive:Camera = Camera.getCamera();
private var nc:NetConnection;
private var ns:NetStream;
protected function video_d_creationCompleteHandler(event:FlexEvent):void
{
if (camLive) {
nc=new NetConnection();
nc.connect("rtmp://00.00.0000.000/test");
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
} else {
Alert.show("You don't seem to have a camera.");
}
}
private function netStatusHandler(event:NetStatusEvent):void {
var code:String = event.info.code;
if (code == "NetConnection.Connect.Success") {
ns=new NetStream(nc);
ns.attachCamera(camLive);
ns.publish("foobar", "record");
}
else{
trace(code);
}
}
]]>
</fx:Script>
<s:Panel title="Video">
<s:VideoDisplay id="vDisplay" width="400" height="300"
creationComplete="video_d_creationCompleteHandler(event)"/>
</s:Panel>
</s:Application>
有两个问题: 1)我无法在vDisplay中看到我的网络摄像头视图,基本上vDispaly是一个空白帧。我该怎么解决? 2)它只能以FLV格式在FMS上保存5秒的网络摄像头视频。我想将记录时间增加到至少20分钟。
任何提示都表示赞赏。