FORUMS: list search recent posts

How do I keep a streaming flv from playing until user clicks play?

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
honion
How do I keep a streaming flv from playing until user clicks play?
on Mar 7, 2006 at 2:58:00 pm

I am trying to get the file to loop a still image that would act as a buffer until the user clicks play, but I don't see how to do it with streaming video, I have tried putting in a preloader but that doesn't work and I have tried adding a stop into the code and that doesn't work. Here is the code I am using. I essentially want to turn off "autoplay"...

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

var ns:NetStream = new NetStream(nc);

ns.setBufferTime(5);

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("ng_overview");

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

playButton.onRelease = function() {
ns.play();
}


Return to posts index

lajoiet
Re: How do I keep a streaming flv from playing until user clicks play?
on Mar 7, 2006 at 9:00:42 pm

Immediatly after:

ns.play("ng_overview");

put:

ns.pause(true);


Also, your code for the play button is incorrect. The ns.play function is used to attach a video to the netstream object, not for play/pause. To code correctly for separate play and pause buttons it should be like this:

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

playButton.onRelease = function() {
ns.pause(false);
}

When you use the ns.pause(); function without the true or false parameters it acts like a toggle. So in your code the pause button would both pause and play the video, depending on if it were playing or paused when it was clicked.

>Todd
_____________________________________

I'm filling a need. Without me there would be no bad examples.
_____________________________________


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]