Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




FLV Playback - Total Time?



How can I set the Total Time of a FLV playback component ... via actionscript?



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 03-26-2007, 09:57 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Current/total Time For Video Component Playback
I managed to get the 'total time' working but it only updates after the first video is played, here's my code :

Code:

n = Math.round(videoPlayer.totalTime);
mins = Math.floor(n/60);
secs = n - 60*mins;
secs<10 ? secs = "0"+secs : secs;

//Dynamic text field on the stage called 'tTotalTime'
tTotalTime.text = mins+":"+secs


But i'm not sure if 'videoPlayer.playheadTime' (to get the current video time) works because I call it when the video is just starting so even if it was working it would give me a responce of 0. So I guess what I would need to do is set it up so that it updates every second or so?

Also, how would I retrieve the filename of the video that is currently being played?

MP3 Audio Playback With Time Display/elapsed/total Duration
Does anyone know of any good tutorials or links with more information on displaying the total time length and elapsed of an mp3 during sound playback? I can't seem to find anything on it, is it not easily possible? I read something about using PHP with flash to get this info, and I notice a lot of mp3 player tutorials omit this time display in their players. Any help or leads appreciated..

AS3- Streaming FLV Elapsed Time:Total Time
Hey Ya all Flash genius'...

I've searched quite a lot and seem to not find a solution to my problem!

Can anyone please help with how I can display (using Dynamic Text) TOTAL TIME/ELAPSED TIME?

1. My FLV is streaming from FMS3
2. Using the NetStream and NetConnect method - I am not using the FLV component in CS3.

Thanks.

Flash Video Time/Total Time
Hello,

I'm trying to figure out how I can add a time counter below my flash video clip that shows the current time of the video clip (in minutes and seconds) and then next to that a slash (/) and the total running time of the video clip (also in minutes and seconds).

Does anyone know where I can find a tutorial for this?

Thanks

Movie Clips. Image Sequences And Playback (total Newb)
I created a movie clip symbol, and imported an image sequence into it.

But when I put that movie clip symbol on the stage it only shows the first frame during playback.

I'm sure it is something obvious, but google isn't being my friend today. I can fake my way to flash usually, but its not working this time.

Total Time And Elapsed Time In SWF
Dear Friends
I just want to show Total time and elapsed time of a SWF in runtime.
If it it possible , than plz give me Action script or sample file for the same. ASAP

Regards

FLV Total Time
Hi,

I have a question regarding FLV. After loading the video using the Net Conection and NS Stream as per normal. How do I get the total time of the video that is currently loaded from a particular URL?

Can someone elighten me? What I can do right now is only use the NS Stream functions such as .bytesloaded and .totalbytes. Does anyone knows how do I calculate the total duration of the flv video that is successfully downloaded?

Thanks in advance!

FLV Total Time
Totoal time not working on some videos from youtube....
Here is an example, go to http://vamapaull.dxwebs.com/video/ then click on "(RHCP) John Frusciante - How Deep Is Your Love"
That is a very big problem because the scruber and loader is not working fine... :)

This is the link to the video from youtube:
Code:

http://sjl-v39.sjl.youtube.com/get_video?video_id=UODlieJdQT4

Put that in your FLV Player to see if you have the same problem :D

Total Time Questions
I am making a previous and next button going through 3 .flv files, simple enough... of course flash is going to have some problem with getting the total time of FLV's so i have to hard code it as here is an example-

thumbmotion3_mc.onRelease = function() {
_root.audio.pause();
vid.setMedia("media/turnmeup.flv", "FLV");
vid.play();
vid.totalTime = 10.33;
videocontrol_mc.movieControls_mc.mc_slider.knob_mc .alpha = 100;
};

OK
for the prev/next buttons I am curious how if i can set the time in the array... orr any other way? Here is the coding




/////
whichVid = 0;
mediaDir = "media/";
tracklist = ["iankemp.flv", "FLV", "electric.flv", "FLV", "turnmeup.flv", "FLV"]

newVideo();
//---------------
function newVid() {
vid.stop();
vid.setMedia(mediaDir+tracklist[whichVid], "FLV");
vid.play(0);
}
//-------------

