Below is my basic code, im loading a flv video using flvplayback.
i need the features of flvplayback compulsorily.
I have finished loading flv video sucessfully.
Now im stuckup with showing the source video files original dimension in a text field.
How should proceed further from here. Please guide me......
stage.displayState = StageDisplayState.FULL_SCREEN;
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
import fl.video.*;
stop();
var rmys01:FLVPlayback = new FLVPlayback();
rmys01.source = "rhym01.flv";
rmys01.skin = "MinimaFlatCustomColorPlayBackSeekCounterVolMute.swf";
rmys01.autoPlay = true;
rmys01.fullScreenTakeOver = false;
rmys01.scaleMode = "maintainAspectRatio";
rmys01.setSize((stage.stageWidth/1.03), (stage.stageHeight/1.03));
rmys01.x = (stage.stageWidth/2) - (rmys01.width/2);
rmys01.y = (stage.stageHeight/1.1) - (rmys01.height/1.1);
addChild(rmys01);
setChildIndex(rmys01,1);
Did you set client for the NetStream? Because, all work ok.
Here is an example:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
var client: Object = {};
client.onMetaData = function(data:Object):void{
//Display width and height
var textField: TextField = new TextField();
textField.autoSize = TextFieldAutoSize.LEFT;
textField.defaultTextFormat = new TextFormat("Arial", 28);
textField.text = "Width: " + data.width + ", Height: " + data.height;
addChild(textField);
}
ns.client = client;
ns.play("path/to/Video");
var myVideo:Video = new Video();
myVideo.attachNetStream(ns);
addChild(myVideo);
For debugging purposes place trace (trace("There is MetaData!");
) to the onMetaData handler, check, if it triggers.
For FLVPlayback, you should subscribe for VideoEvent.READY:
rmys01.addEventListener(VideoEvent.READY, onReady);
function onReady(e:VideoEvent):void {
trace("READY");
var flvPlayback:FLVPlayback = e.target as FLVPlayback;
var metaData:Object = flvPlayback.metadata as Object;
trace("height: "+metaData.height);
trace("width: "+metaData.width);
trace("duration: "+metaData.duration);
}
If you are coding in Flash IDE, there will be a problem with VideoEvent, so you should use fully qualified class (fl.video.VideoEvent
), if not, IDE will try resolve it to the flash.events.VideoEvent
:
rmys01.addEventListener(fl.video.VideoEvent.READY, onReady);
function onReady(e:fl.video.VideoEvent):void {
//Handler code
}