Reputation: 3119
I have Adobe Media Server 4, and I am using Flash Professional CS5.5 to create streaming application. For testing I use default Adobe Page where you can insert streamer url and Stream name to connect to streaming source, for overview. It's that page at start up, where you have two blocks of videos, left one to broadcast and right one to see stream.
Here is the AS3 code:
var bandwidth:int = 0;
var quality:int = 50;
var camera:Camera = Camera.getCamera();
camera.setQuality(bandwidth, quality);
camera.setMode(430,320,15, true);
var video:Video = new Video();
video.attachCamera(camera);
addChild(video);
video.width = 430;
video.height = 320;
var nc:NetConnection = new NetConnection();
nc.connect("rtmp://***");
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
function netStatusHandler(event:NetStatusEvent):void{
if (event.info.code == "NetConnection.Connect.Success")
{
label10.text = 'Connected';
var ns:NetStream = new NetStream(nc);
ns.attachCamera(camera);
ns.publish("NewStream1", "live");
}
}
When I run this file I get "Connected" in label10, that means it's connected to rtmp server link.
When I insert this specific rtmp link and NewStream1 ( from ns.publish("NewStream1", "live"); ) inside Adobe Default page, it doesn't work... It connects, but it shows only blank black box.
And when I use that default page to stream, left broadcaster, it works great.
Can someone help me with this, tell me what I am doing wrong?
Thank you.
EDIT:
Also, strange thing happen when I remove
video.attachCamera(camera);
There is still line when camera is attached to streamer
ns.attachCamera(camera);
But light on camera, that is signing that camera is active, it turn on for 1-2 seconds and it turn off... So camera is not used after... So it might be a problem with NetStreaming object, since it's rejecting camera...
Upvotes: 1
Views: 1741
Reputation: 3119
Problem was that
var ns:NetStream = new NetStream(nc);
needs to be outside function defined... Since this way it's function variable and it's "killed" after function ends...
Upvotes: 3