vidnext_mc.onRelease = function() {
if (whichVid<tracklist.length-1) {
whichVid++;
} else {
whichVid = 0;
}
newVid();
};
vidprev_mc.onRelease = function() {
if (whichVid>0) {
whichVid--;
} else {
whichVid = tracklist.length-1;
}
newVid();
};

Total Time Questions
am making a previous and next button going through 3 .flv files, simple enough... of course flash is going to have some problem with getting the total time of FLV's so i have to hard code it as here is an example-

thumbmotion3_mc.onRelease = function() {
_root.audio.pause();
vid.setMedia("media/turnmeup.flv", "FLV");
vid.play();
vid.totalTime = 10.33;
videocontrol_mc.movieControls_mc.mc_slider.knob_mc .alpha = 100;
};

OK
for the prev/next buttons I am curious how if i can set the time in the array... orr any other way? Here is the coding




/////
whichVid = 0;
mediaDir = "media/";
tracklist = ["iankemp.flv", "FLV", "electric.flv", "FLV", "turnmeup.flv", "FLV"]

newVideo();
//---------------
function newVid() {
vid.stop();
vid.setMedia(mediaDir+tracklist[whichVid], "FLV");
vid.play(0);
}
//-------------

vidnext_mc.onRelease = function() {
if (whichVid<tracklist.length-1) {
whichVid++;
} else {
whichVid = 0;
}
newVid();
};
vidprev_mc.onRelease = function() {
if (whichVid>0) {
whichVid--;
} else {
whichVid = tracklist.length-1;
}
newVid();
};

Display FLV Total Time
Anyone know how to display the total time of an FLV in seconds and minutes? I have a text field: "total_txt" that I am trying to display the total time of the FLV.

Thanks!!!!!!

Getting The Total Time Of A Loading Flv
i am trying to control and FLV loaded with NetStream (not with flash Communication server) but can't seem to find a way to find out how long the video is. is there a property to get the total time of a flv video? i am looking for some thing like _totalframes that you use with the falsh time line

i find it bizza that you can get the bytesTotal and bytesTotal but not the totaltime

is there a work around?

How To Know The Total Time Of The Flash.
in flash, i want to load other swf, but how can i to know totaltime of the swf when i load it. and how can i to control this swf. e.g. play, stop, slide bar....

like this e.g. http://www.macromedia.com/software/c...ures/brz_tour/


thx thx thx

Total Frames/time?
Where do I find the total frames (and/or seconds) of my flash movie? The main timeline is only 1 frame, but I've added movieclips, so how do I know the total length other than by timing the movie with my watch?
Thanks

BTW: My knowledge of ActionScripting is VERY limited.

NetStream And Total Time
I am working with video objects and setting up a netstream.
I need to know how to get the duration of a streaming video so that I can program various things to happen. A countdown timer, an ending function, a scrub bar, etc..

I can get the current time of where the playhead is at by using the time:Number property.

I tried using getTotalTime that works with the playback component but that didn't do the trick.

If anyone can help me out it would be greatly appreciated.

Thanks in advance.

Total Elapsed Time
I know that there is a place to find the total elapsed time for a scene.  But is there anywhere to find the total elapsed time for the entire movie?

Total Time Of FLV File
Is possible call the total time of FLV file?
I created one FLV and now I would like to show the time in H:M:S on the flash page - the same what has Lee on gotoandlearn.com

Must I set it manually on FLV Playback component, which I use for playing my FLVs?

I can?t find it. :?

Thanks

Total Video Time
I need to make this video player to have total time code...
like in this flv player:


I didn't find any information about total time code on this forum.... maybe it's someone that can help me :D

Thanks
Paul

AS2 - Get Total Animation Time/Frames?
Hi. I've done quite a long slideshow using AS2 rather than keyframe animation, and I'd like to find out how many frames it runs for in total. I want to export as a Quicktime movie, but unless there are enough frames on the timeline the whole animation won't export. I know _totalFrames works with keyframe animation but is there a way of getting the same information if everything's done in actionscript? Even a total time would be ok as I can easily convert that to frames.
Thanks!

