We have installed the developer edition on FMS2 on a Windows
2000 server. We have been able to see a connection to an instance
of our application. But, when we expect to see a video streaming
there is nothing. We are unsure of which main.asc file to use in
the root of our application FMS2 folder. There is no indication of
any documentation regarding this technology that we are aware of
that explains it to us in an elementary fashion - we just want to
stream video for cry'n out loud! - Very frustrated but want to
leverage this technology. Any help with this would be great
especially any details regarding the server install and setup to
use video streaming capabilities.
Here is our AS3 code we are using:
package {
import flash.display.MovieClip;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.net.ObjectEncoding;
import flash.system.Security;
import flash.media.Video;
import flash.events.*;
import flash.text.TextField;
public class MyVideo extends MovieClip{
public var nc:NetConnection;
public var stream:NetStream;
public var video:Video;
//public var onBWDone:Function;
public function MyVideo(){
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, playVideo);
nc.objectEncoding = ObjectEncoding.AMF0;
//nc.setId = function(n:Number):void{};
//nc.connect("rtmp:/testApp/streams");
nc.connect("rtmp://172.16.1.83/testApp/streams");
trace(Security.sandboxType);
}
public function playVideo(evt:NetStatusEvent):void {
txt.text = evt.info.code;
switch (evt.info.code) {
case "NetConnection.Connect.Success" :
connectStream();
trace("My code is done");
break;
case "NetStream.Play.StreamNotFound" :
trace("Unable to locate video: ");
break;
default:
trace("The connection failed");
break;
}
}
public function connectStream():void {
trace("CONNECTED");
var stream:NetStream = new NetStream(nc);
stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR,
asyncErrorHandler);
stream.addEventListener(NetStatusEvent.NET_STATUS,
netStatusHandler);
var video:Video = new Video();
video.attachNetStream(stream);
addChild(video);
stream.play("test.flv");
}
public function
asyncErrorHandler(event:AsyncErrorEvent):void {
trace("SOMETHING BAD");
}
public function onBWDone(info:Object):void{
}
public function netStatusHandler(event:NetStatusEvent):void{
//trace(event.text);
}
}
}