Hello all –
Trying to get the video to show on the stage.
Here is the FLA
import classes.NetConnectionExample;
var videoURL:String = "http://192.168.0.52/stream.flv";
var nc:NetConnectionExample = new NetConnectionExample();
nc.ConnectStream(videoURL);
and here is the AS
package classes {
import flash.display.Sprite;
import flash.events.NetStatusEvent;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.events.Event;
public class NetConnectionExample extends Sprite {
private function NetStatusHandler(event:NetStatusEvent):void {
switch (event.info.code) {
case "NetConnection.Connect.Success":
trace(event.info.code);
break;
case "NetStream.Play.StreamNotFound":
trace("Stream not found: " + event.info.code);
break;
}
}
public function ConnectStream(videoURL) {
var connection:NetConnection = new NetConnection();
connection.connect(null);
var stream:NetStream = new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS, NetStatusHandler);
stream.client = new CustomClient();
stream.play(videoURL);
var video:Video = new Video();
video.x = 10;
video.y = 10;
video.attachNetStream(stream);
addChild(video);
}
}
}
class CustomClient {
public function onMetaData(info:Object):void {
trace("metadata: duration=" + info.duration + " width=" + info.width + " height=" + info.height + " framerate=" + info.framerate);
}
public function onCuePoint(info:Object):void {
trace("cuepoint: time=" + info.time + " name=" + info.name + " type=" + info.type);
}
}
I am getting the video MetaData info returned but the video does not show on the stage?
[COLOR=dimgray]metadata: duration=479.597 width=368 height=246 framerate=29.970029970029966[/COLOR]
Any ideas as to what I am doing wrong?
Thank you,
Jon