|
-
Help with display elapsed time for flv
Hey guys,
I'm new to using video with flash( so bare with);
I'm using version flash 8 pro;
I've been using the series goto and learn (which is great!);
One thing I would like to add is elapsed time for the flv, here is the flv file(ignore the video it's just a test);
http://www.chrissandersdesign.com/night1.flv
Right now I have two dynamic text boxes setup to display the time
the first is called - time_txt
the second is called - length_txt
I'm just not sure how of the right script to use to display how far into the video the user is and what the total length of the video is. I would like to contuine building on the goto and learn series.
Here is the code I'm using from that series:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
theVideo.attachVideo(ns);
ns.play("http://www.chrissandersdesign.com/night1.flv");
rewindButton.onRelease = function(){
ns.seek(0);
}
playButton.onRelease = function(){//plays and pauses the movie
ns.pause();
}
var videoInterval = setInterval(videoStatus, 100);
var amountLoaded:Number;
var duration:Number;
ns["onMetaData"] = function(obj) {
duration = obj.duration;
}
function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.loadbar._width = amountLoaded * 274;
loader.scrub._x = ns.time / duration * 274;
}
var scrubInterval;
loader.scrub.onPress = function() {
clearInterval(videoInterval);
scrubInterval = setInterval(scrubit,10);
this.startDrag(false,0,this._y,274,this._y);
}
loader.scrub.onRelease = loader.scrub.onReleaseOutside = function() {
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus,100);
this.stopDrag();
}
function scrubit() {
ns.seek(Math.floor((loader.scrub._x/274)*duration));
}
Thank You
Chris
Last edited by sledneck; 06-15-2007 at 01:32 PM.
Reason: should ask for help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|