Total Time For A Netstream Object?
I'm making a video player, and I'm having trouble making a seek bar. There is the "time" property of the netstream, but there doesn't seem to be a way to find the total length of the video in seconds, making it difficult to find the fraction of the video played so far. I notice that there's the total size of the video in bytes, but I'm hoping there's an easier way to determine the length of the video (are bit rates variable or fixed for flv files?)

tia

Can NetStream Be Used To Get The Total Time Of A Movie?
I need something like playheadTime, but with NetStream. I know it has the bytes total and bytes loaded, and time, but is there a way to get the total time a file will play?


Do I have to use FLV playback? Is there any disadvantage too?

Check Video Total Time
Hello friends,
I want to know how we can check flv video length's length before downloading. I have no idea. I am developing the flash video player with action script 2.0 and I want to add a functionallty which check and reconize the video's total time before download the video.
Please help me. Every help would be appriciate.

With Best Regards
Himanshu vyas
himanshuvyas.guru@gmail.com

How Do I Display Duration And Total Time In HH:MM:SS In AS3
Hello all, I have been searching the internet for a long time with no success in order to figure out how to display the duration / Total Time of my flv in AS3.

I need this to work so that on my stage i can have a dynamic text box displaying the current time of the flv and the total time ---- example 3:45 / 6:58 where the 3:45 would update as the flv was scrubbed or played, or whenever a jump point was pressed. I found an example of this on this page. http://www.afcomponents.com/components/flv_player_as3/

I have been using the as3 code to import my video and use cue points and for the life of me I cant get this to work.

i have a video component on the stage and use import fl.video.FLVPlayback; to call in the video. I am not using netstream.

Please help!

Math: Total Distance According To Speed And Time
// Fort Canning Park Walkthrough : final semster project 2002
// user speed input
if (_root.input.text == "") {
speed = 1;
} else {
speed = _root.input.text;
//trace(speed);
}
// forward and rewind of mc
mcscene5.onEnterFrame = function() {
mousePos = _root._ymouse;
cfrm = _root.mcscene5._currentframe;
if (mousePos>0 && mousePos<175) {
_root.mcscene5.gotoAndStop(cfrm+speed/1);
} else if (mousePos>225 && mousePos<400) {
_root.mcscene5.gotoAndStop(cfrm-speed/1);
}
};
updateAfterEvent;
// Time
timevar = Math.round((getTimer()/1000));
tfrm = _root.mcscene5._totalframes;
// Distance
function distance() {
x = (Math.round((getTimer()/1000)*speed/6));
trace(x);
distvar = ++x;
updateAfterEvent;
}
if (mousePos>0 && mousePos<175 && cfrm>9 && cfrm<(tfrm-9)) {
distance();
} else if (mousePos>225 && mousePos<400 && cfrm>9 && cfrm<(tfrm-9)) {
distance();
}

The problem are those in bold text. My current does dosen't work. I want to work out the total distance travel taking into account the speed input by the user and the time. I only want the ticking of the time ( for the distance ) to start when the user is forwarding. And that the ticking of the distance meter will be faster when they put in a faster speed... slower when they put a smaller speed. My current method just dosen't work out so hopefully some Math guru can help me out here and give me a solution or just some hints to guide me? Thank you.

LoadMovie() Playhead Time/total Duration
Hi, does anyone know how to get the playhead time a total duration of a swf which has been imported into an empty movie clip using the loadMovie() function?

Netstream - Display Videos Total Time
hi

how can I display an FLV's total play time? (like youtube does)

current play time > 0:42 / 2:30 < total play time

Im using this code to display the current play time:

ActionScript Code:
//----------------------------------------<timeDisplays>
var time_interval:Number = setInterval(checkTime, 500, ns);
function checkTime(ns:NetStream) {
    var ns_seconds:Number = ns.time;
    var minutes:Number = Math.floor(ns_seconds/60);
    var seconds = Math.floor(ns_seconds%60);
    if (seconds<10) {
        seconds = "0"+seconds;
    }
    timeLabel.text = minutes+":"+seconds;
}

what would I have to do to add in the Total play time ?

Frame Rate - Total Frames - Time
I want to get the total frames of a movie in level6, running at 12 frames per second and convert that to minutes and seconds as well as the current time elapsed and display them in dynamic text fields on level8 with the variable names: "timecurrent" and "timetotal" so that I can have it display the current time next to the total time of the movie that is playing.

