我正在尝试将flash.media.Camera附加到NetStream对象,然后将其附加到StageVideo对象。
我被告知这是使StageVideo在Android上运行的唯一方法,但我无法使其正常工作。
我目前正在这样做,我无法弄清问题是什么:
1.添加舞台视频可用性监听器。
stage.addEventListener(StageVideoAvailabilityEvent.STAGE_VIDEO_AVAILABILITY, availabilityChanged);
2
private function availabilityChanged(event:StageVideoAvailabilityEvent):void {
vidLocal = stage.stageVideos[0];
rtmpNow = "rtmp://left";
nc=new NetConnection();
setCam();
setVideo();
nc.addEventListener(NetStatusEvent.NET_STATUS,checkCon);
nc.connect(rtmpNow);
}
3
private function checkCon(e:NetStatusEvent):void
{
good = e.info.code == "NetConnection.Connect.Success";
if (good)
{
trace("good good");
nsOut = new NetStream(nc);
nsOut.attachCamera(cam);
nsOut.publish("left","live");
nsOut.play("left");
vidLocal.attachNetStream(nsOut);
}
}
private function setCam()
{
cam = Camera.getCamera();
cam.setKeyFrameInterval(9);
cam.setMode(640,400,30);
cam.setQuality(0,95);
}
private function setVideo()
{
vidLocal.viewPort = new Rectangle(cam.width,cam.height);
vidLocal.attachCamera(cam);
}
我最大的问题是我不知道NetConnection的字符串是什么?