# Pause flv at x seconds

**URL:** <https://forum.kirupa.com/t/pause-flv-at-x-seconds/298934>\
**Category:** flash\
**Created:** [October 27, 2009, 12:38pm UTC](https://forum.kirupa.com/t/pause-flv-at-x-seconds/298934 "2009-10-27T12:38:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![8bitboy](https://avatars.discourse-cdn.com/v4/letter/8/c6cbf5/32.png) [@8bitboy](https://forum.kirupa.com/u/8bitboy)\
**Post date:** [October 27, 2009, 12:38pm UTC](https://forum.kirupa.com/t/pause-flv-at-x-seconds/298934/1 "2009-10-27T12:38:56Z")

</div>

Hi I am using an xml video player that does not use the flv component in flash but a video clip object. So unfortunately I cannot utilize the cue points feature. All I want to do is pause the flv at a certain point for a number of seconds, fade in some movieclips, then fade out the movieclips and resume the flv and move onto the next one.

I assumed it would be easy enough to use the existing timer to pause at a certain number of seconds.  
Heres what I have so far

if (controls\_mc.sound\_time\_mc.time\_txt == 04){  
ns.pause(true);  
fadeImage(copy\_txt,0,100,2)  
}

heres the action-script to load the video

resetVideo = function () {  
durationDisplay = “0:00”;  
controls\_mc.progress\_mc.buffer\_mc.\_xscale = 0;  
controls\_mc.progress\_mc.played\_mc.\_xscale = 0;  
doPlay();  
};  
resetVideo();  
// Video stream  
var nc:NetConnection = new NetConnection(this);  
nc.connect(null);  
var ns:NetStream = new NetStream(nc);  
ns.setBufferTime(defaultBuffer);  
// Attach video stream  
video\_holder.videoClip.attachVideo(ns);  
// Attach audio stream  
video\_holder.attachAudio(ns);  
video\_holder.videoClip.smoothing = true;  
loadVideo = function () {  
doHighlight();  
// Get video data from XML  
Aspect = xmlNode.childNodes[galleryID].childNodes[ID].attributes.Aspect;  
toLoad = xmlNode.childNodes[galleryID].childNodes[ID].attributes.VideoClip;  
Title.text = xmlNode.childNodes[galleryID].childNodes[ID].attributes.header;  
subTitle.text = xmlNode.childNodes[galleryID].childNodes[ID].attributes.subheader;  
galleryTitle.text = xmlNode.childNodes[galleryID].attributes.Name;  
resetVideo();  
ns.play(toLoad);  
video\_holder.preloader\_mc.\_visible = true;  
// Set 4:3 or 16:9 mode  
if (Aspect == “16:9”) {  
video\_holder.videoClip.\_width = video\_holder.bg\_mc.\_width=video\_holder.videoClip.o riginWidth;  
video\_holder.videoClip.\_height = video\_holder.bg\_mc.\_height=video\_holder.videoClip. originHeight\*0.75;  
video\_holder.videoClip.\_y = video\_holder.bg\_mc.\_y=(video\_holder.videoClip.orig inHeight-video\_holder.videoClip.\_height)/2;  
} else {  
video\_holder.videoClip.\_width = video\_holder.bg\_mc.\_width=video\_holder.videoClip.o riginWidth;  
video\_holder.videoClip.\_height = video\_holder.bg\_mc.\_height=video\_holder.videoClip. originHeight;  
video\_holder.videoClip.\_y = video\_holder.bg\_mc.\_y=0;  
}  
// Video preloader and end of video detection for autoplay  
ns.onStatus = function(obj) {  
if (obj.code == “NetStream.Buffer.Full”) {  
video\_holder.preloader\_mc.\_visible = false;  
}  
if (obj.code == “NetStream.Buffer.Flush”) {  
video\_holder.preloader\_mc.\_visible = false;  
}  
if (obj.code == “NetStream.Buffer.Empty”) {  
video\_holder.preloader\_mc.\_visible = true;  
}  
if (obj.code == “NetStream.Play.Start”) {  
videoEnd = false;  
}  
if (obj.code == “NetStream.Play.Stop”) {  
videoEnd = true;  
controls\_mc.bttnPlay.icon\_mc.gotoAndStop(2);  
video\_holder.preloader\_mc.\_visible = false;  
if (!mouseIsDown && autoMode) {  
doAutoPlay();  
}  
}  
if (videoEnd) {  
video\_holder.preloader\_mc.\_visible = false;  
}  
};  
// Get video duration  
ns.onMetaData = function(obj) {  
duration = obj[“duration”];

var seconds2 = Math.round(duration%60);  
if (seconds2\<10) {  
seconds2 = “0”+seconds2;  
}

durationDisplay = +seconds2  
};  
};  
//  
// DETECT MOUSE DOWN  
//  
var mouseListener:Object = new Object(this);  
mouseListener.onMouseUp = function() {  
mouseIsDown = false;  
};  
mouseListener.onMouseDown = function() {  
mouseIsDown = true;  
};  
// AUTO PLAY BUTTON  
if (autoMode == false) {  
select\_mc.bttnPlay.icon\_mc.gotoAndStop(2);  
}  
select\_mc.bttnPlay.bttn.onPress = function() {  
if (select\_mc.bttnPlay.icon\_mc.\_currentframe == 1) {  
select\_mc.bttnPlay.icon\_mc.gotoAndStop(2);  
autoMode = false;  
} else {  
select\_mc.bttnPlay.icon\_mc.gotoAndStop(1);  
autoMode = true;  
doAutoPlay();  
}  
};  
//  
// AUTOPLAY FUNCTION  
//  
doAutoPlay = function () {  
ID += 1;  
if (ID == galleryTotal) {  
ID = 0;  
galleryID += 1;  
if (galleryID == total) {  
galleryID = 0;  
}  
buildGallery();  
} else {  
loadVideo();  
}  
};

This may also be relevant

onEnterFrame = function () {  
// Get video stream bytes loaded  
percentage = Math.round(ns.bytesLoaded/ns.bytesTotal\*100);  
controls\_mc.progress\_mc.buffer\_mc.\_xscale = percentage;  
// Get video time  
ns\_seconds = ns.time;  
minutes = Math.floor(ns\_seconds/60);  
seconds = Math.floor(ns\_seconds%60);  
if (seconds\<10) {  
seconds = “0”+seconds;  
}

// Display current time  
controls\_mc.sound\_time\_mc.time\_txt.text = minutes+":"+seconds+" / "+durationDisplay;  
// Progress bar position  
controls\_mc.progress\_mc.played\_mc.\_xscale = Math.round(ns.time\*100/duration);  
};