Ideas on how to do this?

Total Time Display On Flash Player
I am totally new to flash. I am just using the flash payback component and the skin provided by AS3. But I realise there is no total time of the video displayed on the flash player as well as the display of the time as the seek bar moves. Can anyone help please? Thanks a million.

Pepperdip

Movie TIMER With Total Time And Countdown
With so many timer scripts out there,

I'm wondering if anyone knows of a script/movie that does the basics:

- display the total time of a movie from the beginning.
- counts down to "zero" value as the movie progresses.

I'm looking to add this "timer" feature to a captivate movie (end product = swf) with the above functionality. Within the captivate movie is the standard control bar which consists of play, fast forward, rewind, stop, pause, etc. I would like to intergrate the timer with this control bar.

Example format for a 35 second movie: (beginning time to end) 00:00:35 - 00:00:00

Any advice or direction is greatly appreciated!

Thanks,

Flash MX 2004 Video - Get Total Time
Hey all,

Is there a way to get the total time for a flash video that uses progressive download?

Cheers,

Evil

AS 2 Get Total Time Of FVL Using Flash Video Component
Hi there, does anyone know how to retrive the length in minutes and seconds that is playing using the FLV component?

Flash MX 2004 Video - Get Total Time
Hey all,

Is there a way to get the total time for a flash video that uses progressive download?

Cheers,

Evil

Importing Elapsed/Total Video Time?
Problem:


1. I have a main movie swf that imports a flv player skin
2. On the Imported skin is a dynamic text feild for elapsed/total time
3. The elapsed/total time is firing correctly on the main swf but on the imported skin it is missing, empty text fields.
4. I have my listeners in the main movie (doing the importing) set up
Code:


var skinning:UILoader = new UILoader();
skinning.scaleContent = false;
skinning.source = "skinSelections/skinny1.swf";
addChildAt(skinning);

skinning.addEventListener(Event.COMPLETE, etimeLoaded);
skinning.addEventListener(Event.COMPLETE, ttimeLoaded);

function etimeLoaded(event:Event):void {
   event.target.content.counter.addEventListener(TimerEvent.TIMER, counting);
}
function ttimeLoaded(event:Event):void {
   event.target.content.totalTimer.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);
}


5. I have my events set up (elapsed Time snippet):
Code:

var timer:Timer = new Timer(1000);
timer.addEventListener(TimerEvent.TIMER, counting); 
timer.start();

function counting(event:TimerEvent):void{     
try {

var elapsedSeconds = String(ns.time);
    var runTime:String = (elapsedSeconds > 3600 ? Math.floor(elapsedSeconds / 3600) + ":" : "") + (elapsedSeconds % 3600 < 600 ? "0" : "") + Math.floor(elapsedSeconds % 3600/60) + ":" + (elapsedSeconds % 60 < 10 ? "0":"") + elapsedSeconds % 60 ;
   counter.text = runTime;
   
}catch (error:Error) {
            // Ignore this error.
         }
      }
6. I have my events set up (total Time snippet):
Code:

var meta:Object = new Object();
meta.onMetaData = function(meta:Object)


var totalSeconds = String(meta.duration);
        var totalrunTime:String = (totalSeconds > 3600 ? Math.floor(totalSeconds / 3600) + ":" : "") + (totalSeconds % 3600 < 600 ? "0" : "") + Math.floor(totalSeconds % 3600/60) + ":" + (totalSeconds % 60 < 10 ? "0":"") + totalSeconds % 60 ;
       totalTimer.text = totalrunTime;
        trace("RunTime: " + meta.duration);
   
};

7. all the other features on the imported skin are working correctly so I somewhat.... I kind of... I atleast half way import and add listeners correctly... all the skin's buttons and volume is functioning... is there some wort of extra step needed to display imported dynamic text or is this problem somewhere in the code?

Video :: Show The Total Running Time
I'm trying to show the total running time of my video clip below the clip in Flash 8. However I'm not sure how to pull the total running time from the timecode of my FLV file. Does anyone know how to do this?

