PDA

View Full Version : Is there any way to get the TRT of my loaded FLV?



hey_suburbia
May 11th, 2009, 04:14 PM
I'm using custom script to run a NetConnection and NetStream object.

Is there any way to get the TRT of my loaded FLV?

hey_suburbia
May 11th, 2009, 04:41 PM
I figured it out, so if anybody else needs to know, here's what I did:

1.) You're FLV NEEDS metadata (This is why my code wasn't working), so if the below doesn't work you'll need to re-render your FLV with metadata or use a FLV MetaData Injector like I did: http://www.buraks.com/flvmdi/

2.) Then just use the following code (Mine puts the TRT into a variable "videoTRT" without colons):

//Get the loaded video TRT
myNS.onMetaData = function(metadata) {
duration = metadata.duration;
var dur_seconds:Number = duration;
var minutes_dspl = Math.floor(dur_seconds/60);
var seconds_dspl = Math.floor(dur_seconds%60);
if (minutes_dspl<10) {
minutes_dspl = ("0"+minutes_dspl);
}
if (seconds_dspl<10) {
seconds_dspl = ("0"+seconds_dspl);
}
videoTRT = minutes_dspl+seconds_dspl;
};