Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Supporting Technologies > Flash Media Server

Reply
 
Thread Tools Rate Thread Display Modes
Old 12-19-2003, 05:58 PM   #1
exactpixel
One of many
 
Join Date: Sep 2002
Location: phoenix
Posts: 268
Default displaying the complete time and the time passed on a flv

hello all,

i'm trying to get the lenght of a stream(flv) and display it. get the amount of time that has played on the stream and display that, it will look like this in the end :

01:32/09:45

has any one done this and what would be the best way to go about it? i already have a .asc file that grabs the stream.length and brings it back into flash in secs, but that's as far as i've gotton, and i want to go about this the right way. am i going to create a getTimer() object or is there a clientside script that will accurately display the stream.

thanks,

also, how would i go about trimming the extra characters off of the seconds?
exactpixel is offline   Reply With Quote
Old 12-22-2003, 04:06 PM   #2
exactpixel
One of many
 
Join Date: Sep 2002
Location: phoenix
Posts: 268
Default

ok, i've gotten the total time, but for some reason, NetStream.time() does not work it just returns "undefined"?

talk'n to myseeaeaalffffff....
exactpixel is offline   Reply With Quote
Old 12-22-2003, 04:29 PM   #3
exactpixel
One of many
 
Join Date: Sep 2002
Location: phoenix
Posts: 268
Default

bad syntax was the villan.
exactpixel is offline   Reply With Quote
Old 03-31-2004, 07:17 PM   #4
artane
Registered User
 
Join Date: Aug 2003
Posts: 62
Default I want to display the flashcom server time

hi guys,

What is the simplest way to display the time according to my flashcom server.

Do I have to add something to my main.asc file?

On the client side, does my movie need a dynamic text box that references a variable etc?

I just need to display the current server time, plain and simple.

Thank-you very much,

artane
artane is offline   Reply With Quote
Old 04-02-2004, 11:23 AM   #5
exactpixel
One of many
 
Join Date: Sep 2002
Location: phoenix
Posts: 268
Default

put this in your main.asc file.

PHP Code:
application.acceptConnection(clientObj);
    
Client.prototype.sendInfo = function(c){
    return 
Stream.length(c);
    
trace(Stream.length);
    }

not sure if these tags work...


put this in the fla that plays yo video:

PHP Code:
myInputStream = new NetStream (nc);
    
myInputStream.onResult = function (sL)
    {
        
this.duration sL;
                          
//some math to shell it out for you
        
exactTime Math.floor (sl);
        
myInputStream.duration Math.floor (sl);
        
minute Math.floor (exactTime/60);
        
seconds Math.floor (exactTime%60);
        
//trace ("THIS IS THE SL OBJECT RETURN: "+exactTime);
        //trace ("THIS IS THE TOTAL: ="+minute+":"+seconds);
        
    
}; 

yup, hope that helps
exactpixel is offline   Reply With Quote
Old 11-01-2004, 05:08 AM   #6
xbrotherx
Member
 
Join Date: Feb 2004
Location: Texas
Posts: 85
Default

exactpixel,

could you please explain your code above. I am struggling severly with talking back and forth between the server side code and client side and I am trying to accomplish something similar to your first post on this thread concerning elapsed time and total time.

I try to just put an application.acceptConnection = function() method in my .asc file and I continue to get errors saying there is a syntax error...missing ; before statement. Well why should there be a semi colon before that method declaration. Makes no sense.

Anyway, any help would be appreciated.
xbrotherx is offline   Reply With Quote
Old 11-09-2004, 10:41 PM   #7
Par
Registered User
 
Join Date: Nov 2004
Posts: 1
Default Get the length of a stream file into a variable you can use

To get back on the original topic issue... I am interested in getting the length of a recorded (in my case audio but assume it works the same for video) flash stream file.

The FCS documentation comes with the following example (slightly altered though):

For the .fla file, this code (php formatting seems to work nicely)

PHP Code:
streamFileName "streamname"// without .flv ofcourse

getInfo(streamFileName);

function 
getInfo(myStreamName)
{
 
nc.call("sendInfo", new MyResultSetName(), myStreamName);
}
function 
MyResultSetName()
{
 
this.onResult = function(retVal)
 {
    
_root.streamlength retVal;
 };
 
this.onStatus = function(info)
 {
    
trace("Level: " info.level "   Code: " +  info.code);
  
// process error object
 
};

And the main.asc part

PHP Code:
application.onAppStart = function()
{
    
trace("::: Application has started :::");
}

application.onConnect = function(client)
{
    
application.acceptConnection(client);

    
// Add methods
    
Client.prototype.sendInfo = function(name) {
        var 
slen Stream.length(name);
        
trace("slen: " slen);
        return 
slen;
    };

(corrected the typo in the prototype function, they used client.prototype instead of Client.prototype which didn't seem to work, go macromedia)..

either ways... it would have been nice if they put a fully working example for this code in the documentation, as this partial example got me stuck, eventhough it does work... if you want to trace that is.

The getInfo() function calls the prototype function sendInfo on the server, and the result is stored in a (new) object.

This new object however, also has to wait for the FCS to respond to the call, so it uses '.onresult' and then sets _root.streamlength

So I ended up with jumping in timelines after all..

My Frame 1 has the code:

PHP Code:
stop();

hostFCS "localhost";

nc=new NetConnection();
nc.connect("rtmp://"+hostFCS+"/ak-cms/audio");

streamLength "";

nc.onStatus = function(info)
{
    if(
info.code == "NetConnection.Connect.Success")
    {
        
filename "audiotestbestand";
        
debugTxt "Get length " filename;
        
getInfo(filename);
    }
}

function 
getInfo(myStreamName)
{
    
nc.call("sendInfo", new MyResultSetName(), myStreamName);
}

function 
MyResultSetName()
{
    
this.onResult = function(retVal)
     {
        
        
streamLength retVal;
        
gotoAndStop("outputInfo");
     };

    
this.onStatus = function(info)
    {
        
trace("Level: " info.level "   Code: " +  info.code);
        
// process error object
     
};

and Frame 2, with label outputInfo has:

PHP Code:
stop();
msg "Length of " filename " = " streamLength;
debugTxt msg
where debugTxt is a textfield with var-name debugTxt.

hope this helps someone.. got me stuck for a few hours on how to handle the value return by the nc.call.. jumping seems to work.

Last edited by Par; 11-09-2004 at 10:50 PM.. Reason: Corrected typo's
Par is offline   Reply With Quote
Old 11-10-2004, 01:35 AM   #8
exactpixel
One of many
 
Join Date: Sep 2002
Location: phoenix
Posts: 268
Default

Sorry, just got the email notification. Did that help you at all?


ep
exactpixel is offline   Reply With Quote
Old 09-17-2007, 10:27 AM   #9
perrelet
Registered User
 
Join Date: Sep 2007
Posts: 9
Default the easy solution.....

myNetStream.onMetaData = function(infoObject:Object) {
var duration = infoObject.duration;
}
perrelet is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:39 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.