Thanks

Load Total Time Of .flv Into Dynamic Text Box ?BUG?
This code actually works but while the video is buffering I get "NaN" in the total time text box. Is there a way to avoid this? The code for this text box is the totalText on the second to last line. Thanks.

Code:

var nc:NetConnection = new NetConnection();
nc.connect("rtmp://flash.maddash.net/flashv/pvhs");

var ns:NetStream = new NetStream(nc);

ns.setBufferTime(10);

ns.onStatus = function(info) {
   if(info.code == "NetStream.Buffer.Full") {
      bufferClip._visible = false;
   }
   if(info.code == "NetStream.Buffer.Empty") {
      bufferClip._visible = true;
   }
}
   
theVideo.attachVideo(ns);

ns.play("pvhs_high");

againButton.onRelease = function() {
   ns.seek(0);
}

pauseButton.onRelease = function() {
   ns.pause();
}

var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;
var vidDur:Number;

ns["onMetaData"] = function(obj) {
     vidDur = obj.duration;
}
   
function videoStatus() {
   loader.scrub._x = ns.time / vidDur * 235;
}

var scrubInterval;

function scrubit() {
   ns.seek(Math.floor((loader.scrub._x/235) * vidDur));
}

function checkTime(ns:NetStream,duration:TextField) {
    var ns_seconds:Number = ns.time;
    var minutes:Number = Math.floor(ns_seconds/60);
    var seconds = Math.floor(ns_seconds%60);
    var vidminutes:Number = Math.floor(vidDur/60);
    var vidseconds = Math.floor(vidDur%60);
    if (vidseconds<10) {
       vidseconds = "0"+vidseconds;
    }
    if (seconds<10) {
    seconds = "0"+seconds;
    }
    durText.text = minutes+":"+seconds+" / "+vidminutes+":"+vidseconds;
   totalText.text = vidminutes+":"+vidseconds;
}
var time_interval:Number = setInterval(checkTime, 60, ns,duration);

How To Find Total Duration Time Of Sound?
Hi all,
my first post here...
I was trying to find total time duration of a sound... but it seems that it works only when the complete sound is loaded..
I want to find to total time of a streaming sound??
well.. i used..

var mySound:Sound = new Sound();
var sc:SoundChannel = new SoundChannel();

mySound.load(new URLRequest("track1.mp3"));
sc = mySound.play();

trace(mySound.length); // This doesn't work.. returns 0

[MX04] LoadMovie() Playhead Time/total Duration
Hi, does anyone know how to get the playhead time a total duration of a swf which has been imported into an empty movie clip using the loadMovie() function in actionscript 1.0

How Do I Get My Elapsed/Total Time Dynamic Text Boxes Into..
How do I get my Elapsed/Total Time dynamic text boxes into a flash skin template. I put the boxes in the skin and have the code to make it work on my main stage yet it doest do anything. When i put the text boxes on the stage it works... any thoughts?

Adding Total And Elapsed Time To A Custom Skin In FLVPlayback
I have this player and I am using the FLVPlayback. I have tried to include this code in the skin to see the time displayed there, but it doesn't work. If i use this code in the player itself, it works fine but if i place the text zones in the skin to display the time it doesn't show anything. I am at my wits end. how can i make a skin show the total time and duration for a FLVPlayback player?







Attach Code

myFLVPlybk.addEventListener(MetadataEvent.METADATA_RECEIVED, timeListener);
function timeListener(eventObject:MetadataEvent):void {
var totalSeconds = String(eventObject.info.duration);
var durationTime:String = (totalSeconds > 3600 ? Math.round(totalSeconds / 3600) + ":" : "") + (totalSeconds % 3600 < 600 ? "0" : "") + Math.round(totalSeconds % 3600/60) + ":" + (totalSeconds % 60 < 10 ? "0":"") + Math.round(totalSeconds % 60);
timer_mc1.TxttotalTime.text = durationTime;
//trace("Total time is: " + eventObject.info.duration);
}
stage.addEventListener(Event.ENTER_FRAME, updateTime);
function updateTime (ev:Event):void {
var elapsedSeconds = String(myFLVPlybk.playheadTime);
var runTime:String = (elapsedSeconds > 3600 ? Math.round(elapsedSeconds / 3600) + ":" : "") + (elapsedSeconds % 3600 < 600 ? "0" : "") + Math.round(elapsedSeconds % 3600/60) + ":" + (elapsedSeconds % 60 < 10 ? "0":"") + Math.round(elapsedSeconds % 60) ;
timer_mc1.elapsedTime.text = runTime;
//trace("Elapsed time in minutes:seconds: " + runTime);
}

