FMS を使用してウェブカメラからビデオをライブ ストリーミングしようとしています。ここで作業しようとしているコードを書きましたが、このエラーが発生します。正しい解決策を教えてください。私が得ることができるすべての助けに本当に感謝しています。
エラー: エラー #2044: 未処理の AsyncErrorEvent:。text=エラー #2095: flash.net.NetConnection はコールバック onBWDone を呼び出すことができませんでした。error=ReferenceError: エラー #1069: プロパティ onBWDone が vv に見つからず、デフォルト値がありません。vv/button2_clickHandler()[] で vv/___vv_Button2_click()[] で
<?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;
var camera:Camera = Camera.getCamera();
var localCam:Video = new Video(420,313);
protected function video_d_creationCompleteHandler(event:FlexEvent):void
{
// TODO Auto-generated method stub
if (camera) {
//var localCam:Video = new Video(280,150);
localCam.attachCamera(camera);
localCam.smoothing = true;
//localCam.
video_d.addChild(localCam);
} else {
Alert.show("You don't seem to have a camera.");
}
}
protected function button2_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
lsfmspanel.visible = true;
var nc:NetConnection = new NetConnection();
nc.client = this;
nc.connect("rtmp://localhost/live");
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
function netStatusHandler(event:NetStatusEvent):void {
switch (event.info.code) {
case "NetConnection.Connect.Success":
var ns:NetStream = new NetStream(nc,NetStream.CONNECT_TO_FMS);
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onBWDone);
ns.attachCamera(camera);
ns.publish("livestream", "live");
break;
case "NetStream.Play.StreamNotFound":
trace("Unable to locate video: ");
break;
}
}
function asyncErrorHandler(event:AsyncErrorEvent):void { Alert.show("E." + event.text); }
function onBWDone(event:AsyncErrorEvent):void{
trace("onBWDone");
}
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Panel x="5" y="9" width="448" height="365" title="Live Stream">
<s:VideoDisplay id="video_d" x="10" y="9" width="426" height="313"
creationComplete="video_d_creationCompleteHandler(event)"/>
</s:Panel>
<s:Panel x="462" y="9" width="448" height="365" title="Live Streaming From FMS" visible="false" id="lsfmspanel">
<s:VideoDisplay id="livestream" x="10" y="9" width="426" height="313" source="rtmp://localhost/live" autoPlay="true"/>
</s:Panel>
<s:Button x="105" y="382" label="Start Streaming" click="button2_clickHandler(event)"/>
</s:Application>