Topic: Trying to stream FLV video to Chumby using swfmill and mtasc
I'm attempting to stream FLV videos to my Chumby and have been having some difficulties. I can get the sound to work, but I can't get the video to display. I can't seem to figure out how to get the video stream attached to the stage. All the examples I've been able to find use a magical "myvideo", but never describe how it gets created and attached.
Does anyone know how to connect the NetStream video object to the _root stage?
Here is my MTASC ActionScript file (Main.as):
class MyThumb extends MovieClip
{
var vid:Video;
var myVideo:MovieClip;
var nc:NetConnection;
var ns:NetStream;
var state = 0;
function onLoad()
{
myVideo._root.attachMovie("myVideo1","myVideo",_root.getNextHighestDepth());
nc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
myVideo.vid.attachVideo(ns);
ns.play("http://192.168.1.200/video/test.flv");
ns.pause();
}
function onMouseDown()
{
if (state == 0)
{
state = 1;
_root.createTextField("info2",0, 0,0, 100,30);
_root.info2.setNewTextFormat( new TextFormat("Arial") );
_root.info2.textColor=0xff0000;
_root.info2.text = "moo_moo.flv";
ns.play("http://192.168.1.200/video/moo_moo.flv");
} else {
state = 0
_root.createTextField("info",0, 0,0, 100,30);
_root.info.setNewTextFormat( new TextFormat("Arial") );
_root.info.textColor=0xff0000;
_root.info.text = "test.flv";
ns.play("http://192.168.1.200/video/test.flv");
}
}
}
Here is my swfmill XML file (video.xml):
<?xml version="1.0" encoding="utf-8" ?>
<movie version="8" width="320" height="240" framerate="12">
<frame>
<clip id="classes.swf" import="classes.swf"/>
<clip id="moo_moo.jpg" import="moo_moo.jpg"/>
<library>
<clip id="Thumb" class="MyThumb">
<frame>
<place id="moo_moo.jpg"/>
</frame>
</clip>
<clip id="myVideo">
<frame>
<place id="VideoSurface" name="vid"/>
<video id="VideoSurface"/>
</frame>
</clip>
</library>
<place id="Thumb"/>
</frame>
</movie>
I compile them with the following commands:
mtasc Main.as VideoDisplay.as -version 8 -wimp -swf classes.swf -header 320:240:12
swfmill simple video.xml video.swf
Then I copy it over to the Chumby's USB drive.
Thanks,
-Ron