Embedded Video:Display Total Length & Running Time.
Hi
I have a 26 seconds long video embedded in a flash movie.
Id like to display the total length and running time in a timer.
Is this possible?
What should I do?

Stuck at work
Thanks
Leo

Can You Tell How Much Time Has Elapsed In An MP3 Playback?
I've seen several methods referred to for finding the current time of an FLV playback. I've even tried to graft one or two onto MP3 playbacks, but with no luck at all.

Other than starting a wild-running getTimer() at the same time as one starts, how can I tell how much time has elapsed in the playback of an MP3? I sure don't want to haul all those MB's down the pipe when a few hundred k's will do the job.

Thanks,
Dorothy

FLV Playback With Time Codes
I have been able to use and customize the built-in components in Flash 8 to get my video playing. But, I want to also display the length of the video as well as the current position in playback (e.g., 0:25/2:30) - 25 seconds into a movie that is 2 minutes and 30 seconds long. Also, I currently have the ability to scrub through the movie during playback, so obviously the time code should update as well. I've seen people using the NetStream object in order to obtain that information, but can I still do that while using components for all other playback options? My skill level is quite low in Flash so any help would be appreciated.

How To Keep Track Of Video Playback Time?
Hi,

I have a custom player and I want to have something pops up at certain cue points, I can't use addASCuePoint since
I'm not using the component, I'm not sure what is the most efficient way to do that. I suppose I will put all the cue
points in an array and then.... I have no idea, should I listen to stream.time all the time in an enterframe function??
Thanks in advance.

Cheers,
Christine

FLV Video Playback With Duration Time
Here is new Tutorial which makes me very happy…
Introduction: When Flash plays FLV file he cannot see duration of complete FLV file, except in case you use Flash Media Server. So you can imagine how tought or impossible it is to make seek bar for displaying elapsed time or controlling video time position.

EDIT :
look few posts down and you can see you also can and better use Stream.onMetaData for single files

PHP script opens FLV file, seeks bytes at the end, extracts infromation about video duration and return to Flash information about duration of FLV movie, and from that point there is no problem
Example is just coding one, doing some buttons, style and rest I leave it to you

also, if you do some serious application you should consider dynamic buffering technology, where buffer length and time is set dynamicly while movie is playing visitor recieve best results
so here it is
EXAMPLE
ZIP
just in same folder you unpack put FLV file named video.flv or use mine from this addressi
Happy New Year !!! Wish you all the best …



more on blogpost

Flv Playback Show Duration / Time Played
i'm using an flv playback component to stream videos from a streaming server. I've got it working... now the client wants to have a duration / time played indicator (dynamic textbox).

I've been looking for good information on how to do this and so far have only been able to find info on how to get the duration from the metadata (already figured on doin that).

anyone know of any good resources/code examples?

thanks a million!

How Do I Randomize Start Time For Playback Of Movie Clips...
say i have a grid of boxes that fade from 0% Opacity to 100% opacity over 50 frames..

the grid is 10x20

how would i make it so that each box starts at a random time somwhere in a period of about 4 seconds...

Total Visits/total Sound Plays
How can I get a "total visits"type function but instead of recording the number of visits, it records the number of sounds streamed from that flash movie and makes it visible

Total Visits/total Sound Plays
How can I get a "total visits"type function but instead of recording the number of visits, it records the number of sounds streamed from that flash movie and makes it visible

Total Visits/ Total Sounds Played
How can I get a "total visits" type function that makes the number of times a page has been visited visible, but instead of recording the number of visits, it records the number of sounds streamed from that flash movie and makes it visible. (Not pages but externally loaded and streamed sound.)

tks
ken

Copyright © 2005-08 www.BigResource.com, All rights reserved