Flv 视频的添加(抽象)

PlayVideoAbstract.as

package  {
    import flash.net.NetConnection;
    import flash.net.NetStream;
    import flash.media.Video;
    import flash.display.Sprite;
   
    public class PlayVideoAbstract extends Sprite {

        public function PlayVideoAbstract() {
            var customClient:Object = new Object();
            var nc:NetConnection;
            var ns:NetStream;
            var vid:Video;
            var S:String="v1_01.flv";
            var PlayA:PlayAbstract=new PlayAbstract(S,customClient,nc,ns,vid,100,50);
            addChild(PlayA);
        }
    }
   
}

PlayAbstract.as

package  {
    import flash.net.NetConnection;
    import flash.net.NetStream;
    import flash.media.Video;
    import flash.display.Sprite;
   
    public class PlayAbstract extends Sprite {

        public function PlayAbstract(S:String,customClient:Object,nc:NetConnection,ns:NetStream,vid:Video,xpos:uint,ypos:uint) {
            customClient.onMetaData = metaDataHandler;
            nc=new NetConnection();
            nc.connect(null);
            ns=new NetStream(nc);
            ns.client=customClient;
            vid=new Video();
            vid.attachNetStream(ns);
            ns.play(S);
            addChild(vid);
            vid.x=xpos;
            vid.y=ypos;
        }
        function metaDataHandler(infoObject:Object):void {
        }

    }
}

你可能感兴趣的:(flv)