0

I want to ask how to save video and audio content that I'm loading from some site through a NetStream as an FLV file.

Is there any possible way to do this?

var ns:NetStream = new NetStream(nc); 
ns.play('http://somefile.com/file.flv');
var file:FileReference=new FileReference();
**ns.doSomething(file); /// ???**
file.save(data,"flvfile.flv");  
el Dude
  • 5,003
  • 5
  • 28
  • 40

1 Answers1

1

I don't think you can do this with NetStream - it doesn't necessarily hold the entire file at any one time.

Why not just point the file reference to 'http://somefile.com/file.flv' - open that, then grab the data from it and save that with another reference once it has completed downloading? You can either run the NS in parallel as a separate operation, or open the NS from the local disc once it has finished downloading.

There's a good answer regarding downloading directly using a FileReference, and the gotchas it involves, here: Flex 3 file download - Without URLRequest

Community
  • 1
  • 1
Jude Fisher
  • 11,138
  • 7
  • 48
  • 91
  • Thanx for you reply, but does it mean that file will be downloaded 2 times? One with netStream, and second with fileRef? – el Dude Aug 27 '12 at 17:06
  • It depends. If you can wait for it all to download, no - you download it to local disk and then stream it from there. Otherwise, yes - you would stream one copy while downloading a second in the background. – Jude Fisher Aug 27 '12 at 18:20
  • I thought that in case video is downloaded, button "save" become visible. So... I don't know =( Anyway, thanx – el Dude Aug 27 '12 at 22:12