[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1445
  • Last Modified:

flv total time

How can i get the total time of a externaly loaded flv video , I am using as3 with the netsream class.
Thanks
0
nysurf1
Asked:
nysurf1
  • 2
1 Solution
 
bugs021997Commented:
@nysurf1

Try using NetStream.time()
0
 
The_Blasted_OneCommented:
It is considered it is possible with server-side AS when you're using Flash Media Server, but I guess, you don't.

So you can use onMetaData method.
Here's a snippet from manual




var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);

ns.onMetaData = function(infoObject:Object) {
    for (var propName:String in infoObject) {
        trace(propName + " = " + infoObject[propName]);
    }
};

ns.play("http://www.helpexamples.com/flash/video/water.flv");


This causes the following information to be displayed:

canSeekToEnd = true
 videocodecid = 4
 framerate = 15
 videodatarate = 400
 height = 215
 width = 320
 duration = 7.347
0
 
The_Blasted_OneCommented:
Note that onMetaData may not work with some flvs (which don't contain any metadata). In this case I can only recommend you to do some calculations with NetStream's bufferLength, bytesLoaded properties and file size. You can determine the estimated length, but it will be veeeeery approximate.

I suppose you can obtain file size with flash.net.FileReference's onProgress method, although some server-side solution like PHP will do this work better and plainer.

NetStream.time() is the current video position, isn't it?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now