forked from: video size/fullscreen example for stackoverflow
forked from video size/fullscreen example for stackoverflow (diff: 54)
ActionScript3 source code
/**
* Copyright www0z0k ( http://wonderfl.net/user/www0z0k )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/MkZG
*/
package {
import flash.events.NetStatusEvent;
import flash.net.NetStream;
import flash.net.NetConnection;
import flash.events.Event;
import flash.media.Video;
import flash.display.Sprite;
public class VideoWithNetStatus extends Sprite {
private var video:Video = new Video();
private var nc:NetConnection;
private var ns:NetStream;
public function VideoWithNetStatus() {
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, onStatus);
nc.connect(null);//or media server url
}
private function onStatus(e:NetStatusEvent):void{
switch(e.info.code){
case 'NetConnection.Connect.Success':
connectStream();
break;
default:
trace(e.info.code);//to see any unhadled events
}
}
private function connectStream():void{
ns = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, onStatus);
addChild(video);
video.attachNetStream(ns);
ns.play('url/to/video.flv');
}
}
}
