Ask a Question related to Macromedia Flash Flashcom, Design and Development.
-
pilahaka #1
Pausing a NetStream while publishing to allow buffer toempty
I am having trouble with dialup users who are publishing webcam video using
NetStream.publish(streamname, "record"). The video doesn't completely upload
because there's a backlog of data in the buffer that gets tossed when they hit
the Stop button in my app and the stream gets closed.
I figured a workaround would be to pause the uploading stream and wait for the
bufferLength to reach zero before closing the stream, but I can't figure out
how to pause a publishing stream. NetStream.pause() doesn't seem to work.
I'd appreciate any help. Thanks.
pilahaka Guest
-
Preventing a NetStream.Buffer.Flush
I need to buffer a large amount of (non-live) streaming content in the background while the user is distracted with something else. So far, the only... -
NetStream.Play.Stop/NetStream.Buffer.Flush calledprematurely
So I've created a custom video interface (based on the one http://movielibrary.lynda.com/html/modPage.asp?ID=182 ) that hinges on the... -
NetStream Buffer Pause
I have a progressive video file FLV which is dynamically loaded using AS NetStream function. Now I want to stop the buffering of the video after a... -
NetStream.Buffer.Flush
Hi people, I am getting a status code of "NetStream.Buffer.Flush" This isn't documented anywhere. Can you explain the meaning of this status... -
NetStream.Buffer problem on RH9.0
Hi... I am having a problem using fcs on linux... First, I've tryied on Debian(SUCKS), so, I read in somewhere that FCS should work better on Red... -
pilahaka #2
Re: Pausing a NetStream while publishing to allow bufferto empty
I came up with another workaround, that's not very elegant and certainly not
foolproof, but it works... mostly. I'd still appreciate any other ideas. So,
for posterity, here' what I did.
When the user clicks the Stop button, I calculate a kbps using the buffer and
the stream time, in an effort to figure out a time in the future when all the
video up to the point where they clicked stop <u>should</u> be uploaded:
stopTime = ns.time + ((ns.bufferLength / ((ns.time - ns.bufferLength) /
ns.time)) * 1.20); // 20% margin for error
Since, I can't seem to pause the stream, I let it go and wait until
NetStream.time = stopTime. In my tests it seems to work pretty well, but if
the user's upload speed varies by too much, video will get cut off. It also
runs the risk of recording too much and capturing embarassing moments. All in
all, not good, but the best I could do.
I'd still appreciate some help.
pilahaka Guest
-
fromsir12 #3
Re: Pausing a NetStream while publishing to allow bufferto empty
I was wrestling with the same problem. Here is the solution I used and it
sounds like it might solve your problem.
When the user hits Stop, use the code:
function stopRecording() {
recordStatus.text = "Paused";
stopRecordingVid = true;
record_ns.attachVideo(null);
record_ns.attachAudio(null);
delete user_mic;
delete user_cam;
}
Then for the NetStream's onStatus event:
record_ns.onStatus = function(infoObject:Object) {
if(infoObject.code == "NetStream.Unpublish.Success"){
playback();
}
if(infoObject.code == "NetStream.Buffer.Empty"){
if(stopRecordingVid == true){
record_ns.publish(false);
record_ns.close();
delete record_nc;
}
}
Whatever you set the buffer to .... when it empties out, the onStatus event
will be called and by catching this along with the boolean set by the Stop
button ... the flash recorder will stop taking data, the buffer will be sent
with the stream, and when the buffer empties out, have the onStatus event catch
it and close the stream.
Hope this helps!
Brian
}
fromsir12 Guest
-
pilahaka #4
Re: Pausing a NetStream while publishing to allow bufferto empty
Thanks. Works like a charm.
pilahaka Guest
-
andrzej #5
Pausing a NetStream while publishing to allow buffer to empty
Hi,
I'm using your solution - but my recorded video is a little bit shorter than expected...
I made a timer witch stops the recording after 30 seconds. So after 30 seconds :
ns.attachCamera(null);
ns.attachAudio(null);
then i'm waiting for the "NetStream.Buffer.Empty" event to close the NetStream
I don't understand why my video lasts 29 seconds and not 30
I would understand if the video was longer but why shorter ?andrzej Guest



Reply With Quote

