playing video 16:9 Aspect Ratio
my player is 16:9, so i trying to get netStream width,height after i playing video Aspect Ratio to 16:9 (like show youtube black side pillers);
but here my code playing video default size 320x240,
can you help me anyone?
My code:
var nConnection:NetConnection;
var ns:NetStream;
var video:Video = new Video();
addChild(video);
nConnection = new NetConnection();
nConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
nConnection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
nConnection.addEventListener(AsyncErrorEvent.ASYNC_ERROR, ayncErrorHandler);
nConnection.connect(serverURL);
function netStatusHandler(event:NetStatusEvent):void
{
switch (event.info.code)
{
case "NetConnection.Connect.Success" :
connectStream();
break;
case "NetStream.Play.StreamNotFound" :
trace("Stream not found: " + videoURL);
break;
case "NetStream.Play.Start" :
break;
case "NetStream.Play.Stop" :
break;
default :
}
}
function connectStream():void
{
ns = new NetStream(nConnection);
ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, ayncErrorHandler);
ns.client = {onMetaData:ns_onMetaData};
ns.bufferTime = 10;
video.attachNetStream(ns);
ns.play(videoURL);
video.smoothing = true;
}
function ns_onMetaData(item:Object):void
{
video.width = item.width;
video.height = item.height;
trace("vid wid "+videoWidth);
trace("vid hei "+videoHeight);
}
function securityErrorHandler(event:SecurityErrorEvent):void
{
trace("securityErrorHandler: " + event);
}
function ayncErrorHandler(event: AsyncErrorEvent):void
{
}
