I am trying to making a dynamic RTMP vedio player like jwplayer. my player collect stream veriable from swfobect and then play it via netstream in as3. I attached netstream to my stage. But i am facing some weird problem. When i am resizing my stage or making full screen of my player the vedio got stretched. i tried stage.scaleMode but its not working. please check my main as3 below and give me a solution so that my vedio can obtain aspect ration at any size of my player/stage. see the screenshot
Main ActionScript Code
package com.WindchimeVedioPlayer {
import flash.media.*;
import flash.system.Security;
import flash.net.navigateToURL;
import flash.net.URLRequest;
import flash.events.MouseEvent;
import flash.events.NetStatusEvent;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.display.*;
import flash.display.DisplayObject;
import com.WindchimeVedioPlayer.RTMPStream;
Security.allowDomain("*");
public class main extends RTMPStream {
/* the constructor. */
public function main():void {
trace("Downstream object has been created."); // debug trace..
//stage.scaleMode=StageScaleMode.NO_BORDER;
this.oVideo = new Video(640, 480);
this.oConnection = new NetConnection();
this.oConnection.addEventListener(NetStatusEvent.NET_STATUS, eNetStatus, false, 0, true);
this.oConnection.connect(this.sMediaServerURL);
addChild(logo);
//logo.x=440;
}
/* triggered when a net status event is received. */
private function eNetStatus(oEvent1:NetStatusEvent) {
trace("NetStatusEvent: " + oEvent1.info.code); // debug trace..
switch (oEvent1.info.code) {
case "NetConnection.Connect.Success":
// create a stream for the connection..
this.oNetStream = new NetStream(oConnection);
this.oNetStream.addEventListener(NetStatusEvent.NET_STATUS, eNetStatus, false, 0, true);
this.oNetStream.bufferTime = 5; // set this to whatever is comfortable..
// listen for meta data..
this.oMetaData.onMetaData = eMetaDataReceived;
this.oNetStream.client = this.oMetaData;
// attach the stream to the stage..
this.oVideo.attachNetStream(oNetStream);
this.oNetStream.play(sStreamName);
this.addChildAt(this.oVideo, 0);
trace("Connected to the RTMP server."); // debug trace..
break;
case "NetConnection.Connect.Closed":
trace("Disconnected from the RTMP server."); // debug trace..
break;
case "NetStream.Play.StreamNotFound":
trace("This stream is currently unavailable."); // debug trace..
break;
}
}
}
}
Please see the action script code and please suggest me how to fix it.
this.
? – VC.One